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">
8 <style type=
"text/css">
17 <h1>Dependency based boot sequence
</h1>
19 <p>Reordering the boot sequence for correctness and speed
</p>
21 <p>There are several boot options available in Debian, and the default
22 SysV-derived one can be tuned and corrected. The talk will present
23 the available options, and go into details on some of the pitfalls
24 and advantages of the default boot system. It will present some
25 results based on the Google summer of code project working on the
28 <div class=
"presenter">Petter Reinholdtsen
30 <br>Debconf
2007 Edinburgh,
2007-
06-
17</div>
32 <h2>About the speaker
</h2>
36 <li>Using Linux since
1993
37 <li>Debian Developer since
2002
39 <li>Educated at University of Tromsø, Western Australia and Oslo
41 <li>Employed at University of Oslo to develop system administration tools
42 <li>Leader of the Norwegian Unix User Group
44 <li>Co-maintaining sysvinit, maintaining insserv
45 <li>and a few other (Debian Edu, Debian GIS, Debian
46 Java, Debian Boot, etc)
50 <h2>Summary of this talk
</h2>
53 <li>Quick overview of the boot system alternatives in Debian
54 <li>Some problems with the current system
55 <li>How to improve the boot sequence ordering
56 <li>how to prepare packages for this
59 <p>Based on work done by Carlos Villegas during Google Summer of Code
61 <a href=
"http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/">http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/
</a>.
</p>
63 <h2>Debian include several boot system options
</h2>
65 <p>SysV init is only the most used boot system in Debian, not the only
75 <li>metainit initiative for init.d scripts
79 <h2>The SysV boot system
</h2>
83 <li>Start first all scripts in /etc/rcS.d/
85 <li>For the runlevel
2, first all K##scripts in /etc/rc2.d/, next all
88 <li>All .sh scripts are sourced, the rest are exec-ed
92 <a href=
"bootchart-sid.png"><img src=
"bootchart-sid.png" width=
"100%"></a>
94 <h2>Current sid boot sequence (base install)
</h2>
99 S01glibc.sh S30procps.sh
100 S02hostname.sh S35mountall.sh
101 S02mountkernfs.sh S36mountall-bootclean.sh
102 S04mountdevsubfs.sh S39ifupdown
103 S05bootlogd S40networking
104 S10checkroot.sh S45mountnfs.sh
105 S11hwclock.sh S46mountnfs-bootclean.sh
106 S12mtab.sh S55bootmisc.sh
107 S18ifupdown-clean S55urandom
108 S20module-init-tools S99stop-bootlogd-single
109 S25libdevmapper1.02
.1
113 S10sysklogd S99rc.local
114 S11klogd S99rmnologin
115 S20makedev S99stop-bootlogd
119 <h2>Current sid shutdown sequence (base install)
</h2>
123 K20makedev S31umountnfs.sh
124 K20openbsd-inetd S35networking
125 K25hwclock.sh S36ifupdown
127 K90sysklogd S60umountroot
132 <p>But is it correct?
134 <h2>Problems with the current boot system
</h2>
137 <li>Slightly incorrect ordering during startup and shutdown
138 <li>Hard to pick correct sequence number
139 <li>The halt/reboot runlevels are inconsistent/confusing (or wrong,
140 depending on your view)
142 <li>Impossible to parallelise
145 <h2>How can we verify the boot sequence correctness?
</h2>
147 <p><a href=
"depgraph-base.png"><img align=
"right" src=
"depgraph-base.png" width=
"100%"></a>
150 <li>Document the dependencies of each script
151 <li>Verify the scripts are started in dependency order
155 <p>Example header:
</p>
160 # Provides: networking
161 # Required-Start: mountkernfs ifupdown $local_fs
162 # Required-Stop: ifupdown $local_fs
163 # X-Start-Before: nis
167 # Short-Description: Raise network interfaces.
171 <h2>Verifying the current sequence
</h2>
173 <p>Using these headers and a script from the insserv package, we can
174 verify the boot order:
177 # /usr/share/insserv/check-initd-order -o
178 LSB header missing in /etc/rcS.d/S11hwclock.sh
179 LSB header missing in /etc/rcS.d/S25libdevmapper1.02
.1
180 Incorrect order modutils@?
> checkfs.sh@
30
181 Incorrect order $all@?
> stop-bootlogd-single@
99
182 Incorrect order $time@?
> sysklogd@
10
183 Incorrect order $time@?
> cron@
89
184 Incorrect order $all@?
> rmnologin@
99
188 <p>For the packages without dependency information, override files can be
189 read from
<tt>/usr/share/insserv/overrides/
</tt> and
190 <tt>/etc/insserv/overrides/
</tt>.
192 <h2>Verifying the current sequence II
</h2>
193 <p>Current status (base task install), with override files.
</p>
195 # /usr/share/insserv/check-initd-order
196 Incorrect order $local_fs@?
> hwclock.sh@
11
197 Incorrect order $remote_fs@?
> hwclock.sh@
11
198 Incorrect order modutils@?
> libdevmapper1.02
.1@
25
199 Incorrect order modutils@?
> checkfs.sh@
30
200 Incorrect order $all@?
> stop-bootlogd-single@
99
201 Incorrect order $all@?
> rmnologin@
99
205 <h2>Verifying the current sequence III
</h2>
206 <p>Current status (desktop task install)
</p>
208 # /usr/share/insserv/check-initd-order -o
209 LSB header missing in /etc/rcS.d/S11hwclock.sh
210 LSB header missing in /etc/rcS.d/S25libdevmapper1.02
.1
211 Incorrect order modutils@?
> checkfs.sh@
30
212 Incorrect order $all@?
> stop-bootlogd-single@
99
213 Incorrect order $time@?
> sysklogd@
10
214 LSB header missing in /etc/rc2.d/S19hplip
215 LSB header missing in /etc/rc2.d/S20cupsys
216 LSB header missing in /etc/rc2.d/S20hotkey-setup
217 LSB header missing in /etc/rc2.d/S89anacron
218 Incorrect order $time@?
> cron@
89
219 Incorrect order $all@?
> rmnologin@
99
223 <h2>Reordering based on dependency information
</h2>
229 <li>No need to replace existing init.d scripts
230 <li>Activated by adding headers to the scripts or use override files
231 <li>Experimental code to enable it is in the insserv package
235 <p>How to enable this by default
239 <li>Install the insserv package
240 <li>Make all start-symlinks in rc0 and rc6 to stop symlinks
241 <li>Replace update-rc.d
245 <h2>Status of dependency based sysv boot sequence
</h2>
247 <p><a href=
"insserv-enable.png"><img align=
"right" src=
"insserv-enable.png" width=
"100%"></a>
249 <li>Majority of common packages provides dependency information
250 <li>Correct startup sequence for base and desktop tasks when enabled.
251 <li>Fairly correct shutdown sequence.
252 <li>Some packages fail to install because of incorrect init.d script
258 To enable:
<tt>BAD_INSSERV_HACKER=true dpkg-reconfigure insserv
</tt>
261 insserv:/var/tmp/chroot-sid-base-reorder# BAD_INSSERV_HACKER=true dpkg-reconfigure i
262 info: Backing up existing boot scripts in /var/lib/insserv/bootscripts-
20070615T1617.tar.gz
263 info: Reordering boot system, log to /var/lib/insserv/run-
20070615T1617.log
264 info: Recording new boot sequence in /var/lib/insserv/bootscripts-
20070615T1617-after.list
265 info: Use '/usr/sbin/update-bootsystem-insserv restore' to restore the old boot sequence.
266 success: Boot system successfully converted
267 Adding `diversion of /usr/sbin/update-rc.d to /usr/sbin/update-rc.d.distrib by insserv'
271 <h2>Similar boot graph
</h2>
273 <a href=
"bootchart-reordered.png"><img src=
"bootchart-reordered.png" width=
"100%"></a>
275 <h2>Reordered sid boot sequence (base install)
</h2>
279 S01glibc.sh S06mountall.sh
280 S01libdevmapper1.02
.1 S07ifupdown
281 S02hostname.sh S07mountall-bootclean.sh
282 S02mountkernfs.sh S07urandom
283 S03mountdevsubfs.sh S08networking
284 S03procps.sh S09mountnfs.sh
285 S04bootlogd S10mountnfs-bootclean.sh
286 S04checkroot.sh S11bootmisc.sh
287 S05checkfs.sh S11hwclock.sh
288 S05ifupdown-clean S11stop-bootlogd-single
291 README S11openbsd-inetd
292 S07makedev S11rc.local
293 S07sysklogd S12stop-bootlogd
298 <h2>Reordered sid shutdown sequence (base install)
</h2>
302 K03openbsd-inetd K31umountnfs.sh
303 K06cron K35networking
305 K07sysklogd K40umountfs
306 K20makedev K60umountroot
307 K20sendsigs K90reboot
311 <h2>I'm not brave enough, get me out of here
</h2>
313 <p>It is possible to automatically undo the reordering,
<em>once
</em>,
314 by reconfiguring insserv and disabling the dependency based boot.
</p>
317 # BAD_INSSERV_HACKER=true dpkg-reconfigure i
318 info: Disabling dependency based boot system
319 Removing `diversion of /usr/sbin/update-rc.d to /usr/sbin/update-rc.d.distrib by insserv'
320 info: Restoring using backed up copy of init.d/ and rc*.d/.
321 info: successfully restored backup of init.d scripts
325 <h2>How can package maintainers assist
</h2>
329 <li>Update their init.d scripts to include correct dependency
330 information using the LSB headers defined for this purpose,
331 <a href=
"http://wiki.debian.org/LSBInitScripts">http://wiki.debian.org/LSBInitScripts
</a>
332 <li>Make sure their init.d scripts are registered in dependency order
333 <li>Start using insserv to detect bugs in the packages
336 <h2>Even running boot scripts in parallel is possible
</h2>
338 <pre>echo CONCURRENCY=shell
>> /etc/default/rcS
</pre>
339 <a href=
"bootchart-reord-concur.png"><img src=
"bootchart-reord-concur.png" width=
"100%"></a>
342 <h2>Thank you very much
</h2>
346 <p><a href=
"http://www.hungry.com/~pere/mypapers/200706-bootseq/">http://www.hungry.com/~pere/mypapers/
200706-bootseq/
</a></p>