summaryrefslogtreecommitdiffstats
path: root/dev/todo/boot-sequencing.mdwn
blob: 0c5b097a6da1e845ef439294790dceebad436ca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[[!meta title="Boot Sequencing"]]

Service scripts are now included in packages that provide system services (e.g.
`busybox`).  And symbolic links in `/etc/rc.d/` are now more flexibly organized.
This current solution currently suffices, and all of the below can be ignored
for now.

Although, in the future it would be nice to have a more efficient initialization
system and some kind of process management.

**The rest of this page is kept only for reference and historical purposes.**

---

Currently, service init scripts are provided by the monolithic `initscripts`
binary package. These init scripts are executed in the lexicographic order of
the symbolic links matching `/etc/rc.d/S*` that target them.  The names of these
symbolic links are currently hardcoded in [the `build` makefile][bf-build] of
the `basefiles` source package.  This monolithic packaging and hardcoding of
link names is a temporary and poor technical solution that doesn't scale with
the number and selection of services that can be installed on a system.  Init
scripts should instead be provided by the packages that provide the relevant
system services.  The order in which init scripts are executed should be
determined by dynamic boot sequencing based on inter-service dependency
metadata.

This boot sequencing can be done when the system boots or after a new system
service is installed.  For reference, NetBSD [uses a program called
"rcorder"][rcorder-doc] to determine a boot sequence at boot time.  Many
GNU/Linux distributions follow (to some degree) the Linux Standard Base (LSB)
specification, which defines ["Comment Conventions" for dependency
metadata][lsb-initscrcomconv] and [a method for installing sequentially-named
symbolic links][lsb-initsrcinstrm].  Conforming implementations perform boot
sequencing at the time of service installation.  Because boot sequencing at boot
time can slow down system booting, it is better to perform boot sequencing at
install time.

Thus, generally speaking, the solution to be adopted in this system is to make
packages that provide system services also include the necessary init scripts
(installed in `/etc/init.d`), to include inter-service dependency metadata in
init scripts, and to use a tool at the time of service package installation to
generate sequentially-named symoblic links in `/etc/rc.d`.

An obvious boot sequencing tool is ["insserv"][insserv] maintained by Werner
Fink and used by Debian and openSUSE.  However, this C program (in compliance
with the LSB) assumes the use of runlevels.  This operating system uses the init
daemon of BusyBox, which [doesn't support runlevels][bb-init.c].  Therefore,
we'll need to either modify insserv to work without runlevels or write our own
tool for installing symbolic links to init scripts.  (Either way, the tool
should be written in either C or UNIX shell command language, both of which are
portable and will be supported by all default installations of the OS.)

Additionally, we need to decide how completely we'll conform, if at all, with
the LSB in this area.


[bf-build]: http://git.os.pehjota.net/pkg/basefiles.git/tree/build?id=0ae24516#n43
[rcorder-doc]: http://www.netbsd.org/docs/guide/en/chap-rc.html#chap-rc-rcorder
[lsb-initscrcomconv]: http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
[lsb-initsrcinstrm]: http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/initsrcinstrm.html
[insserv]: http://svn.savannah.nongnu.org/viewvc/insserv/trunk/?root=sysvinit
[bb-init.c]: http://git.busybox.net/busybox/tree/init/init.c?id=3da46c81#n1221