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