]> pere.pagekite.me Git - homepage.git/blob - mypapers/200802-bootsequence/200802-bootsequence.html
First framework.
[homepage.git] / mypapers / 200802-bootsequence / 200802-bootsequence.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
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 </head>
9 <body>
10
11 <a href="200706-bootseq/200706-bootseq.html">forrige foredrag</a>
12
13 <h1>Reordering the Debian boot sequence for correctness and speed</h1>
14
15 <p>Autodetecting and configuring hardware during installation and at
16 runtime</p>
17
18 <div class="presenter">Petter Reinholdtsen
19 <br>pere@hungry.com
20 <br>FOSDEM 2008, 2008-02-26</div>
21
22 <h2>Summary</h2>
23
24 <!--
25
26 - how do sysvinit boot work
27 - runlevels
28 - inittab
29 - rc*.d/
30 - ordering issue
31 - how does it work in debian
32 - effect on the boot
33 - insserv
34 - speed change?
35 - concurrency
36
37 - how to write lsb headers
38 - provides
39 - deps
40 - runlevel list
41
42 - status in debian
43 - need better doc
44 - fix insserv bugs
45
46 - what is needed to convert
47 - add LSB header to packages and get the change into testing
48 - update policy
49 - more users to test headers and detect errors
50 - install and activate insserv by default
51
52 -->
53
54 <h2>SysV init in Debian - Booting</h2>
55
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>
58
59 <ol>
60
61 <li>/sbin/init start, which look at /etc/inittab and decides what to
62 do.</li>
63
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>
66
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
72 /etc/init.d/.</li>
73
74 <li>The ordering is important.</li>
75
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>
79
80 </ol>
81
82 <h2>SysV init in Debian - Switching runlevels</h2>
83
84 <ul>
85
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>
88
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>
92
93 <li>init then run in sequence all start scripts in /etc/rcX.d/, with
94 <tt>start</tt> as their argument.</li>
95
96 </ul>
97
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
101 maintenance.</p>
102
103 <h2>SysV init in Debian - Shutting down</h2>
104
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.
108
109 <h2> about ordering </h2>
110
111 <p>Script ordering is vital for this to work. And how are the scripts
112 ordered?
113
114 update-rc.d numbers.
115
116
117
118
119 <h2>LSB headers for insserv</h2>
120
121 <ul>
122 <li>"Provides" header, list the Facility/service provided by the
123 script. Do not list virtual facilities (like $time)</li>
124
125 <li>Runlevel entries (Default-Start and Default-Stop headers), list
126 what runlevels to activate for this script
127
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>
136
137 </ul>
138
139 <h2>What to list as dependencies I</h2>
140
141 <p>If your package used the default update-rc.d settings before, this
142 is the header for you:</p>
143 <pre>
144 ### BEGIN INIT INFO
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
150 ### END INIT INFO
151 </pre>
152
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>
155
156
157 <h2>Status of dependency based boot</h2>
158
159 <img alt="LSB header progress graph" src="lsb-header-progress.png" width="50%" align="right">
160
161 <p>Release goal for Debian Lenny.
162
163 <p>Packages with LSB header: 654 of 866 (76%)
164 <br>Unsolved BTS reports: XXX
165 <br>Packages without BTS reports: ~150
166
167 <p>Need better documentation
168
169 <p>Need debian policy updates
170
171 <p>
172
173 - status in debian
174 - need better doc
175 - fix insserv bugs
176
177
178
179 <h2>Thank you very much</h2>
180
181 <h3>Questions?</h3>
182
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>
184
185 </body>
186 </html>