1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <link rel=
"stylesheet" href=
"../mrtg-td/slides.css" type=
"text/css">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1">
6 <meta name=
"Language" content=
"en">
7 <meta name=
"Author" content=
"Petter Reinholdtsen">
11 <a href=
"200706-bootseq/200706-bootseq.html">forrige foredrag
</a>
13 <h1>Reordering the Debian boot sequence for correctness and speed
</h1>
15 <p>Autodetecting and configuring hardware during installation and at
18 <div class=
"presenter">Petter Reinholdtsen
20 <br>FOSDEM
2008,
2008-
02-
26</div>
26 - how do sysvinit boot work
31 - how does it work in debian
37 - how to write lsb headers
46 - what is needed to convert
47 - add LSB header to packages and get the change into testing
49 - more users to test headers and detect errors
50 - install and activate insserv by default
54 <h2>SysV init in Debian - Booting
</h2>
56 <p>Note, this is the stuff going on after the initrd part is done.
57 The very early boot is done before hard drive partitions is mounted.
</p>
61 <li>/sbin/init start, which look at /etc/inittab and decides what to
64 <li>The scripts in /etc/rcS.d/ is executed in sequence by
65 /etc/init.d/rc, with
<tt>start
</tt> as the argument.
</li>
67 <li>Depending on the runlevel, the scripts for the given runlevel is
68 executed (normally the ones in /etc/rc2.d/) are executed in
69 sequence, first the stop scripts with
<tt>stop
</tt> as their
70 argument, next the start scripts with
<tt>start
</tt> as their
71 argument. The rc*.d/ directories contain symlinks the files in to
74 <li>The ordering is important.
</li>
76 <li>The single-user runlevel will present a login prompt after rcS.d/
77 was executed. Runlevel
1 is not the single user runlevel, but it
78 behaves as a better single user.
</li>
82 <h2>SysV init in Debian - Switching runlevels
</h2>
86 <li>Call
<tt>telinit X
</tt> where X is the new runlevel, one of S,
0,
87 1,
2,
3,
4,
5,
6.
</li>
89 <li>init runs in sequence all stop scripts in /etc/rcX.d/ that also
90 has a start symlink in the previous runlevel /etc/rcY.d/, with
91 <tt>stop
</tt> as their argument.
</li>
93 <li>init then run in sequence all start scripts in /etc/rcX.d/, with
94 <tt>start
</tt> as their argument.
</li>
98 <p>Note that switching to runlevel S will not run the scripts in
99 /etc/rcS.d/. To get a similar effect after boot, switch to runlevel
100 1. It will (should) kill all services and prepare the machine for
103 <h2>SysV init in Debian - Shutting down
</h2>
105 <p>This is equivalent to switching to runlevel
0 (halt) or
6 (reboot),
106 with a minor exception. All scripts (both start and stop) are
107 executed with the
<tt>stop
</tt> argument.
109 <h2> about ordering
</h2>
111 <p>Script ordering is vital for this to work. And how are the scripts
119 <h2>LSB headers for insserv
</h2>
122 <li>"Provides" header, list the Facility/service provided by the
123 script. Do not list virtual facilities (like $time)
</li>
125 <li>Runlevel entries (Default-Start and Default-Stop headers), list
126 what runlevels to activate for this script
128 <li>Dependency entries (Required-Start, Required-Stop, Should-Start,
129 Should-Stop, X-Start-Before, X-Stop-After), list the
130 facilities/services needed by this script. It will start after
131 its start dependencies and stop before its stop dependencies. The
132 X-* entreis are reverse dependencies. Required-* are hard
133 dependencies (will install even if they are missing), while
134 Should-* and X-* are soft dependencies (only taken into account if
135 scripts providing them are present).
</li>
139 <h2>What to list as dependencies I
</h2>
141 <p>If your package used the default update-rc.d settings before, this
142 is the header for you:
</p>
145 # Provides: scriptname
146 # Required-Start: $remote_fs $syslog
147 # Required-Stop: $remote_fs $syslog
148 # Default-Start:
2 3 4 5
149 # Default-Stop:
0 1 6
153 <p>$remote_fs is needed by all scripts using files in /usr/. $syslog
154 is needed only by scripts starting services logging to syslog.
</p>
157 <h2>Status of dependency based boot
</h2>
159 <img alt=
"LSB header progress graph" src=
"lsb-header-progress.png" width=
"50%" align=
"right">
161 <p>Release goal for Debian Lenny.
163 <p>Packages with LSB header:
654 of
866 (
76%)
164 <br>Unsolved BTS reports: XXX
165 <br>Packages without BTS reports: ~
150
167 <p>Need better documentation
169 <p>Need debian policy updates
179 <h2>Thank you very much
</h2>
183 <p><a href=
"http://www.hungry.com/~pere/mypapers/200802-bootsequence/200802-bootsequence.html">http://www.hungry.com/~pere/mypapers/
200802-bootsequence/
200802-bootsequence.html
</a></p>