]> pere.pagekite.me Git - homepage.git/blobdiff - mypapers/200802-bootsequence/200802-bootsequence.html
Update to current version.
[homepage.git] / mypapers / 200802-bootsequence / 200802-bootsequence.html
index 21e9e045bf8c7ebf1c9468cd49ac310e630a227a..bdd895755631f8fc667c982bfde2c790181b3437 100644 (file)
@@ -6,6 +6,11 @@
     <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>
 
@@ -55,7 +60,11 @@ This talk is about how all of this can be done with Debian.
  - 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
 
@@ -104,6 +113,9 @@ The very early boot is done before hard drive partitions is mounted.</p>
 
 </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>
@@ -127,9 +139,15 @@ maintenance.</p>
 
 <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>
 
@@ -184,7 +202,73 @@ numbers using this dependency information.  Example:
 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>
 
@@ -223,14 +307,6 @@ is the header for you:</p>
 <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:
@@ -273,6 +349,23 @@ facility, then that daemon has been started.
 
 <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">
@@ -280,22 +373,31 @@ facility, then that daemon has been started.
 <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>