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