<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Language" content="en">
<meta name="Author" content="Petter Reinholdtsen">
+<style type="text/css">
+PRE {
+ font-size: smaller
+}
+</style>
</head>
<body>
- how does it work in debian
- effect on the boot
- insserv
+ - how to verify the boot sequence
+ - check script
+ - dependency graph using dotty
- how to test it
+ - overriding included headers
- speed change?
- concurrency
</ol>
+<p>Note that because the Linux kernel is becoming more and more event
+based, the boot sequence is no longer sequencial.<p>
+
<h2>SysV init in Debian - Switching runlevels</h2>
<ul>
<h2>SysV init in Debian - Shutting down</h2>
-<p>This is equivalent to switching to runlevel 0 (halt) or 6 (reboot),
- with a minor exception. All scripts (both start and stop) are
- executed with the <tt>stop</tt> argument.
+<p>This is roughtly equivalent to switching to runlevel 0 (halt) or 6
+(reboot).</p>
+
+<p>Minor exception: all scripts (both start and stop) are executed
+ with the <tt>stop</tt> argument, ignoring their start and stop
+ setting and confusing script writers.</p>
+
+<p>Only stop scripts for services started in the previous runlevel is
+ executed.</p>
<h2>The ordering problem</h2>
sequencing, provided in the insserv package. Uses format specified in
Linux Software Base to document dependencies.</p>
+<h2>Checking the current boot sequence</h2>
+
+<p>Static checking of current headers:
+<tt>/usr/share/insserv/check-initd-order [-o] [-k]</tt> - report mismatch
+in current ordering.
+
+<p>Graph of the dependencies:
+<a href="sid-base-boot-20080220.dot"><tt>/usr/share/insserv/check-initd-order -g</tt></a> - for reviewing dependencies
+
+<h2>Enabling dependency based boot sequencing I</h2>
+
+<p><a href="insserv-enable.png"><img align="right" src="insserv-enable.png" width="50%"></a>
+<ul>
+ <li>Use the insserv package in unstable and testing
+ <li>Low priority debconf question.
+ <li>Only enabled after verfiying that it is safe to enable
+ <li>Converts all start symlinks in rc0.d/ and rc6.d with stop symlinks.
+ <li>Replaces update-rc.d with wrapper calling insserv
+ <li>All of rc*.d/ is reordered
+</ul>
+
+<h2>Enabling dependency based boot sequencing II</h2>
+
+<p><pre size="-1">
+# aptitude install insserv
+# dpkg-reconfigure insserv
+info: Checking if it is safe to convert to dependency based boot.
+info: Backing up existing boot scripts in \
+ /var/lib/insserv/bootscripts-20080223T0742.tar.gz
+info: Reordering boot system, log to \
+ /var/lib/insserv/run-20080223T0742.log
+info: Recording new boot sequence in \
+ /var/lib/insserv/bootscripts-20080223T0742-after.list
+info: Use '/usr/sbin/update-bootsystem-insserv \
+ restore' to restore the old boot sequence.
+Adding `diversion of /usr/sbin/update-rc.d to \
+ /usr/sbin/update-rc.d.distrib by insserv'
+success: Boot system successfully converted
+# <a href="sid-base-seqchanges.txt">/var/lib/insserv/insserv-seq-changes \
+ /var/lib/insserv/bootscripts-20080223T0742.tar.gz</a>
+#
+</pre>
+
+<h2>With dependency based boot sequencing</h2>
+
+<p>update-rc.d refuse to Insert scripts which create a loop.</p>
+
+<p>update-rc.d require scripts to be inserted in dependency order.</p>
+
+<p>Incorrect dependencies give the wrong boot and shutdown order.</p>
+
+<p>It is possible to enable concurrent booting, running boot scripts
+ in parallel (CONCURRENCY=startpar in /etc/default/rcS)</p>
+
+<h2>Disabling dependency based boot sequencing</h2>
+
+<p>Run <tt>dpkg-reconfigure insserv</tt> and disable it.
+
+<p>It is always possible to disable just after it was enabled, before
+any new packages are installed.</p>
+<p>To disable it, a backup of the old boot sequence is restored if no
+changes has been done to the boot sequence since it was enabled.
+
+<p>If restoring is not possible, All postinst scripts for packages
+with init.d scripts will be executed again to get them to call
+update-rc.d and add the boot scripts again.
<h2>LSB headers for insserv</h2>
<p>$remote_fs is needed by all scripts using files in /usr/. $syslog
is needed only by scripts starting services logging to syslog.</p>
-<h2>What to list as dependencies II</h2>
-
-<p>In the common case, the start and stop dependencies are identical.
-
-<p>Prefer virtual dependencies over specific dependencies
-
-XXX More
-
<h2>Virtual facilities</h2>
<p>Linux Software Base version 3.2 define these virtual facilities:
<p>All of these represent points in time during boot and shutdown.
+<h2>What to list as dependencies II</h2>
+
+<p>Normally, the start and stop dependencies are the same.
+
+<p>Prefer virtual dependencies over specific dependencies.
+
+<p>When using specific dependencies, use the string listed in the
+ provides header of the scripts you depend on.
+
+<p>Scripts started in rcS.d/ need extra care.
+
+<p>Depend on $remote_fs unless started in rcS.d/. Make sure /usr/ is
+available during start and that it is stopped before sendsigs kill all
+processes during shutdown.</p>
+
+XXX More
+
<h2>Status of dependency based boot</h2>
<img alt="LSB header progress graph" src="lsb-header-progress.png" width="50%" align="right">
<p>Release goal for Debian Lenny.
<p>Packages with LSB header (in Sid): 654 of 866 (76%)
-<br>Unsolved BTS reports: XXX
+<br>Unsolved BTS reports: 85
<br>Packages without BTS reports: ~150
<br>Last package projected fixed 2008-07-19 with the current rate
<p>Need better documentation
-<p>Need debian policy updates
+<p>Should update Debian policy to reflect this new feature.
-<p>Fix insserv bugs
+<p>Two insserv bugs to fix.
+<ul>
+<li>Avoid adding unwanted stop symlinks.
+<li>Do not fail on "fake" loops. (minor)
+</ul></p>
<p>
+<h2>Tracking status</h2>
+debian/rules missing-overrides
+debian/rules missing-by-popcon
+
<h2>References</h2>
http://wiki.debian.org/LSBInitScripts
http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot
+svn+ssh://svn.debian.org/svn/initscripts-ng/trunk/src/insserv
<h2>Thank you very much</h2>
--- /dev/null
+# Generating graph
+digraph packages {
+#rankdir=LR;
+concentrate=true;
+"glibc" [shape=box];
+"glibc" -> "hostname"[color=springgreen] ;
+"hostname" [shape=box];
+"glibc" -> "mountkernfs"[color=springgreen] ;
+"mountkernfs" [shape=box];
+"mountkernfs" -> "mountdevsubfs"[color=blue] ;
+"udev" -> "mountdevsubfs"[color=springgreen] ;
+"mountdevsubfs" [shape=box];
+"mountdevsubfs" -> "bootlogd"[color=blue] ;
+"bootlogd" [shape=box];
+"mountdevsubfs" -> "hwclockfirst"[color=blue] ;
+"hwclockfirst" [shape=box];
+"mountdevsubfs" -> "checkroot"[color=blue] ;
+"hostname" -> "checkroot"[color=blue] ;
+"keymap" -> "checkroot"[color=springgreen] ;
+"hwclockfirst" -> "checkroot"[color=springgreen] ;
+"hdparm" -> "checkroot"[color=springgreen] ;
+"bootlogd" -> "checkroot"[color=springgreen] ;
+"checkroot" [shape=box];
+"hwclock" -> "$time"[color=blue] ;
+"$time" [shape=box];
+"mountdevsubfs" -> "hwclock"[color=blue] ;
+"hwclock" [shape=box];
+"checkroot" -> "mtab"[color=blue] ;
+"mtab" [shape=box];
+"checkroot" -> "ifupdown-clean"[color=blue] ;
+"ifupdown-clean" [shape=box];
+"checkroot" -> "module-init-tools"[color=springgreen] ;
+"module-init-tools" [shape=box];
+"checkroot" -> "checkfs"[color=blue] ;
+"mtab" -> "checkfs"[color=springgreen] ;
+"cryptdisks" -> "checkfs"[color=springgreen] ;
+"checkfs" [shape=box];
+"mountkernfs" -> "procps"[color=blue] ;
+"procps" [shape=box];
+"$local_fs" -> "$remote_fs"[color=blue] ;
+"$remote_fs" [shape=box];
+"mountall" -> "$local_fs"[color=blue] ;
+"$local_fs" [shape=box];
+"checkfs" -> "mountall"[color=blue] ;
+"mountall" [shape=box];
+"mountall" -> "mountall-bootclean"[color=blue] ;
+"mountall-bootclean" [shape=box];
+"$local_fs" -> "$remote_fs"[color=blue] ;
+"$remote_fs" [shape=box];
+"mountoverflowtmp" -> "$local_fs"[color=blue] ;
+"$local_fs" [shape=box];
+"mountall-bootclean" -> "mountoverflowtmp"[color=blue] ;
+"mountoverflowtmp" [shape=box];
+"$network" -> "$named"[color=blue] ;
+"$named" [shape=box];
+"ifupdown" -> "$network"[color=blue] ;
+"$network" [shape=box];
+"ifupdown-clean" -> "ifupdown"[color=blue] ;
+"ifupdown" [shape=box];
+"$network" -> "$named"[color=blue] ;
+"$named" [shape=box];
+"networking" -> "$network"[color=blue] ;
+"$network" [shape=box];
+"mountkernfs" -> "networking"[color=blue] ;
+"ifupdown" -> "networking"[color=blue] ;
+"$local_fs" -> "networking"[color=blue] ;
+"networking" [shape=box];
+"mountnfs" -> "$remote_fs"[color=blue] ;
+"$remote_fs" [shape=box];
+"$local_fs" -> "mountnfs"[color=blue] ;
+"$network" -> "mountnfs"[color=springgreen] ;
+"nfs-common" -> "mountnfs"[color=springgreen] ;
+"udev-mtab" -> "mountnfs"[color=springgreen] ;
+"mountnfs" [shape=box];
+"mountnfs-bootclean" -> "$remote_fs"[color=blue] ;
+"$remote_fs" [shape=box];
+"mountnfs" -> "mountnfs-bootclean"[color=blue] ;
+"mountnfs-bootclean" [shape=box];
+"$remote_fs" -> "bootmisc"[color=blue] ;
+"bootmisc" [shape=box];
+"$local_fs" -> "urandom"[color=blue] ;
+"urandom" [shape=box];
+"$remote_fs" -> "stop-bootlogd-single"[color=blue] ;
+"$all" -> "stop-bootlogd-single"[color=blue] ;
+"stop-bootlogd-single" [shape=box];
+"sysklogd" -> "$syslog"[color=blue] ;
+"$syslog" [shape=box];
+"$local_fs" -> "sysklogd"[color=blue] ;
+"$time" -> "sysklogd"[color=blue] ;
+"$network" -> "sysklogd"[color=springgreen] ;
+"sysklogd" [shape=box];
+"sysklogd" -> "klogd"[color=blue] ;
+"klogd" [shape=box];
+"$remote_fs" -> "cron"[color=blue] ;
+"$syslog" -> "cron"[color=blue] ;
+"$time" -> "cron"[color=blue] ;
+"cron" [shape=box];
+"$remote_fs" -> "rc.local"[color=blue] ;
+"rc.local" [shape=box];
+"$remote_fs" -> "rmnologin"[color=blue] ;
+"$all" -> "rmnologin"[color=blue] ;
+"rmnologin" [shape=box];
+"$remote_fs" -> "stop-bootlogd"[color=blue] ;
+"rmnologin" -> "stop-bootlogd"[color=blue] ;
+"stop-bootlogd" [shape=box];
+}