1 <html><head><meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8"><title>bootup
</title><meta name=
"generator" content=
"DocBook XSL Stylesheets V1.78.1"></head><body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF"><style>
11 background-color: #c60f0f;
15 h1:hover
> a.headerlink, h2:hover
> a.headerlink, h3:hover
> a.headerlink, dt:hover
> a.headerlink {
18 </style><a href=
"index.html">Index
</a>·
19 <a href=
"systemd.directives.html">Directives
</a>·
20 <a href=
"../python-systemd/index.html">Python
</a>·
21 <a href=
"../libudev/index.html">libudev
</a>·
22 <a href=
"../libudev/index.html">gudev
</a><span style=
"float:right">systemd
217</span><hr><div class=
"refentry"><a name=
"bootup"></a><div class=
"titlepage"></div><div class=
"refnamediv"><h2>Name
</h2><p>bootup — System bootup process
</p></div><div class=
"refsect1"><a name=
"idm214198228736"></a><h2 id=
"Description">Description
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#Description">¶
</a></h2><p>A number of different components are involved in
23 the system boot. Immediately after power-up, the
24 system BIOS will do minimal hardware initialization,
25 and hand control over to a boot loader stored on a
26 persistent storage device. This boot loader will then
27 invoke an OS kernel from disk (or the network). In the
28 Linux case, this kernel (optionally) extracts and
29 executes an initial RAM disk image (initrd), such as
31 <a href=
"http://linux.die.net/man/8/dracut"><span class=
"citerefentry"><span class=
"refentrytitle">dracut
</span>(
8)
</span></a>,
32 which looks for the root file system (possibly using
33 <a href=
"systemd.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd
</span>(
1)
</span></a>
34 for this). After the root file system is found and
35 mounted, the initrd hands over control to the host's
36 system manager (such as
37 <a href=
"systemd.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd
</span>(
1)
</span></a>)
38 stored on the OS image, which is then responsible for
39 probing all remaining hardware, mounting all necessary
40 file systems and spawning all configured
41 services.
</p><p>On shutdown, the system manager stops all
42 services, unmounts all file systems (detaching the
43 storage technologies backing them), and then
44 (optionally) jumps back into the initrd code which
45 unmounts/detaches the root file system and the storage
46 it resides on. As a last step, the system is powered down.
</p><p>Additional information about the system boot
47 process may be found in
48 <a href=
"http://man7.org/linux/man-pages/man7/boot.7.html"><span class=
"citerefentry"><span class=
"refentrytitle">boot
</span>(
7)
</span></a>.
</p></div><div class=
"refsect1"><a name=
"idm214194438320"></a><h2 id=
"System Manager Bootup">System Manager Bootup
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#System%20Manager%20Bootup">¶
</a></h2><p>At boot, the system manager on the OS image is
49 responsible for initializing the required file
50 systems, services and drivers that are necessary for
51 operation of the system. On
52 <a href=
"systemd.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd
</span>(
1)
</span></a>
53 systems, this process is split up in various discrete
54 steps which are exposed as target units. (See
55 <a href=
"systemd.target.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd.target
</span>(
5)
</span></a>
56 for detailed information about target units.) The
57 boot-up process is highly parallelized so that the
58 order in which specific target units are reached is not
59 deterministic, but still adheres to a limited amount
60 of ordering structure.
</p><p>When systemd starts up the system, it will
61 activate all units that are dependencies of
62 <code class=
"filename">default.target
</code> (as well as
63 recursively all dependencies of these
64 dependencies). Usually,
65 <code class=
"filename">default.target
</code> is simply an alias
66 of
<code class=
"filename">graphical.target
</code> or
67 <code class=
"filename">multi-user.target
</code>, depending on
68 whether the system is configured for a graphical UI or
69 only for a text console. To enforce minimal ordering
70 between the units pulled in, a number of well-known
71 target units are available, as listed on
72 <a href=
"systemd.special.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd.special
</span>(
7)
</span></a>.
</p><p>The following chart is a structural overview of
73 these well-known units and their position in the
74 boot-up logic. The arrows describe which units are
75 pulled in and ordered before which other units. Units
76 near the top are started before units nearer to the
77 bottom of the chart.
</p><pre class=
"programlisting">local-fs-pre.target
80 (various mounts and (various swap (various cryptsetup
81 fsck services...) devices...) devices...) (various low-level (various low-level
82 | | | services: udevd, API VFS mounts:
83 v v v tmpfiles, random mqueue, configfs,
84 local-fs.target swap.target cryptsetup.target seed, sysctl, ...) debugfs, ...)
86 \__________________|_________________ | ___________________|____________________/
91 ____________________________________/|\________________________________________
95 (various (various | (various rescue.service
96 timers...) paths...) | sockets...) |
98 v v | v
<span class=
"emphasis"><em>rescue.target
</em></span>
99 timers.target paths.target | sockets.target
101 \__________________|_________________ | ___________________/
106 ____________________________________/| emergency.service
109 v v v
<span class=
"emphasis"><em>emergency.target
</em></span>
110 display- (various system (various system
111 manager.service services services)
114 | |
<span class=
"emphasis"><em>multi-user.target
</em></span>
116 \_________________ | _________________/
119 <span class=
"emphasis"><em>graphical.target
</em></span></pre><p>Target units that are commonly used as boot
120 targets are
<span class=
"emphasis"><em>emphasized
</em></span>. These
121 units are good choices as goal targets, for
122 example by passing them to the
123 <code class=
"varname">systemd.unit=
</code> kernel command line
125 <a href=
"systemd.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd
</span>(
1)
</span></a>)
126 or by symlinking
<code class=
"filename">default.target
</code>
127 to them.
</p></div><div class=
"refsect1"><a name=
"idm214198321168"></a><h2 id=
"Bootup in the Initial RAM Disk (initrd)">Bootup in the Initial RAM Disk (initrd)
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#Bootup%20in%20the%20Initial%20RAM%20Disk%20(initrd)">¶
</a></h2><p>The initial RAM disk implementation (initrd) can
128 be set up using systemd as well. In this case, boot up
129 inside the initrd follows the following
130 structure.
</p><p>The default target in the initrd is
131 <code class=
"filename">initrd.target
</code>. The bootup process
132 begins identical to the system manager bootup (see
133 above) until it reaches
134 <code class=
"filename">basic.target
</code>. From there, systemd
135 approaches the special target
136 <code class=
"filename">initrd.target
</code>. If the root device
137 can be mounted at
<code class=
"filename">/sysroot
</code>, the
138 <code class=
"filename">sysroot.mount
</code> unit becomes active
139 and
<code class=
"filename">initrd-root-fs.target
</code> is
141 <code class=
"filename">initrd-parse-etc.service
</code> scans
142 <code class=
"filename">/sysroot/etc/fstab
</code> for a possible
143 <code class=
"filename">/usr
</code> mount point and additional
144 entries marked with the
145 <span class=
"emphasis"><em>x-initrd.mount
</em></span> option. All
146 entries found are mounted below
147 <code class=
"filename">/sysroot
</code>, and
148 <code class=
"filename">initrd-fs.target
</code> is reached. The
149 service
<code class=
"filename">initrd-cleanup.service
</code>
151 <code class=
"filename">initrd-switch-root.target
</code>, where
152 cleanup services can run. As the very last step, the
153 <code class=
"filename">initrd-switch-root.service
</code> is
154 activated, which will cause the system to switch its
155 root to
<code class=
"filename">/sysroot
</code>.
156 </p><pre class=
"programlisting"> : (beginning identical to above)
161 ______________________/| |
163 | sysroot.mount
<span class=
"emphasis"><em>emergency.target
</em></span>
166 | initrd-root-fs.target
169 v initrd-parse-etc.service
172 | (sysroot-usr.mount and
173 | various mounts marked
179 \______________________ |
185 initrd-cleanup.service
187 initrd-switch-root.target
190 ______________________/|
192 | initrd-udevadm-cleanup-db.service
196 \______________________ |
199 initrd-switch-root.target
202 initrd-switch-root.service
205 Transition to Host OS
</pre></div><div class=
"refsect1"><a name=
"idm214198296176"></a><h2 id=
"System Manager Shutdown">System Manager Shutdown
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#System%20Manager%20Shutdown">¶
</a></h2><p>System shutdown with systemd also consists of
206 various target units with some minimal ordering
207 structure applied:
</p><pre class=
"programlisting"> (conflicts with (conflicts with
208 all system all file system
209 services) mounts, swaps,
214 shutdown.target umount.target
225 _____________________________________/ \_________________________________
229 systemd-reboot.service systemd-poweroff.service systemd-halt.service systemd-kexec.service
232 <span class=
"emphasis"><em>reboot.target
</em></span> <span class=
"emphasis"><em>poweroff.target
</em></span> <span class=
"emphasis"><em>halt.target
</em></span> <span class=
"emphasis"><em>kexec.target
</em></span></pre><p>Commonly used system shutdown targets are
<span class=
"emphasis"><em>emphasized
</em></span>.
</p></div><div class=
"refsect1"><a name=
"idm214198288240"></a><h2 id=
"See Also">See Also
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#See%20Also">¶
</a></h2><p>
233 <a href=
"systemd.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd
</span>(
1)
</span></a>,
234 <a href=
"http://man7.org/linux/man-pages/man7/boot.7.html"><span class=
"citerefentry"><span class=
"refentrytitle">boot
</span>(
7)
</span></a>,
235 <a href=
"systemd.special.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd.special
</span>(
7)
</span></a>,
236 <a href=
"systemd.target.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd.target
</span>(
5)
</span></a>,
237 <a href=
"http://linux.die.net/man/8/dracut"><span class=
"citerefentry"><span class=
"refentrytitle">dracut
</span>(
8)
</span></a>
238 </p></div></div></body></html>