]>
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 | ||
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 | |
49f43d5f | 56 | control over to a boot loader stored on a persistent |
013d8a39 LP |
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 | |
82846081 | 76 | it resides on. As last step the system is powered down.</para> |
013d8a39 LP |
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 | ||
c5315881 | 114 | <para>The following chart is a structural overview of |
013d8a39 LP |
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 | | | |
5231084b LP |
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 | \|/ | |
013d8a39 LP |
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>System Manager Shutdown</title> | |
178 | ||
179 | <para>System shutdown also consists of various target | |
180 | units with some minimal ordering structure | |
181 | applied:</para> | |
182 | ||
183 | ||
184 | ||
185 | ||
0e0320e0 LP |
186 | <programlisting> (conflicts with (conflicts with |
187 | all system all file system | |
188 | services) mounts, swaps, | |
189 | | cryptsetup | |
190 | | devices, ...) | |
191 | | | | |
192 | v v | |
193 | shutdown.target umount.target | |
194 | | | | |
195 | \_______ ______/ | |
196 | \ / | |
197 | v | |
198 | (various low-level | |
199 | services) | |
200 | | | |
201 | v | |
202 | final.target | |
203 | | | |
204 | _____________________________________/ \_________________________________ | |
205 | / | | \ | |
206 | | | | | | |
207 | v v v v | |
208 | systemd-reboot.service systemd-poweroff.service systemd-halt.service systemd-kexec.service | |
209 | | | | | | |
210 | v v v v | |
211 | <emphasis>reboot.target</emphasis> <emphasis>poweroff.target</emphasis> <emphasis>halt.target</emphasis> <emphasis>kexec.target</emphasis></programlisting> | |
013d8a39 LP |
212 | |
213 | <para>Commonly used system shutdown targets are <emphasis>emphasized</emphasis>.</para> | |
214 | </refsect1> | |
215 | ||
216 | <refsect1> | |
217 | <title>See Also</title> | |
218 | <para> | |
219 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
220 | <citerefentry><refentrytitle>boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
221 | <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
222 | <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
223 | </para> | |
224 | </refsect1> | |
225 | ||
226 | </refentry> |