]>
Commit | Line | Data |
---|---|---|
013d8a39 LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
4 | ||
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2012 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | --> | |
23 | ||
24 | <refentry id="bootup"> | |
25 | ||
26 | <refentryinfo> | |
27 | <title>bootup</title> | |
28 | <productname>systemd</productname> | |
29 | ||
30 | <authorgroup> | |
31 | <author> | |
32 | <contrib>Developer</contrib> | |
33 | <firstname>Lennart</firstname> | |
34 | <surname>Poettering</surname> | |
35 | <email>lennart@poettering.net</email> | |
36 | </author> | |
37 | </authorgroup> | |
38 | </refentryinfo> | |
39 | ||
40 | <refmeta> | |
41 | <refentrytitle>bootup</refentrytitle> | |
42 | <manvolnum>7</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>bootup</refname> | |
34511ca7 | 47 | <refpurpose>System bootup process</refpurpose> |
013d8a39 LP |
48 | </refnamediv> |
49 | ||
50 | <refsect1> | |
51 | <title>Description</title> | |
52 | ||
e3d84721 LP |
53 | <para>A number of different components are involved in |
54 | the system boot. Immediately after power-up, the | |
55 | system BIOS will do minimal hardware initialization, | |
56 | and hand control over to a boot loader stored on a | |
57 | persistent storage device. This boot loader will then | |
58 | invoke an OS kernel from disk (or the network). In the | |
59 | Linux case this kernel (optionally) extracts and | |
013d8a39 LP |
60 | executes an initial RAM disk image (initrd) such as |
61 | <citerefentry><refentrytitle>dracut</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
e3d84721 LP |
62 | which looks for the root file system (possibly using |
63 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
64 | for this). After the root file system is found and | |
65 | mounted the initrd hands over control to the host's | |
66 | system manager (such as | |
013d8a39 LP |
67 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>) |
68 | stored on the OS image which is then responsible for | |
69 | probing all remaining hardware, mounting all necessary | |
70 | file systems and spawning all configured | |
71 | services.</para> | |
72 | ||
73 | <para>On shutdown the system manager stops all | |
74 | services, unmounts all file systems (detaching the | |
75 | storage technologies backing them), and then | |
76 | (optionally) jumps back into the initrd code which | |
77 | unmounts/detaches the root file system and the storage | |
82846081 | 78 | it resides on. As last step the system is powered down.</para> |
013d8a39 LP |
79 | |
80 | <para>Additional information about the system boot | |
81 | process may be found in | |
82 | <citerefentry><refentrytitle>boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> | |
83 | </refsect1> | |
84 | ||
85 | <refsect1> | |
86 | <title>System Manager Bootup</title> | |
87 | ||
88 | <para>At boot, the system manager on the OS image is | |
89 | responsible for initializing the required file | |
90 | systems, services and drivers that are necessary for | |
91 | operation of the system. On | |
92 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
93 | systems this process is split up in various discrete | |
94 | steps which are exposed as target units. (See | |
95 | <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
96 | for detailed information about target units.) The | |
97 | boot-up process is highly parallelized so that the | |
98 | order in which specific target units are reached is not | |
99 | deterministic, but still adheres to a limited amount | |
100 | of ordering structure.</para> | |
101 | ||
102 | <para>When systemd starts up the system it will | |
103 | activate all units that are dependencies of | |
104 | <filename>default.target</filename> (as well as | |
105 | recursively all dependencies of these | |
106 | dependencies). Usually | |
107 | <filename>default.target</filename> is simply an alias | |
108 | of <filename>graphical.target</filename> or | |
109 | <filename>multi-user.target</filename> depending on | |
110 | whether the system is configured for a graphical UI or | |
111 | only for a text console. To enforce minimal ordering | |
112 | between the units pulled in a number of well-known | |
113 | target units are available, as listed on | |
114 | <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> | |
115 | ||
c5315881 | 116 | <para>The following chart is a structural overview of |
013d8a39 LP |
117 | these well-known units and their position in the |
118 | boot-up logic. The arrows describe which units are | |
119 | pulled in and ordered before which other units. Units | |
120 | near the top are started before units nearer to the | |
121 | bottom of the chart.</para> | |
122 | ||
123 | <programlisting>local-fs-pre.target | |
124 | | | |
125 | v | |
126 | (various mounts and (various swap (various cryptsetup | |
127 | fsck services...) devices...) devices...) (various low-level (various low-level | |
128 | | | | services: udevd, API VFS mounts: | |
129 | v v v tmpfiles, random mqueue, configfs, | |
130 | local-fs.target swap.target cryptsetup.target seed, sysctl, ...) debugfs, ...) | |
131 | | | | | | | |
132 | \__________________|_________________ | ___________________|____________________/ | |
133 | \|/ | |
134 | v | |
135 | sysinit.target | |
136 | | | |
e3d84721 LP |
137 | ____________________________________/|\________________________________________ |
138 | / | | | \ | |
139 | | | | | | | |
140 | v v | v v | |
141 | (various (various | (various rescue.service | |
142 | timers...) paths...) | sockets...) | | |
143 | | | | | v | |
144 | v v | v <emphasis>rescue.target</emphasis> | |
145 | timers.target paths.target | sockets.target | |
146 | | | | | | |
147 | \__________________|_________________ | ___________________/ | |
148 | \|/ | |
013d8a39 LP |
149 | v |
150 | basic.target | |
151 | | | |
e3d84721 LP |
152 | ____________________________________/| emergency.service |
153 | / | | | | |
154 | | | | v | |
155 | v v v <emphasis>emergency.target</emphasis> | |
156 | display- (various system (various system | |
157 | manager.service services services) | |
158 | | required for | | |
159 | | graphical UIs) v | |
160 | | | <emphasis>multi-user.target</emphasis> | |
161 | | | | | |
162 | \_________________ | _________________/ | |
5231084b | 163 | \|/ |
013d8a39 | 164 | v |
e3d84721 | 165 | <emphasis>graphical.target</emphasis></programlisting> |
013d8a39 LP |
166 | |
167 | <para>Target units that are commonly used as boot | |
168 | targets are <emphasis>emphasized</emphasis>. These | |
169 | units are good choices as goal targets, for | |
170 | example by passing them to the | |
171 | <varname>systemd.unit=</varname> kernel command line | |
172 | option (see | |
173 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>) | |
174 | or by symlinking <filename>default.target</filename> | |
175 | to them.</para> | |
176 | </refsect1> | |
177 | ||
9e5f0f92 | 178 | <refsect1> |
e3d84721 LP |
179 | <title>Bootup in the Initial RAM Disk (initrd)</title> |
180 | <para>The initial RAM disk implementation (initrd) can | |
181 | be set up using systemd as well. In this case boot up | |
182 | inside the initrd follows the following | |
183 | structure.</para> | |
184 | ||
185 | <para>The default target in the initrd is | |
186 | <filename>initrd.target</filename>. The bootup process | |
187 | begins identical to the system manager bootup (see | |
188 | above) until it reaches | |
189 | <filename>basic.target</filename>. From there, systemd | |
190 | approaches the special target | |
191 | <filename>initrd.target</filename>. If the root device | |
192 | can be mounted at <filename>/sysroot</filename>, the | |
193 | <filename>sysroot.mount</filename> unit becomes active | |
194 | and <filename>initrd-root-fs.target</filename> is | |
195 | reached. The service | |
196 | <filename>initrd-parse-etc.service</filename> scans | |
197 | <filename>/sysroot/etc/fstab</filename> for a possible | |
198 | <filename>/usr</filename> mount point and additional | |
199 | entries marked with the | |
200 | <emphasis>x-initrd.mount</emphasis> option. All | |
201 | entries found are mounted below | |
202 | <filename>/sysroot</filename>, and | |
203 | <filename>initrd-fs.target</filename> is reached. The | |
204 | service <filename>initrd-cleanup.service</filename> | |
205 | isolates to the | |
206 | <filename>initrd-switch-root.target</filename>, where | |
207 | cleanup services can run. As the very last step, the | |
208 | <filename>initrd-switch-root.service</filename> is | |
209 | activated, which will cause the system to switch its | |
210 | root to <filename>/sysroot</filename>. | |
9e5f0f92 HH |
211 | </para> |
212 | ||
e3d84721 | 213 | <programlisting> : (beginning identical to above) |
9e5f0f92 HH |
214 | : |
215 | v | |
216 | basic.target | |
217 | | emergency.service | |
218 | ______________________/| | | |
219 | / | v | |
220 | | sysroot.mount <emphasis>emergency.target</emphasis> | |
221 | | | | |
222 | | v | |
223 | | initrd-root-fs.target | |
224 | | | | |
225 | | v | |
e3d84721 LP |
226 | v initrd-parse-etc.service |
227 | (custom initrd | | |
228 | services...) v | |
9e5f0f92 HH |
229 | | (sysroot-usr.mount and |
230 | | various mounts marked | |
231 | | with fstab option | |
e3d84721 | 232 | | x-initrd.mount...) |
9e5f0f92 HH |
233 | | | |
234 | | v | |
235 | | initrd-fs.target | |
9e5f0f92 HH |
236 | \______________________ | |
237 | \| | |
238 | v | |
239 | initrd.target | |
240 | | | |
241 | v | |
242 | initrd-cleanup.service | |
243 | isolates to | |
244 | initrd-switch-root.target | |
245 | | | |
246 | v | |
247 | ______________________/| | |
e3d84721 | 248 | / v |
9e5f0f92 | 249 | | initrd-udevadm-cleanup-db.service |
e3d84721 LP |
250 | v | |
251 | (custom initrd | | |
252 | services...) | | |
9e5f0f92 HH |
253 | \______________________ | |
254 | \| | |
255 | v | |
256 | initrd-switch-root.target | |
257 | | | |
258 | v | |
259 | initrd-switch-root.service | |
260 | | | |
261 | v | |
e3d84721 | 262 | Transition to Host OS</programlisting> |
9e5f0f92 HH |
263 | </refsect1> |
264 | ||
265 | ||
013d8a39 LP |
266 | <refsect1> |
267 | <title>System Manager Shutdown</title> | |
268 | ||
e3d84721 LP |
269 | <para>System shutdown with systemd also consists of |
270 | various target units with some minimal ordering | |
271 | structure applied:</para> | |
013d8a39 LP |
272 | |
273 | ||
274 | ||
275 | ||
0e0320e0 LP |
276 | <programlisting> (conflicts with (conflicts with |
277 | all system all file system | |
278 | services) mounts, swaps, | |
279 | | cryptsetup | |
280 | | devices, ...) | |
281 | | | | |
282 | v v | |
283 | shutdown.target umount.target | |
284 | | | | |
285 | \_______ ______/ | |
286 | \ / | |
287 | v | |
288 | (various low-level | |
289 | services) | |
290 | | | |
291 | v | |
292 | final.target | |
293 | | | |
294 | _____________________________________/ \_________________________________ | |
295 | / | | \ | |
296 | | | | | | |
297 | v v v v | |
298 | systemd-reboot.service systemd-poweroff.service systemd-halt.service systemd-kexec.service | |
299 | | | | | | |
300 | v v v v | |
301 | <emphasis>reboot.target</emphasis> <emphasis>poweroff.target</emphasis> <emphasis>halt.target</emphasis> <emphasis>kexec.target</emphasis></programlisting> | |
013d8a39 LP |
302 | |
303 | <para>Commonly used system shutdown targets are <emphasis>emphasized</emphasis>.</para> | |
304 | </refsect1> | |
305 | ||
306 | <refsect1> | |
307 | <title>See Also</title> | |
308 | <para> | |
309 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
310 | <citerefentry><refentrytitle>boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
311 | <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
0a4c519b ZJS |
312 | <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
313 | <citerefentry><refentrytitle>dracut</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
013d8a39 LP |
314 | </para> |
315 | </refsect1> | |
316 | ||
317 | </refentry> |