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