]> git.decadent.org.uk Git - i-t-talk.git/blob - index.html
Problems
[i-t-talk.git] / index.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
2         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml">
5
6 <head>
7 <title>initramfs-tools - mini-DebConf Cambridge 2014</title>
8 <!-- metadata -->
9 <meta name="generator" content="S5" />
10 <meta name="version" content="S5 1.1" />
11 <meta name="author" content="Ben Hutchings" />
12 <!-- configuration parameters -->
13 <meta name="defaultView" content="slideshow" />
14 <meta name="controlVis" content="hidden" />
15 <!-- style sheet links -->
16 <link rel="stylesheet" href="s5-blank/ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
17 <link rel="stylesheet" href="s5-blank/ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
18 <link rel="stylesheet" href="s5-blank/ui/default/print.css" type="text/css" media="print" id="slidePrint" />
19 <link rel="stylesheet" href="s5-blank/ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
20 <style type="text/css">
21   .logo { position: absolute; right: 0; top: 0; height: 100% }
22   table { border-collapse: collapse }
23   th { border-bottom: 2pt solid black }
24   th, td { padding: 0 6pt }
25   .package { font-family: monospace }
26   var { font-family: sans }
27 </style>
28 <style type="text/css" media="print">
29   .slide { page-break-after: always }
30 </style>
31 <!-- S5 JS -->
32 <script src="s5-blank/ui/default/slides.js" type="text/javascript"></script>
33 </head>
34 <body>
35
36 <div class="layout">
37 <div id="controls"><!-- DO NOT EDIT --></div>
38 <div id="currentSlide"><!-- DO NOT EDIT --></div>
39 <div id="header">
40 </div>
41 <div id="footer">
42 <h1>mini-DebConf Cambridge 2014</h1>
43 <h2>initramfs-tools</h2>
44 </div>
45
46 </div>
47
48 <div class="presentation">
49
50 <div class="slide">
51 <h1>initramfs-tools</h1>
52 <object data="tux-debian.svg" width="35%" align="right"></object>
53 <h3>Ben&nbsp;Hutchings</h3>
54 </div>
55
56 <div class="slide">
57   <h1>What is the initramfs for?</h1>
58   <ul class="incremental">
59     <li>
60       Huge variety of disk drivers, net drivers and filesystems that
61       may be needed to mount root
62     </li>
63     <li>
64       Generic kernel shouldn't have all these built-in
65     </li>
66     <li>
67       Root might also need RAID, LVM, dm-crypt, which generally need
68       to be configured by userland
69     </li>
70     <li>
71       Kernel needs a way to load modules and run scripts but
72       it can't read them from the root filesystem
73     </li>
74     <li>
75       Solution: boot loader provides a bundle of files
76       (initramfs image) to the kernel
77     </li>
78   </ul>
79 </div>
80
81 <div class="slide">
82   <img src="yo-dawg.jpeg" width="90%" />
83 </div>
84
85 <div class="slide">
86   <h1>How the kernel uses an initramfs</h1>
87   <ul class="incremental">
88     <li>
89       Kernel <em>always</em> mounts an initial root filesystem using
90       either ramfs or tmpfs
91     </li>
92     <li>
93       If the boot loader provides an initramfs image, kernel
94       unpacks it into this filesystem, then runs <tt>/init</tt>
95     </li>
96     <li>
97       The initramfs init system is then responsible for mounting
98       the real root filesystem and running the real <tt>init</tt>
99       <ul class="incremental">
100         <li>
101           Although it is not <em>required</em> to hand over at all
102           - e.g. debian-installer
103         </li>
104       </ul>
105     </li>
106   </ul>
107 </div>
108
109 <div class="slide">
110   <h1>Overview</h1>
111   <ul class="incremental">
112     <li>
113       Started in Ubuntu in 2005 and adopted in Debian later that year
114     </li>
115     <li>
116       <tt>mkinitramfs</tt> builds an initramfs image using the
117       included scripts, necessary kernel modules, udev, and utilities
118       from klibc-utils or busybox
119     </li>
120     <li>
121       Uses build-time and boot-time hook scripts for
122       extensibility
123       <ul>
124         <li>Used by btrfs-tools, cryptsetup, lvm2, mdadm, etc.</li>
125       </ul>
126     </li>
127     <li>
128       Supports dependencies within each set of scripts
129     </li>
130   </ul>
131 </div>
132
133 <div class="slide">
134   <h1>The init system</h1>
135   <ul class="incremental">
136     <li>
137       Mount <tt>devtmpfs</tt>, <tt>devpts</tt>, <tt>procfs</tt>,
138       <tt>sysfs</tt>, <tt>tmpfs</tt> at <tt>/run</tt>
139     </li>
140     <li>
141       Run <tt>init-top</tt> scripts - includes starting udev
142     </li>
143     <li>
144       Load explicitly configured modules
145     </li>
146     <li>
147       Run <tt>init-premount</tt> scripts
148     </li>
149     <li>
150       Run <tt>local-top</tt> or <tt>nfs-top</tt> scripts
151       - e.g. mdadm setup
152     </li>
153     <li>
154       Run <tt>local-premount</tt> or <tt>nfs-premount</tt> scripts
155       - e.g. btrfs scan, resume from disk
156     </li>
157     <li>
158       Mount root filesystem
159     </li>
160   </ul>
161 </div>
162
163 <div class="slide">
164   <h1>Problems (1)</h1>
165   <p>
166     Root filesystem is not enough.  Depenency-based boot means
167     there's no clean split between root and <tt>/usr</tt>.  So
168     initramfs should mount it (implemented in 0.117).  However:
169   </p>
170   <ul class="incremental">
171     <li>
172       initscripts and mountall won't remount it read-write if it's
173       already mounted read-only
174       <ul class="incremental">
175         <li>
176           Current workaround: only do this for systemd
177         </li>
178       </ul>
179     </li>
180     <li>
181       fsck will refuse to operate on <tt>/usr</tt> if already
182       mounted
183       <ul class="incremental">
184         <li>
185           So we need to fsck it from the initramfs
186           <ul class="incremental">
187             <li>
188               But <tt>e2fsck</tt> complains if the superblock
189               time is newer than system time, and system time
190               may not be correct yet
191               <ul class="incremental">
192                 <li>
193                   So we need to fix the system time in the
194                   initramfs
195                 </li>
196               </ul>
197             </li>
198           </ul>
199         </li>
200       </ul>
201     </li>
202     <li>
203       Selecting the right fsck to install is harder than
204       it seemed
205     </li>
206   </ul>
207 </div>
208
209 <div class="slide">
210   <h1>Problems (2)</h1>
211   <p class="incremental">
212     Device discovery by kernel is asynchronous.  But that's
213     why we have udev, right?
214   </p>
215   <p class="incremental">
216     Unfortunately not everything needed for device setup is
217     or can be in udev hooks (e.g. cryptsetup requires interaction)
218   </p>
219   <p class="incremental">
220     Lots of hacks used (<tt>while ... do sleep... done</tt>,
221     <tt>udevadm settle</tt> in too many places), and they still
222     sometimes fail
223     (<a href="https://bugs.debian.org/616689">#616689</a> and merged
224     bugs)
225   </p>
226   <p class="incremental">
227     Ubuntu has a somewhat better approach but we still haven't merged
228     it back...
229   </p>
230   <p class="incremental">
231     ...in fact, Debian and Ubuntu branches have been diverging for
232     about 5 years
233   </p>
234 </div>
235
236 <div class="slide">
237   <h1>Questions?</h1>
238 </div>
239
240 <div class="slide">
241   <h1>Credits</h1>
242   <ul>
243     <li>
244       Linux 'Tux' logo &copy; Larry Ewing, Simon Budig.
245       <!--
246 Redistribution is free but has to include this notice.
247       -->
248       <ul>
249         <li>Modified by Ben to add Debian open-ND logo</li>
250       </ul>
251     </li>
252     <li>
253       Debian open-ND logo &copy; Software in the Public Interest, Inc.
254       <!--
255 Permission is hereby granted, free of charge, to any person obtaining
256 a copy of this software and associated documentation files (the
257 "Software"), to deal in the Software without restriction, including
258 without limitation the rights to use, copy, modify, merge, publish,
259 distribute, sublicense, and/or sell copies of the Software, and to
260 permit persons to whom the Software is furnished to do so, subject to
261 the following conditions:
262
263 The above copyright notice and this permission notice shall be
264 included in all copies or substantial portions of the Software.
265
266 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
267 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
268 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
269 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
270 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
271 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
272 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
273       -->
274     </li>
275     <li>
276       Xzibit promotional photo &copy; Retna, used for purpose of parody
277     </li>
278   </ul>
279 </div>
280
281 </body>
282 </html>