]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-boot.xml
Merge pull request #11893 from yuwata/wait-online-take-operstate
[thirdparty/systemd.git] / man / systemd-boot.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 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
6
7 <refentry id="systemd-boot" conditional='ENABLE_EFI'
8 xmlns:xi="http://www.w3.org/2001/XInclude">
9 <refentryinfo>
10 <title>systemd-boot</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-boot</refentrytitle>
16 <manvolnum>7</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-boot</refname>
21 <refname>sd-boot</refname>
22 <refpurpose>A simple UEFI boot manager</refpurpose>
23 </refnamediv>
24
25 <refsect1>
26 <title>Description</title>
27
28 <para><command>systemd-boot</command> (short: <command>sd-boot</command>) is a simple UEFI boot
29 manager. It provides a graphical menu to select the entry to boot and an editor for the kernel command
30 line. <command>systemd-boot</command> supports systems with UEFI firmware only.</para>
31
32 <para>systemd-boot loads boot entry information from the EFI system partition (ESP), usually mounted at
33 <filename>/efi/</filename>, <filename>/boot/</filename>, or <filename>/boot/efi/</filename> during OS
34 runtime, as well as from the Extended Boot Loader partition if it exists (usually mounted to
35 <filename>/boot/</filename>). Configuration file fragments, kernels, initrds and other EFI images to boot
36 generally need to reside on the ESP or the Extended Boot Loader partition. Linux kernels must be built
37 with <option>CONFIG_EFI_STUB</option> to be able to be directly executed as an EFI image. During boot
38 systemd-boot automatically assembles a list of boot entries from the following sources:</para>
39
40 <itemizedlist>
41 <listitem><para>Boot entries defined with <ulink
42 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink> description files
43 located in <filename>/loader/entries/</filename> on the ESP and the Extended Boot Loader
44 Partition. These usually describe Linux kernel images with associated initrd images, but alternatively
45 may also describe arbitrary other EFI executables.</para></listitem>
46
47 <listitem><para>Unified kernel images following the <ulink
48 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>, as executable EFI
49 binaries in <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader Partition.
50 </para></listitem>
51
52 <listitem><para>The Microsoft Windows EFI boot manager, if installed</para></listitem>
53
54 <listitem><para>The Apple MacOS X boot manager, if installed</para></listitem>
55
56 <listitem><para>The EFI Shell binary, if installed</para></listitem>
57
58 <listitem><para>A reboot into the UEFI firmware setup option, if supported by the firmware</para></listitem>
59 </itemizedlist>
60
61 <para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>
62 may be used to copy kernel images onto the ESP or the Extended Boot Loader Partition and to generate
63 description files compliant with the Boot Loader
64 Specification. <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
65 may be used from a running system to locate the ESP and the Extended Boot Loader Partition, list
66 available entries, and install <command>systemd-boot</command> itself.</para>
67
68 <para>systemd-boot will provide information about the time spent in UEFI firmware using the <ulink
69 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. This information can be displayed
70 using <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
71 </para>
72 </refsect1>
73
74 <refsect1>
75 <title>Key bindings</title>
76 <para>The following keys may be used in the boot menu:</para>
77
78 <variablelist>
79 <varlistentry>
80 <term><keycap></keycap> (Up)</term>
81 <term><keycap></keycap> (Down)</term>
82 <term><keycap>j</keycap></term>
83 <term><keycap>k</keycap></term>
84 <term><keycap>PageUp</keycap></term>
85 <term><keycap>PageDown</keycap></term>
86 <term><keycap>Home</keycap></term>
87 <term><keycap>End</keycap></term>
88 <listitem><para>Navigate up/down in the entry list</para></listitem>
89 </varlistentry>
90
91 <varlistentry>
92 <term><keycap></keycap> (Enter)</term>
93 <listitem><para>Boot selected entry</para></listitem>
94 </varlistentry>
95
96 <varlistentry>
97 <term><keycap>d</keycap></term>
98 <listitem><para>Make selected entry the default</para></listitem>
99 </varlistentry>
100
101 <varlistentry>
102 <term><keycap>e</keycap></term>
103 <listitem><para>Edit the kernel command line for selected entry</para></listitem>
104 </varlistentry>
105
106 <varlistentry>
107 <term><keycap>+</keycap></term>
108 <term><keycap>t</keycap></term>
109 <listitem><para>Increase the timeout before default entry is booted</para></listitem>
110 </varlistentry>
111
112 <varlistentry>
113 <term><keycap>-</keycap></term>
114 <term><keycap>T</keycap></term>
115 <listitem><para>Decrease the timeout</para></listitem>
116 </varlistentry>
117
118 <varlistentry>
119 <term><keycap>v</keycap></term>
120 <listitem><para>Show systemd-boot, UEFI, and firmware versions</para></listitem>
121 </varlistentry>
122
123 <varlistentry>
124 <term><keycap>P</keycap></term>
125 <listitem><para>Print status</para></listitem>
126 </varlistentry>
127
128 <varlistentry>
129 <term><keycap>Q</keycap></term>
130 <listitem><para>Quit</para></listitem>
131 </varlistentry>
132
133 <varlistentry>
134 <term><keycap>h</keycap></term>
135 <term><keycap>?</keycap></term>
136 <listitem><para>Show a help screen</para></listitem>
137 </varlistentry>
138
139 <varlistentry>
140 <term><keycombo><keycap>Ctrl</keycap><keycap>l</keycap></keycombo></term>
141 <listitem><para>Reprint the screen</para></listitem>
142 </varlistentry>
143 </variablelist>
144
145 <para>The following keys may be used during bootup or in the boot menu to
146 directly boot a specific entry:</para>
147
148 <variablelist>
149 <varlistentry>
150 <term><keycap>l</keycap></term>
151 <listitem><para>Linux</para></listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><keycap>w</keycap></term>
156 <listitem><para>Windows</para></listitem>
157 </varlistentry>
158
159 <varlistentry>
160 <term><keycap>a</keycap></term>
161 <listitem><para>OS X</para></listitem>
162 </varlistentry>
163
164 <varlistentry>
165 <term><keycap>s</keycap></term>
166 <listitem><para>EFI shell</para></listitem>
167 </varlistentry>
168
169 <varlistentry>
170 <term><keycap>1</keycap></term>
171 <term><keycap>2</keycap></term>
172 <term><keycap>3</keycap></term>
173 <term><keycap>4</keycap></term>
174 <term><keycap>5</keycap></term>
175 <term><keycap>6</keycap></term>
176 <term><keycap>7</keycap></term>
177 <term><keycap>8</keycap></term>
178 <term><keycap>9</keycap></term>
179 <listitem><para>Boot entry number 19</para></listitem>
180 </varlistentry>
181 </variablelist>
182
183 <para>In the editor, most keys simply insert themselves, but the following keys
184 may be used to perform additional actions:</para>
185
186 <variablelist>
187 <varlistentry>
188 <term><keycap></keycap> (Left)</term>
189 <term><keycap></keycap> (Right)</term>
190 <term><keycap>Home</keycap></term>
191 <term><keycap>End</keycap></term>
192 <listitem><para>Navigate left/right</para></listitem>
193 </varlistentry>
194
195 <varlistentry>
196 <term><keycap>Esc</keycap></term>
197 <listitem><para>Abort the edit and quit the editor</para></listitem>
198 </varlistentry>
199
200 <varlistentry>
201 <term><keycombo><keycap>Ctrl</keycap><keycap>k</keycap></keycombo></term>
202 <listitem><para>Clear the command line</para></listitem>
203 </varlistentry>
204
205 <varlistentry>
206 <term><keycombo><keycap>Ctrl</keycap><keycap>w</keycap></keycombo></term>
207 <term><keycombo><keycap>Alt</keycap><keycap>Backspace</keycap></keycombo></term>
208 <listitem><para>Delete word backwards</para></listitem>
209 </varlistentry>
210
211 <varlistentry>
212 <term><keycombo><keycap>Alt</keycap><keycap>d</keycap></keycombo></term>
213 <listitem><para>Delete word forwards</para></listitem>
214 </varlistentry>
215
216 <varlistentry>
217 <term><keycap></keycap> (Enter)</term>
218 <listitem><para>Boot entry with the edited command line</para></listitem>
219 </varlistentry>
220 </variablelist>
221
222 <para>Note that unless configured otherwise in the UEFI firmware, systemd-boot will
223 use the US keyboard layout, so key labels might not match for keys like +/-.
224 </para>
225 </refsect1>
226
227 <refsect1>
228 <title>Files</title>
229
230 <para>The files <command>systemd-boot</command> processes generally reside on the UEFI ESP which is
231 usually mounted to <filename>/efi/</filename>, <filename>/boot/</filename> or
232 <filename>/boot/efi/</filename> during OS runtime. It also processes files on the Extended Boot Loader
233 partition which is typically mounted to <filename>/boot/</filename>, if it
234 exists. <command>systemd-boot</command> reads runtime configuration such as the boot timeout and default
235 entry from <filename>/loader/loader.conf</filename> on the ESP (in combination with data read from EFI
236 variables). See
237 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Boot
238 entry description files following the <ulink url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot
239 Loader Specification</ulink> are read from <filename>/loader/entries/</filename> on the ESP and the
240 Extended Boot Loader partition. Unified kernel boot entries following the <ulink
241 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink> are read from
242 <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader partition.</para>
243 </refsect1>
244
245 <refsect1>
246 <title>EFI Variables</title>
247
248 <para>The following EFI variables are defined, set and read by <command>systemd-boot</command>, under the vendor
249 UUID <literal>4a67b082-0a4c-41cf-b6c7-440b29bb8c4</literal>, for communication between the OS and the boot
250 loader:</para>
251
252 <variablelist class='efi-variables'>
253 <varlistentry>
254 <term><varname>LoaderBootCountPath</varname></term>
255 <listitem><para>If boot counting is enabled, contains the path to the file in whose name the boot counters are
256 encoded. Set by the boot
257 loader. <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
258 uses this information to mark a boot as successful as determined by the successful activation of the
259 <filename>boot-complete.target</filename> target unit.</para></listitem>
260 </varlistentry>
261
262 <varlistentry>
263 <term><varname>LoaderConfigTimeout</varname></term>
264 <term><varname>LoaderConfigTimeoutOneShot</varname></term>
265 <listitem><para>The menu timeout in seconds. Read by the boot loader. <varname>LoaderConfigTimeout</varname>
266 is maintained persistently, while <varname>LoaderConfigTimeoutOneShot</varname> is a one-time override which is
267 read once (in which case it takes precedence over <varname>LoaderConfigTimeout</varname>) and then
268 removed. <varname>LoaderConfigTimeout</varname> may be manipulated with the
269 <keycap>t</keycap>/<keycap>T</keycap> keys, see above.)</para></listitem>
270 </varlistentry>
271
272 <varlistentry>
273 <term><varname>LoaderDevicePartUUID</varname></term>
274
275 <listitem><para>Contains the partition UUID of the EFI System Partition the boot loader was run from. Set by
276 the boot
277 loader. <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
278 uses this information to automatically find the disk booted from, in order to discover various other partitions
279 on the same disk automatically.</para></listitem>
280 </varlistentry>
281
282 <varlistentry>
283 <term><varname>LoaderEntries</varname></term>
284
285 <listitem><para>A list of the identifiers of all discovered boot loader entries. Set by the boot
286 loader.</para></listitem>
287 </varlistentry>
288
289 <varlistentry>
290 <term><varname>LoaderEntryDefault</varname></term>
291 <term><varname>LoaderEntryOneShot</varname></term>
292
293 <listitem><para>The identifier of the default boot loader entry. Set primarily by the OS and read by the boot
294 loader. <varname>LoaderEntryOneShot</varname> sets the default entry for the next boot only, while
295 <varname>LoaderEntryDefault</varname> sets it persistently for all future
296 boots. <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
297 <option>set-default</option> and <option>set-oneshot</option> commands make use of these variables. The boot
298 loader modifies <varname>LoaderEntryDefault</varname> on request, when the <keycap>d</keycap> key is used, see
299 above.)</para></listitem>
300 </varlistentry>
301
302 <varlistentry>
303 <term><varname>LoaderEntrySelected</varname></term>
304
305 <listitem><para>The identifier of the boot loader entry currently being booted. Set by the boot
306 loader.</para></listitem>
307 </varlistentry>
308
309 <varlistentry>
310 <term><varname>LoaderFeatures</varname></term>
311
312 <listitem><para>A set of flags indicating the features the boot loader supports. Set by the boot loader. Use
313 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
314 data.</para></listitem>
315 </varlistentry>
316
317 <varlistentry>
318 <term><varname>LoaderFirmwareInfo</varname></term>
319 <term><varname>LoaderFirmwareType</varname></term>
320
321 <listitem><para>Brief firmware information. Set by the boot loader. Use
322 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
323 data.</para></listitem>
324 </varlistentry>
325
326 <varlistentry>
327 <term><varname>LoaderImageIdentifier</varname></term>
328
329 <listitem><para>The path of executable of the boot loader used for the current boot, relative to the EFI System
330 Partition's root directory. Set by the boot loader. Use
331 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
332 data.</para></listitem>
333 </varlistentry>
334
335 <varlistentry>
336 <term><varname>LoaderInfo</varname></term>
337
338 <listitem><para>Brief information about the boot loader. Set by the boot loader. Use
339 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
340 data.</para></listitem>
341 </varlistentry>
342
343 <varlistentry>
344 <term><varname>LoaderTimeExecUSec</varname></term>
345 <term><varname>LoaderTimeInitUSec</varname></term>
346 <term><varname>LoaderTimeMenuUsec</varname></term>
347
348 <listitem><para>Information about the time spent in various parts of the boot loader. Set by the boot
349 loader. Use <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>
350 to view this data. These variables are defined by the <ulink
351 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>.</para></listitem>
352 </varlistentry>
353 </variablelist>
354 </refsect1>
355
356 <refsect1>
357 <title>Boot Counting</title>
358
359 <para><command>systemd-boot</command> implements a simple boot counting mechanism on top of the <ulink
360 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>, for automatic and unattended
361 fallback to older kernel versions/boot loader entries when a specific entry continously fails. Any boot loader
362 entry file and unified kernel image file that contains a <literal>+</literal> followed by one or two numbers (if
363 two they need to be separated by a <literal>-</literal>), before the <filename>.conf</filename> or
364 <filename>.efi</filename> suffix is subject to boot counting: the first of the two numbers ('tries left') is
365 decreased by one on every boot attempt, the second of the two numbers ('tries done') is increased by one (if 'tries
366 done' is absent it is considered equivalent to 0). Depending on the current value of these two counters the boot
367 entry is considered to be in one of three states:</para>
368
369 <orderedlist>
370 <listitem><para>If the 'tries left' counter of an entry is greater than zero the entry is considered to be in
371 'indeterminate' state. This means the entry has not completed booting successfully yet, but also hasn't been
372 determined not to work.</para></listitem>
373
374 <listitem><para>If the 'tries left' counter of an entry is zero it is considered to be in 'bad' state. This means
375 no further attempts to boot this item will be made (that is, unless all other boot entries are also in 'bad'
376 state), as all attempts to boot this entry have not completed successfully.</para></listitem>
377
378 <listitem><para>If the 'tries left' and 'tries done' counters of an entry are absent it is considered to be in
379 'good' state. This means further boot counting for the entry is turned off, as it successfully booted at least
380 once. The
381 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
382 service moves the currently booted entry from 'indeterminate' into 'good' state when a boot attempt completed
383 successfully.</para></listitem>
384 </orderedlist>
385
386 <para>Generally, when new entries are added to the boot loader, they first start out in 'indeterminate' state,
387 i.e. with a 'tries left' counter greater than zero. The boot entry remains in this state until either it managed to
388 complete a full boot successfully at least once (in which case it will be in 'good' state) — or the 'tries left'
389 counter reaches zero (in which case it will be in 'bad' state).</para>
390
391 <para>Example: let's say a boot loader entry file <filename>foo.conf</filename> is set up for 3 boot tries. The
392 installer will hence create it under the name <filename>foo+3.conf</filename>. On first boot, the boot loader will
393 rename it to <filename>foo+2-1.conf</filename>. If that boot does not complete successfully, the boot loader will
394 rename it to <filename>foo+1-2.conf</filename> on the following boot. If that fails too, it will finally be renamed
395 <filename>foo+0-3.conf</filename> by the boot loader on next boot, after which it will be considered 'bad'. If the
396 boot succeeds however the entry file will be renamed to <filename>foo.conf</filename> by the OS, so that it is
397 considered 'good' from then on.</para>
398
399 <para>The boot menu takes the 'tries left' counter into account when sorting the menu entries: entries in 'bad'
400 state are ordered at the end of the list, and entries in 'good' or 'indeterminate' at the beginning. The user can
401 freely choose to boot any entry of the menu, including those already marked 'bad'. If the menu entry to boot is
402 automatically determined, this means that 'good' or 'indeterminate' entries are generally preferred (as the top item of
403 the menu is the one booted by default), and 'bad' entries will only be considered if there are no 'good' or
404 'indeterminate' entries left.</para>
405
406 <para>The <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry> kernel
407 install framework optionally sets the initial 'tries left' counter to the value specified in
408 <filename>/etc/kernel/tries</filename> when a boot loader entry is first created.</para>
409 </refsect1>
410
411 <refsect1>
412 <title>See Also</title>
413 <para>
414 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
415 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
416 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
417 <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
418 <ulink url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>,
419 <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>
420 </para>
421 </refsect1>
422 </refentry>