Debian Codegraph @

man/systemd-boot.xml

raw
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.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd-boot" conditional='ENABLE_BOOTLOADER'
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 textual 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><command>systemd-boot</command> loads boot entry information from the EFI system partition (ESP),
32 usually mounted at <filename>/efi/</filename>, <filename>/boot/</filename>, or
33 <filename>/boot/efi/</filename> during OS runtime, as well as from the Extended Boot Loader partition
34 (XBOOTLDR) if it exists (usually mounted to <filename>/boot/</filename>). Configuration file fragments,
35 kernels, initrds and other EFI images to boot generally need to reside on the ESP or the Extended Boot
36 Loader partition. Linux kernels must be built with <option>CONFIG_EFI_STUB</option> to be able to be
37 directly executed as an EFI image. During boot <command>systemd-boot</command> automatically assembles a
38 list of boot entries from the following sources:</para>
39
40 <itemizedlist>
41 <listitem><para>Boot entries defined with <ulink
42 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink> Type #1
43 description files located in <filename>/loader/entries/</filename> on the ESP and the Extended Boot
44 Loader Partition. These usually describe Linux kernel images with associated initrd images, but
45 alternatively may also describe other arbitrary EFI executables.</para></listitem>
46
47 <listitem><para>Unified kernel images, <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot
48 Loader Specification</ulink> Type #2, which are executable EFI binaries in
49 <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader Partition.</para></listitem>
50
51 <listitem><para>The Microsoft Windows EFI boot manager, if installed.</para></listitem>
52
53 <listitem><para>The Apple macOS boot manager, if installed.</para></listitem>
54
55 <listitem><para>The EFI Shell binary, if installed.</para></listitem>
56
57 <listitem><para>A <literal>Reboot Into Firmware Interface</literal> option, if supported by the UEFI
58 firmware.</para></listitem>
59
60 <listitem><para>Secure Boot variable enrollment if the UEFI firmware is in setup mode and files are provided
61 on the ESP.</para></listitem>
62 </itemizedlist>
63
64 <para><command>systemd-boot</command> supports the following features:</para>
65
66 <itemizedlist>
67 <listitem><para>Basic boot manager configuration changes (such as timeout
68 configuration, default boot entry selection, …) may be made directly from the boot loader UI at
69 boot-time, as well as during system runtime with EFI variables.</para></listitem>
70
71 <listitem><para>The boot manager integrates with the <command>systemctl</command> command to implement
72 features such as <command>systemctl reboot --boot-loader-entry=…</command> (for rebooting into a
73 specific boot menu entry, i.e. "reboot into Windows") and <command>systemctl reboot
74 --boot-loader-menu=…</command> (for rebooting into the boot loader menu), by implementing the <ulink
75 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. See
76 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
77 details.</para></listitem>
78
79 <listitem><para>An EFI variable set by the boot loader informs the OS about the EFI System Partition used
80 during boot. This is then used to automatically mount the correct EFI System Partition to
81 <filename>/efi/</filename> or <filename>/boot/</filename> during OS runtime. See
82 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
83 for details.</para></listitem>
84
85 <listitem><para>The boot manager provides information about the boot time spent in UEFI firmware using
86 the <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. This
87 information can be displayed using
88 <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
89 </para></listitem>
90
91 <listitem><para>The boot manager implements boot counting and automatic fallback to older, working boot
92 entries on failure. See <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot
93 Assessment</ulink>.</para></listitem>
94
95 <listitem><para>The boot manager optionally reads a random seed from the ESP partition, combines it
96 with a 'system token' stored in a persistent EFI variable and derives a random seed to use by the OS as
97 entropy pool initialization, providing a full entropy pool during early boot.</para></listitem>
98
99 <listitem><para>The boot manager allows for Secure Boot variables to be enrolled if the UEFI firmware is
100 in setup mode. Additionally, variables can be automatically enrolled if configured.</para></listitem>
101 </itemizedlist>
102
103 <para><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
104 may be used from a running system to locate the ESP and the Extended Boot Loader Partition, list
105 available entries, and install <command>systemd-boot</command> itself.</para>
106
107 <para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>
108 may be used to copy kernel images onto the ESP or the Extended Boot Loader Partition and to generate
109 description files compliant with the Boot Loader
110 Specification.</para>
111
112 <para><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry>
113 may be used as UEFI boot stub for executed kernels, which is useful to show graphical boot splashes
114 before transitioning into the Linux world. It is also capable of automatically picking up auxiliary
115 credential files (for boot parameterization) and system extension images, as companion files to the
116 booted kernel images.</para>
117 </refsect1>
118
119 <refsect1>
120 <title>Key bindings</title>
121 <para>The following keys may be used in the boot menu:</para>
122
123 <!-- Developer commands Q/v/Ctrl+l deliberately not advertised. -->
124
125 <variablelist>
126 <varlistentry>
127 <term><keycap>↑</keycap> (Up)</term>
128 <term><keycap>↓</keycap> (Down)</term>
129 <term><keycap>j</keycap></term>
130 <term><keycap>k</keycap></term>
131 <term><keycap>PageUp</keycap></term>
132 <term><keycap>PageDown</keycap></term>
133 <term><keycap>Home</keycap></term>
134 <term><keycap>End</keycap></term>
135 <listitem><para>Navigate up/down in the entry list</para>
136
137 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
138 </varlistentry>
139
140 <varlistentry>
141 <term><keycap>↵</keycap> (Enter)</term>
142 <term><keycap>→</keycap> (Right)</term>
143 <listitem><para>Boot selected entry</para>
144
145 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
146 </varlistentry>
147
148 <varlistentry>
149 <term><keycap>d</keycap></term>
150 <listitem><para>Make selected entry the preferred boot entry</para>
151
152 <para>An EFI variable is set to allow this setting to persist.</para>
153
154 <xi:include href="version-info.xml" xpointer="v260"/></listitem>
155 </varlistentry>
156
157 <varlistentry>
158 <term><keycap>D</keycap></term>
159 <listitem><para>Make selected entry the default boot entry</para>
160
161 <para>An EFI variable is set to allow this setting to persist.</para>
162
163 <xi:include href="version-info.xml" xpointer="v260"/></listitem>
164 </varlistentry>
165
166 <varlistentry>
167 <term><keycap>e</keycap></term>
168 <listitem><para>Edit the kernel command line for selected entry</para>
169
170 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
171 </varlistentry>
172
173 <varlistentry>
174 <term><keycap>+</keycap></term>
175 <term><keycap>t</keycap></term>
176 <listitem><para>Increase the timeout before default entry is booted</para>
177
178 <para>An EFI variable is set to allow this setting to persist.</para>
179
180 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
181 </varlistentry>
182
183 <varlistentry>
184 <term><keycap>-</keycap></term>
185 <term><keycap>T</keycap></term>
186 <listitem><para>Decrease the timeout</para>
187
188 <para>An EFI variable is set to allow this setting to persist.</para>
189
190 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
191 </varlistentry>
192
193 <varlistentry>
194 <term><keycap>r</keycap></term>
195 <listitem><para>Change screen resolution, skipping any unsupported modes.</para>
196
197 <para>An EFI variable is set to allow this setting to persist.</para>
198
199 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term><keycap>R</keycap></term>
204 <listitem><para>Reset screen resolution to firmware or configuration file default.</para>
205
206 <para>An EFI variable is set to allow this setting to persist.</para>
207
208 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
209 </varlistentry>
210
211 <varlistentry>
212 <term><keycap>p</keycap></term>
213 <listitem><para>Print status</para>
214
215 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
216 </varlistentry>
217
218 <varlistentry>
219 <term><keycap>h</keycap></term>
220 <term><keycap>?</keycap></term>
221 <term><keycap>F1</keycap></term>
222 <listitem><para>Show a help screen</para>
223
224 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
225 </varlistentry>
226
227 <varlistentry>
228 <term><keycap>f</keycap></term>
229 <listitem><para>Reboot into firmware interface.</para>
230
231 <para>For compatibility with the keybindings of several firmware implementations this operation
232 may also be reached with <keycap>F2</keycap>, <keycap>F10</keycap>, <keycap>Del</keycap> and
233 <keycap>Esc</keycap>.</para>
234
235 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
236 </varlistentry>
237
238 <varlistentry>
239 <term><keycombo><keycap>Shift</keycap><keycap>o</keycap></keycombo></term>
240 <listitem><para>Power off the system.</para>
241
242 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><keycombo><keycap>Shift</keycap><keycap>b</keycap></keycombo></term>
247 <listitem><para>Reboot the system.</para>
248
249 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
250 </varlistentry>
251 </variablelist>
252
253 <para>The following keys may be pressed during bootup or in the boot menu to directly boot a specific
254 entry:</para>
255
256 <variablelist>
257 <varlistentry>
258 <term><keycap>l</keycap></term>
259 <listitem><para>Linux</para>
260
261 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
262 </varlistentry>
263
264 <varlistentry>
265 <term><keycap>w</keycap></term>
266 <listitem><para>Windows</para>
267
268 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
269 </varlistentry>
270
271 <varlistentry>
272 <term><keycap>a</keycap></term>
273 <listitem><para>macOS</para>
274
275 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
276 </varlistentry>
277
278 <varlistentry>
279 <term><keycap>s</keycap></term>
280 <listitem><para>EFI shell</para>
281
282 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
283 </varlistentry>
284
285 <varlistentry>
286 <term><keycap>1</keycap></term>
287 <term><keycap>2</keycap></term>
288 <term><keycap>3</keycap></term>
289 <term><keycap>4</keycap></term>
290 <term><keycap>5</keycap></term>
291 <term><keycap>6</keycap></term>
292 <term><keycap>7</keycap></term>
293 <term><keycap>8</keycap></term>
294 <term><keycap>9</keycap></term>
295 <listitem><para>Boot entry number 1 … 9</para>
296
297 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
298 </varlistentry>
299 </variablelist>
300
301 <para>The boot menu is shown when a non-zero menu timeout has been configured. If the menu timeout has
302 been set to zero, hold down a key (<keycap>space</keycap> is recommended) before the boot loader
303 initializes to bring up the boot menu. Note that depending on the firmware implementation the time window
304 where key presses are accepted before the boot loader initializes might be short. If the window is
305 missed, reboot and try again, possibly repeatedly pressing a suitable key; on most systems it should be
306 possible to hit the time window after a few attempts. Keys other than the space bar may be used, except
307 for the keys listed above. If showing the menu on demand doesn't work well, consider setting a non-zero
308 timeout to show the boot menu unconditionally. Some desktop environments might offer an option to boot
309 directly into the boot menu, which also avoids the problem altogether. Alternatively, use the command
310 line <command>systemctl reboot --boot-loader-menu=</command> with a non-zero value from the shell.</para>
311
312 <para>In the editor, most keys simply insert themselves, but the following keys
313 may be used to perform additional actions:</para>
314
315 <variablelist>
316 <varlistentry>
317 <term><keycap>←</keycap> (Left)</term>
318 <term><keycap>→</keycap> (Right)</term>
319 <term><keycap>Home</keycap></term>
320 <term><keycap>End</keycap></term>
321 <listitem><para>Navigate left/right</para>
322
323 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
324 </varlistentry>
325
326 <varlistentry>
327 <term><keycap>Esc</keycap></term>
328 <term><keycombo><keycap>Ctrl</keycap><keycap>c</keycap></keycombo></term>
329 <listitem><para>Abort the edit and quit the editor</para>
330
331 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
332 </varlistentry>
333
334 <varlistentry>
335 <term><keycombo><keycap>Ctrl</keycap><keycap>k</keycap></keycombo></term>
336 <listitem><para>Clear the command line forwards</para>
337
338 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
339 </varlistentry>
340
341 <varlistentry>
342 <term><keycombo><keycap>Ctrl</keycap><keycap>w</keycap></keycombo></term>
343 <term><keycombo><keycap>Alt</keycap><keycap>Backspace</keycap></keycombo></term>
344 <listitem><para>Delete word backwards</para>
345
346 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
347 </varlistentry>
348
349 <varlistentry>
350 <term><keycombo><keycap>Ctrl</keycap><keycap>Del</keycap></keycombo></term>
351 <term><keycombo><keycap>Alt</keycap><keycap>d</keycap></keycombo></term>
352 <listitem><para>Delete word forwards</para>
353
354 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
355 </varlistentry>
356
357 <varlistentry>
358 <term><keycap>↵</keycap> (Enter)</term>
359 <listitem><para>Boot entry with the edited command line</para>
360
361 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
362 </varlistentry>
363 </variablelist>
364
365 <para>Note that unless configured otherwise in the UEFI firmware, systemd-boot will
366 use the US keyboard layout, so key labels might not match for keys like +/-.
367 </para>
368 </refsect1>
369
370 <refsect1>
371 <title>Files</title>
372
373 <para>The files <command>systemd-boot</command> processes generally reside on the UEFI ESP which is
374 usually mounted to <filename>/efi/</filename>, <filename>/boot/</filename> or
375 <filename>/boot/efi/</filename> during OS runtime. It also processes files on the Extended Boot Loader
376 partition which is typically mounted to <filename>/boot/</filename>, if it
377 exists.</para>
378
379 <para><command>systemd-boot</command> reads runtime configuration such as the boot timeout and default
380 entry from <filename>/loader/loader.conf</filename> on the ESP (in combination with data read from EFI
381 variables). See
382 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
383
384 <para>Boot entry description files following the <ulink
385 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink> are read from
386 <filename>/loader/entries/</filename> on the ESP and the Extended Boot Loader partition.</para>
387
388 <para>Unified kernel boot entries following the <ulink
389 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink> are read from
390 <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader partition.</para>
391
392 <para>Optionally, a random seed for early boot entropy pool provisioning is stored in
393 <filename>/loader/random-seed</filename> in the ESP.</para>
394
395 <para>During initialization, <command>systemd-boot</command> automatically loads all driver files placed
396 in the <filename>/EFI/systemd/drivers/</filename> directory of the ESP. The files placed there must have
397 an extension of the EFI architecture ID followed by <filename>.efi</filename> (e.g. for x86-64 this means
398 a suffix of <filename>x64.efi</filename>). This may be used e.g. to add support for hardware not
399 supported natively by the firmware.</para>
400
401 <para>Enrollment of Secure Boot variables can be performed manually or automatically if files are available
402 under <filename>/loader/keys/<replaceable>NAME</replaceable>/{db,dbx,KEK,PK}.auth</filename>, <replaceable>NAME</replaceable>
403 being the display name for the set of variables in the menu. If one of the sets is named <filename>auto</filename>
404 then it might be enrolled automatically depending on the execution environment and the value of the <literal>secure-boot-enroll</literal> option.
405 See
406 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
407 </refsect1>
408
409 <refsect1>
410 <title>Companion Files</title>
411
412 <para>For Type #1 boot loader entries (as defined in the <ulink
413 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader
414 Specification</ulink>) <command>systemd-boot</command> will collect additional companion resources
415 declared via the <literal>extra</literal> key in the entry, dynamically generate
416 <command>cpio</command> initrd archives from them, and register those archives via the Linux initrd EFI
417 protocol so that they are passed to the kernel together with the entry's own initrd. This is supported
418 for entries referencing a Unified Kernel Image (UKI) via the <literal>uki</literal> or
419 <literal>uki-url</literal> keys. Each <literal>extra</literal> key references a single regular file
420 (relative to the root of the file system containing the entry snippet) and the key may be specified
421 multiple times. Companion resources are recognized by file name suffix:</para>
422
423 <itemizedlist>
424 <listitem><para>Files with the <filename>.cred</filename> suffix are packed into a
425 <command>cpio</command> archive placed in the <filename>/.extra/credentials/</filename> directory of
426 the initrd file hierarchy. This is intended to convey auxiliary, encrypted, authenticated credentials
427 for use with <varname>LoadCredentialEncrypted=</varname>. See
428 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> and
429 <citerefentry><refentrytitle>systemd-creds</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
430 details on encrypted credentials. The generated <command>cpio</command> archive is measured into TPM
431 PCR 12 (if a TPM is present).</para></listitem>
432
433 <listitem><para>Files with the <filename>.sysext.raw</filename> suffix are packed into a
434 <command>cpio</command> archive placed in the <filename>/.extra/sysext/</filename> directory of the
435 initrd file hierarchy. This is intended to pass additional entry-specific system extension images to
436 the initrd. See
437 <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry> for
438 details on system extension images. The generated <command>cpio</command> archive is measured into TPM
439 PCR 13 (if a TPM is present).</para></listitem>
440
441 <listitem><para>Files with the <filename>.confext.raw</filename> suffix are packed into a
442 <command>cpio</command> archive placed in the <filename>/.extra/confext/</filename> directory of the
443 initrd file hierarchy. This is intended to pass additional entry-specific configuration extension
444 images to the initrd. See
445 <citerefentry><refentrytitle>systemd-confext</refentrytitle><manvolnum>8</manvolnum></citerefentry>
446 for details on configuration extension images. The generated <command>cpio</command> archive is
447 measured into TPM PCR 12 (if a TPM is present).</para></listitem>
448 </itemizedlist>
449
450 <para>When the booted kernel is a UKI, the <command>systemd-stub</command> UEFI stub embedded in it will
451 combine the companion resources injected here with any companion files it itself collects from the UKI's
452 <filename>.extra.d/</filename> drop-in directory and from <filename>/loader/credentials/</filename> and
453 <filename>/loader/extensions/</filename>, so that all sources are merged uniformly into
454 <filename>/.extra/</filename> in the initrd. See
455 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
456 details.</para>
457
458 <para>Example Type #1 entry making use of the <literal>extra</literal> key:</para>
459
460 <programlisting>title My OS
461 version 1.2.3
462 machine-id 6a9857a393724b7a981ebb5b8495b9ea
463 uki /6a9857a393724b7a981ebb5b8495b9ea/1.2.3/img.efi
464 extra /6a9857a393724b7a981ebb5b8495b9ea/1.2.3/foo.cred
465 extra /6a9857a393724b7a981ebb5b8495b9ea/1.2.3/bar.sysext.raw
466 extra /6a9857a393724b7a981ebb5b8495b9ea/1.2.3/baz.confext.raw</programlisting>
467 </refsect1>
468
469 <refsect1>
470 <title>EFI Variables</title>
471
472 <para>The following EFI variables are defined, and may be set or read by <command>systemd-boot</command>
473 for communication between the boot loader and the OS. The vendor UUID
474 <literal>4a67b082-0a4c-41cf-b6c7-440b29bb8c4f</literal> is used in all cases.</para>
475
476 <variablelist class='efi-variables'>
477 <varlistentry>
478 <term><varname>LoaderBootCountPath</varname></term>
479 <listitem><para>If boot counting is enabled, contains the path to the file in whose name the boot
480 counters are encoded. Set by the boot loader.
481 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
482 uses this information to mark a boot as successful as determined by the successful activation of the
483 <filename>boot-complete.target</filename> target unit.</para>
484
485 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
486 </varlistentry>
487
488 <varlistentry>
489 <term><varname>LoaderConfigTimeout</varname></term>
490 <term><varname>LoaderConfigTimeoutOneShot</varname></term>
491 <listitem><para>The menu timeout in seconds. Read by the boot loader. <varname>LoaderConfigTimeout</varname>
492 is maintained persistently, while <varname>LoaderConfigTimeoutOneShot</varname> is a one-time override which is
493 read once (in which case it takes precedence over <varname>LoaderConfigTimeout</varname>) and then
494 removed. <varname>LoaderConfigTimeout</varname> may be manipulated with the
495 <keycap>t</keycap>/<keycap>T</keycap> keys, see above.</para>
496
497 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
498 </varlistentry>
499
500 <varlistentry>
501 <term><varname>LoaderConfigConsoleMode</varname></term>
502 <listitem><para>The numerical menu console mode. Read by the boot loader. <varname>LoaderConfigConsoleMode</varname>
503 is maintained persistently. <varname>LoaderConfigConsoleMode</varname> may be manipulated with the
504 <keycap>r</keycap>/<keycap>R</keycap> keys, see above.</para>
505
506 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
507 </varlistentry>
508
509 <varlistentry>
510 <term><varname>LoaderDevicePartUUID</varname></term>
511
512 <listitem><para>Contains the partition UUID of the partition the boot loader has been started from on
513 the current boot (usually an EFI System Partition). Set by the boot loader. (Note that
514 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> will
515 set this too, if not set yet, to support systems that boot directly into a unified kernel image,
516 bypassing any boot loader.)
517 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
518 uses this information to automatically find the disk booted from, in order to discover various other
519 partitions on the same disk automatically.</para>
520
521 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
522 </varlistentry>
523
524 <varlistentry>
525 <term><varname>LoaderDeviceURL</varname></term>
526
527 <listitem><para>If the boot loader has been invoked via network booting this variable contains the
528 originating URL. This may be used to automatically acquire additional resources from the same
529 source.</para>
530
531 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
532 </varlistentry>
533
534 <varlistentry>
535 <term><varname>LoaderEntries</varname></term>
536
537 <listitem><para>A list of the identifiers of all discovered boot loader entries. Set by the boot
538 loader.</para>
539
540 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
541 </varlistentry>
542
543 <varlistentry>
544 <term><varname>LoaderEntryPreferred</varname></term>
545 <term><varname>LoaderEntryDefault</varname></term>
546 <term><varname>LoaderEntrySysFail</varname></term>
547 <term><varname>LoaderEntryOneShot</varname></term>
548
549 <listitem><para>The identifier of the default boot loader entry. Can be set in the OS and the boot
550 loader. <varname>LoaderEntryOneShot</varname> sets the default entry for the next boot only, while
551 <varname>LoaderEntryDefault</varname> sets it persistently for all future boots.
552 <varname>LoaderEntryPreferred</varname> is like <varname>LoaderEntryDefault</varname> but additionally
553 takes into account boot assessment and skips boot entries with a tries-left counter equal to zero.
554 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
555 <option>set-default</option> and <option>set-oneshot</option> commands make use of these variables.
556 The boot loader modifies <varname>LoaderEntryDefault</varname> on request, when the
557 <keycap>d</keycap> key is used, see above.</para>
558
559 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
560 </varlistentry>
561
562 <varlistentry>
563 <term><varname>LoaderEntryLastBooted</varname></term>
564
565 <listitem><para>The identifier of the boot loader entry last attempted. Set and read by the boot loader,
566 only when <filename>/loader/loader.conf</filename> has default set to <literal>@saved</literal>. See
567 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
568
569 <para> The boot loader will ensure <varname>LoaderEntryLastBooted</varname> is up-to date for every boot,
570 updating it as needed and will omit changing it all together when <varname>LoaderEntryOneShot</varname>
571 is set.</para>
572
573 <para>The boot loader reads the variable, which takes higher priority than
574 <varname>LoaderEntryDefault</varname>. The variable is ignored when <varname>LoaderEntryOneShot</varname>
575 is set.</para>
576
577 <para><varname>LoaderEntryLastBooted</varname> cannot be used as indication that the last boot was
578 successful or not.</para>
579
580 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
581 </varlistentry>
582
583 <varlistentry>
584 <term><varname>LoaderEntrySelected</varname></term>
585
586 <listitem><para>The identifier of the boot loader entry currently being booted. Set by the boot
587 loader.</para>
588
589 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
590 </varlistentry>
591
592 <varlistentry>
593 <term><varname>LoaderFeatures</varname></term>
594
595 <listitem><para>A set of flags indicating the features the boot loader supports. Set by the boot loader. Use
596 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
597 data.</para>
598
599 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
600 </varlistentry>
601
602 <varlistentry>
603 <term><varname>LoaderFirmwareInfo</varname></term>
604 <term><varname>LoaderFirmwareType</varname></term>
605
606 <listitem><para>Brief firmware information. Set by the boot loader. Use
607 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
608 data.</para>
609
610 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
611 </varlistentry>
612
613 <varlistentry>
614 <term><varname>LoaderTpm2ActivePcrBanks</varname></term>
615
616 <listitem><para>Hexadecimal string representation of a bitmask with values defined by the TCG EFI
617 Protocol Specification for TPM 2.0 as EFI_TCG2_BOOT_HASH_ALG_*. If no TPM2 support or no active
618 banks were detected, will be set to <constant>0</constant>. Set by the boot loader. Use
619 <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>
620 to view this data.</para>
621
622 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
623 </varlistentry>
624
625 <varlistentry>
626 <term><varname>LoaderPcrSMBIOS</varname></term>
627
628 <listitem><para>The PCR register index select SMBIOS structures are measured into — type 1
629 (system information, with the volatile "Wake-up Type" field zeroed out), type 2 (baseboard
630 information) and type 11 (OEM strings). Formatted as decimal ASCII string (e.g.
631 <literal>1</literal>). Set by the boot loader if a measurement was successfully completed, and remains
632 unset otherwise. (Note that <command>systemd-stub</command> performs the same measurement when booted
633 directly, bypassing the boot loader.)</para>
634
635 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
636 </varlistentry>
637
638 <varlistentry>
639 <term><varname>LoaderImageIdentifier</varname></term>
640
641 <listitem><para>The file system path to the EFI executable of the boot loader for the current boot,
642 relative to the partition's root directory (i.e. relative to the partition indicated by
643 <varname>LoaderDevicePartUUID</varname>, see above). Set by the boot loader. (Note that
644 <command>systemd-stub</command> will set this too, if not set yet, to support systems that directly
645 boot into a unified kernel image, bypassing any boot loader.) Use
646 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view
647 this data.</para>
648
649 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
650 </varlistentry>
651
652 <varlistentry>
653 <term><varname>LoaderInfo</varname></term>
654
655 <listitem><para>Brief information about the boot loader. Set by the boot loader. Use
656 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
657 data.</para>
658
659 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
660 </varlistentry>
661
662 <varlistentry>
663 <term><varname>LoaderTimeExecUSec</varname></term>
664 <term><varname>LoaderTimeInitUSec</varname></term>
665 <term><varname>LoaderTimeMenuUsec</varname></term>
666
667 <listitem><para>Information about the time spent in various parts of the boot loader. Set by the boot
668 loader. Use <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>
669 to view this data. </para>
670
671 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
672 </varlistentry>
673
674 <varlistentry>
675 <term><varname>LoaderSystemToken</varname></term>
676
677 <listitem><para>A binary random data field, that is used for generating the random seed to pass to
678 the OS (see above). Note that this random data is generally only generated once, during OS
679 installation, and is then never updated again.</para>
680
681 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
682 </varlistentry>
683 </variablelist>
684
685 <para>Many of these variables are defined by the <ulink
686 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>.</para>
687 </refsect1>
688
689 <refsect1>
690 <title>SMBIOS Type 11 Strings</title>
691
692 <para><command>systemd-boot</command> can be configured using SMBIOS Type 11 strings. Applicable strings
693 consist of a name, followed by <literal>=</literal>, followed by the value. Unless
694 <command>systemd-boot</command> detects it is running inside a confidential computing environment,
695 <command>systemd-boot</command> will search the table for a string with a specific name, and if found,
696 use its value. The following strings are read:</para>
697
698 <variablelist>
699 <varlistentry>
700 <term><varname>io.systemd.boot.kernel-cmdline-extra</varname></term>
701 <listitem><para>If set, the value of this string is added to the list of kernel command line
702 arguments for Boot Loader Specification Type 1 entries that are measured in PCR12 and passed to the
703 kernel.</para>
704
705 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
706 </varlistentry>
707
708 <varlistentry>
709 <term><varname>io.systemd.boot-entries.extra:</varname><replaceable>ID=DEFINITION</replaceable></term>
710
711 <listitem><para>This allows inserting additional entries into the <command>systemd-boot</command>
712 menu. Take a pair of menu entry identifier and menu entry definition string. The former should be
713 suitable for use as a filename of a Boot Loader Specification Type #1 entry filename (note that it is
714 used for identification purposes only, no file of this name is actually accessed), the latter shall
715 follow the syntax of the contents of a Type #1 entry. Any menu entry defined this way is processed
716 and shown in pretty much the same way as a Type #1 entry read from the ESP or XBOOTLDR
717 partition. Example:</para>
718
719 <programlisting>io.systemd.boot-entries.extra:fooos-current.conf=title FooOS (Current)
720 uki-url http://example.com/somedir/fooos.efi</programlisting>
721
722 <para>Note that this example contains a newline character. When generating this string from a shell
723 care must be taken to encode it correctly.</para>
724
725 <para>Pass multiple strings formatted this way to generate multiple menu entries.</para>
726
727 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
728 </varlistentry>
729
730 <varlistentry>
731 <term><varname>io.systemd.boot.loglevel</varname></term>
732 <listitem><para>If set, the value of this string is used as log level. Valid values (from most to
733 least critical) are <literal>emerg</literal>, <literal>alert</literal>, <literal>crit</literal>,
734 <literal>err</literal>, <literal>warning</literal>, <literal>notice</literal>, <literal>info</literal>,
735 and <literal>debug</literal>.</para>
736
737 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
738 </varlistentry>
739 </variablelist>
740 </refsect1>
741
742 <refsect1>
743 <title>Boot Counting</title>
744
745 <para><command>systemd-boot</command> implements a simple boot counting mechanism on top of the <ulink
746 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink>, for automatic and unattended
747 fallback to older kernel versions/boot loader entries when a specific entry continuously fails. Any boot loader
748 entry file and unified kernel image file that contains a <literal>+</literal> followed by one or two numbers (if
749 two they need to be separated by a <literal>-</literal>), before the <filename>.conf</filename> or
750 <filename>.efi</filename> suffix is subject to boot counting: the first of the two numbers ('tries left') is
751 decreased by one on every boot attempt, the second of the two numbers ('tries done') is increased by one (if 'tries
752 done' is absent it is considered equivalent to 0). Depending on the current value of these two counters the boot
753 entry is considered to be in one of three states:</para>
754
755 <orderedlist>
756 <listitem><para>If the 'tries left' counter of an entry is greater than zero the entry is considered to be in
757 'indeterminate' state. This means the entry has not completed booting successfully yet, but also has not been
758 determined not to work.</para></listitem>
759
760 <listitem><para>If the 'tries left' counter of an entry is zero it is considered to be in 'bad' state. This means
761 no further attempts to boot this item will be made (that is, unless all other boot entries are also in 'bad'
762 state), as all attempts to boot this entry have not completed successfully.</para></listitem>
763
764 <listitem><para>If the 'tries left' and 'tries done' counters of an entry are absent it is considered to be in
765 'good' state. This means further boot counting for the entry is turned off, as it successfully booted at least
766 once. The
767 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
768 service moves the currently booted entry from 'indeterminate' into 'good' state when a boot attempt completed
769 successfully.</para></listitem>
770 </orderedlist>
771
772 <para>Generally, when new entries are added to the boot loader, they first start out in 'indeterminate' state,
773 i.e. with a 'tries left' counter greater than zero. The boot entry remains in this state until either it managed to
774 complete a full boot successfully at least once (in which case it will be in 'good' state) — or the 'tries left'
775 counter reaches zero (in which case it will be in 'bad' state).</para>
776
777 <para>Example: let's say a boot loader entry file <filename>foo.conf</filename> is set up for 3 boot tries. The
778 installer will hence create it under the name <filename>foo+3.conf</filename>. On first boot, the boot loader will
779 rename it to <filename>foo+2-1.conf</filename>. If that boot does not complete successfully, the boot loader will
780 rename it to <filename>foo+1-2.conf</filename> on the following boot. If that fails too, it will finally be renamed
781 <filename>foo+0-3.conf</filename> by the boot loader on next boot, after which it will be considered 'bad'. If the
782 boot succeeds however the entry file will be renamed to <filename>foo.conf</filename> by the OS, so that it is
783 considered 'good' from then on.</para>
784
785 <para>The boot menu takes the 'tries left' counter into account when sorting the menu entries: entries in 'bad'
786 state are ordered at the beginning of the list, and entries in 'good' or 'indeterminate' at the end. The user can
787 freely choose to boot any entry of the menu, including those already marked 'bad'. If the menu entry to boot is
788 automatically determined, this means that 'good' or 'indeterminate' entries are generally preferred (as the bottom
789 item of the menu is the one booted by default), and 'bad' entries will only be considered if there are no 'good' or
790 'indeterminate' entries left.</para>
791
792 <para>The <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry> kernel
793 install framework optionally sets the initial 'tries left' counter to the value specified in
794 <filename>/etc/kernel/tries</filename> when a boot loader entry is first created.</para>
795 </refsect1>
796
797 <refsect1>
798 <title>Using <command>systemd-boot</command> in virtual machines</title>
799
800 <para>When using <ulink url="https://www.qemu.org/docs/master/">qemu</ulink> with
801 <ulink url="https://www.linux-kvm.org/downloads/lersek/ovmf-whitepaper-c770f8c.txt">OVMF</ulink>
802 (UEFI Firmware for virtual machines) the <option>-kernel</option> switch works not only for linux
803 kernels, but for any EFI binary, including <filename>systemd-boot</filename> and unified linux kernels
804 (UKIs). Example command line for loading <command>systemd-boot</command> on x64:</para>
805
806 <para>
807 <command>qemu-system-x86_64
808 -drive if=pflash,format=qcow2,readonly=on,file=/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2
809 -kernel /usr/lib/systemd/boot/efi/systemd-bootx64.efi
810 -drive file=<replaceable>...</replaceable>
811 <replaceable>[ ... ]</replaceable>
812 </command>
813 </para>
814
815 <para>(The path to the firmware file might need to be adjusted depending on the distribution.)
816 <filename>systemd-boot</filename> will detect that it was started directly instead of being loaded from
817 ESP and will search for the ESP in that case, taking into account boot order information from the
818 hypervisor (if available). Note that for this to yield a useful result, another <option>-drive</option>
819 argument needs to be used to attach an actual disk image with an ESP.</para>
820 </refsect1>
821
822 <refsect1>
823 <title>See Also</title>
824 <para><simplelist type="inline">
825 <member><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
826 <member><citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
827 <member><citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
828 <member><citerefentry><refentrytitle>systemd-boot-random-seed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
829 <member><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
830 <member><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
831 <member><ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink></member>
832 <member><ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink></member>
833 <member><ulink url="https://systemd.io/TPM2_PCR_MEASUREMENTS">TPM2 PCR Measurements Made by systemd</ulink></member>
834 </simplelist></para>
835 </refsect1>
836 </refentry>