]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-boot.xml
man: add version info
[thirdparty/systemd.git] / man / systemd-boot.xml
CommitLineData
f37d3835 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
f37d3835 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
f37d3835 5
dfca5587 6<refentry id="systemd-boot" conditional='ENABLE_BOOTLOADER'
f37d3835
ZJS
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8 <refentryinfo>
70c8db75 9 <title>systemd-boot</title>
f37d3835 10 <productname>systemd</productname>
f37d3835
ZJS
11 </refentryinfo>
12
13 <refmeta>
70c8db75 14 <refentrytitle>systemd-boot</refentrytitle>
f37d3835
ZJS
15 <manvolnum>7</manvolnum>
16 </refmeta>
17
18 <refnamediv>
70c8db75 19 <refname>systemd-boot</refname>
f37d3835
ZJS
20 <refname>sd-boot</refname>
21 <refpurpose>A simple UEFI boot manager</refpurpose>
22 </refnamediv>
23
24 <refsect1>
25 <title>Description</title>
26
c5fcaed8 27 <para><command>systemd-boot</command> (short: <command>sd-boot</command>) is a simple UEFI boot
b8cdb662 28 manager. It provides a textual menu to select the entry to boot and an editor for the kernel command
c5fcaed8 29 line. <command>systemd-boot</command> supports systems with UEFI firmware only.</para>
53ddb667 30
39867bb9
LP
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
cafa9d87
LP
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>
53ddb667
LP
39
40 <itemizedlist>
41 <listitem><para>Boot entries defined with <ulink
db811444 42 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink> Type #1
a0aa3838
ZJS
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>
53ddb667 46
db811444 47 <listitem><para>Unified kernel images, <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot
a0aa3838
ZJS
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>
53ddb667 50
a0aa3838 51 <listitem><para>The Microsoft Windows EFI boot manager, if installed.</para></listitem>
53ddb667 52
a0aa3838 53 <listitem><para>The Apple macOS boot manager, if installed.</para></listitem>
53ddb667 54
a0aa3838 55 <listitem><para>The EFI Shell binary, if installed.</para></listitem>
53ddb667 56
a0aa3838 57 <listitem><para>A reboot into the UEFI firmware setup option, if supported by the firmware.</para></listitem>
e6b0cfad 58
8b9f0921 59 <listitem><para>Secure Boot variables enrollment if the UEFI firmware is in setup-mode and files are provided
e6b0cfad 60 on the ESP.</para></listitem>
53ddb667
LP
61 </itemizedlist>
62
39867bb9
LP
63 <para><command>systemd-boot</command> supports the following features:</para>
64
65 <itemizedlist>
66 <listitem><para>Basic boot manager configuration changes (such as timeout
67 configuration, default boot entry selection, …) may be made directly from the boot loader UI at
68 boot-time, as well as during system runtime with EFI variables.</para></listitem>
69
70 <listitem><para>The boot manager integrates with the <command>systemctl</command> command to implement
71 features such as <command>systemctl reboot --boot-loader-entry=…</command> (for rebooting into a
72 specific boot menu entry, i.e. "reboot into Windows") and <command>systemctl reboot
73 --boot-loader-menu=…</command> (for rebooting into the boot loader menu), by implementing the <ulink
74 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. See
75 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
76 details.</para></listitem>
77
250db1bf 78 <listitem><para>An EFI variable set by the boot loader informs the OS about the EFI System Partition used
79 during boot. This is then used to automatically mount the correct EFI System Partition to
39867bb9
LP
80 <filename>/efi/</filename> or <filename>/boot/</filename> during OS runtime. See
81 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
82 for details.</para></listitem>
83
84 <listitem><para>The boot manager provides information about the boot time spent in UEFI firmware using
85 the <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. This
86 information can be displayed using
87 <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
88 </para></listitem>
89
90 <listitem><para>The boot manager implements boot counting and automatic fallback to older, working boot
91 entries on failure. See <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot
92 Assessment</ulink>.</para></listitem>
93
94 <listitem><para>The boot manager optionally reads a random seed from the ESP partition, combines it
11fcfc53 95 with a 'system token' stored in a persistent EFI variable and derives a random seed to use by the OS as
e9dd6984 96 entropy pool initialization, providing a full entropy pool during early boot.</para></listitem>
e6b0cfad 97
8b9f0921 98 <listitem><para>The boot manager allows for Secure Boot variables to be enrolled if the UEFI firmware is
e6b0cfad 99 in setup-mode. Additionally, variables can be automatically enrolled if configured.</para></listitem>
39867bb9
LP
100 </itemizedlist>
101
102 <para><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
c5fcaed8
LP
103 may be used from a running system to locate the ESP and the Extended Boot Loader Partition, list
104 available entries, and install <command>systemd-boot</command> itself.</para>
53ddb667 105
39867bb9
LP
106 <para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>
107 may be used to copy kernel images onto the ESP or the Extended Boot Loader Partition and to generate
108 description files compliant with the Boot Loader
109 Specification.</para>
3f9a615d
LP
110
111 <para><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry>
112 may be used as UEFI boot stub for executed kernels, which is useful to show graphical boot splashes
113 before transitioning into the Linux world. It is also capable of automatically picking up auxiliary
114 credential files (for boot parameterization) and system extension images, as companion files to the
115 booted kernel images.</para>
f37d3835
ZJS
116 </refsect1>
117
f37d3835
ZJS
118 <refsect1>
119 <title>Key bindings</title>
120 <para>The following keys may be used in the boot menu:</para>
121
8a8e5666
JJ
122 <!-- Developer commands Q/v/Ctrl+l deliberately not advertised. -->
123
f37d3835
ZJS
124 <variablelist>
125 <varlistentry>
8c073dde
LP
126 <term><keycap>↑</keycap> (Up)</term>
127 <term><keycap>↓</keycap> (Down)</term>
128 <term><keycap>j</keycap></term>
129 <term><keycap>k</keycap></term>
130 <term><keycap>PageUp</keycap></term>
131 <term><keycap>PageDown</keycap></term>
132 <term><keycap>Home</keycap></term>
133 <term><keycap>End</keycap></term>
ec07c3c8
AK
134 <listitem><para>Navigate up/down in the entry list</para>
135
136 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
137 </varlistentry>
138
139 <varlistentry>
8c073dde 140 <term><keycap>↵</keycap> (Enter)</term>
904ebcb2 141 <term><keycap>→</keycap> (Right)</term>
ec07c3c8
AK
142 <listitem><para>Boot selected entry</para>
143
144 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
f37d3835
ZJS
145 </varlistentry>
146
147 <varlistentry>
8c073dde 148 <term><keycap>d</keycap></term>
ec07c3c8
AK
149 <listitem><para>Make selected entry the default</para>
150
151 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
152 </varlistentry>
153
154 <varlistentry>
8c073dde 155 <term><keycap>e</keycap></term>
ec07c3c8
AK
156 <listitem><para>Edit the kernel command line for selected entry</para>
157
158 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
159 </varlistentry>
160
161 <varlistentry>
8c073dde
LP
162 <term><keycap>+</keycap></term>
163 <term><keycap>t</keycap></term>
ec07c3c8
AK
164 <listitem><para>Increase the timeout before default entry is booted</para>
165
166 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
167 </varlistentry>
168
169 <varlistentry>
8c073dde
LP
170 <term><keycap>-</keycap></term>
171 <term><keycap>T</keycap></term>
ec07c3c8
AK
172 <listitem><para>Decrease the timeout</para>
173
174 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
175 </varlistentry>
176
1b965abc
JJ
177 <varlistentry>
178 <term><keycap>r</keycap></term>
ec07c3c8
AK
179 <listitem><para>Change screen resolution, skipping any unsupported modes.</para>
180
181 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
1b965abc
JJ
182 </varlistentry>
183
184 <varlistentry>
185 <term><keycap>R</keycap></term>
ec07c3c8
AK
186 <listitem><para>Reset screen resolution to firmware or configuration file default.</para>
187
188 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
1b965abc
JJ
189 </varlistentry>
190
f37d3835 191 <varlistentry>
8a8e5666 192 <term><keycap>p</keycap></term>
ec07c3c8
AK
193 <listitem><para>Print status</para>
194
195 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
f37d3835
ZJS
196 </varlistentry>
197
f37d3835 198 <varlistentry>
8c073dde
LP
199 <term><keycap>h</keycap></term>
200 <term><keycap>?</keycap></term>
a318a565 201 <term><keycap>F1</keycap></term>
f37d3835
ZJS
202 <listitem><para>Show a help screen</para></listitem>
203 </varlistentry>
e6cab77e
JJ
204
205 <varlistentry>
206 <term><keycap>f</keycap></term>
207 <listitem><para>Reboot into firmware interface.</para>
208
209 <para>For compatibility with the keybindings of several firmware implementations this operation
210 may also be reached with <keycap>F2</keycap>, <keycap>F10</keycap>, <keycap>Del</keycap> and
ec07c3c8
AK
211 <keycap>Esc</keycap>.</para>
212
213 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
e6cab77e 214 </varlistentry>
f6531b11
LP
215
216 <varlistentry>
217 <term><keycombo><keycap>Shift</keycap><keycap>o</keycap></keycombo></term>
ec07c3c8
AK
218 <listitem><para>Power off the system.</para>
219
220 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
f6531b11
LP
221 </varlistentry>
222
223 <varlistentry>
224 <term><keycombo><keycap>Shift</keycap><keycap>b</keycap></keycombo></term>
ec07c3c8
AK
225 <listitem><para>Reboot the system.</para>
226
227 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
f6531b11 228 </varlistentry>
f37d3835
ZJS
229 </variablelist>
230
e14a0c21
LP
231 <para>The following keys may be pressed during bootup or in the boot menu to directly boot a specific
232 entry:</para>
f37d3835
ZJS
233
234 <variablelist>
235 <varlistentry>
8c073dde 236 <term><keycap>l</keycap></term>
ec07c3c8
AK
237 <listitem><para>Linux</para>
238
239 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
240 </varlistentry>
241
242 <varlistentry>
8c073dde 243 <term><keycap>w</keycap></term>
ec07c3c8
AK
244 <listitem><para>Windows</para>
245
246 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
247 </varlistentry>
248
249 <varlistentry>
8c073dde 250 <term><keycap>a</keycap></term>
ec07c3c8
AK
251 <listitem><para>macOS</para>
252
253 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
254 </varlistentry>
255
256 <varlistentry>
8c073dde 257 <term><keycap>s</keycap></term>
ec07c3c8
AK
258 <listitem><para>EFI shell</para>
259
260 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
261 </varlistentry>
262
263 <varlistentry>
8c073dde
LP
264 <term><keycap>1</keycap></term>
265 <term><keycap>2</keycap></term>
266 <term><keycap>3</keycap></term>
267 <term><keycap>4</keycap></term>
268 <term><keycap>5</keycap></term>
269 <term><keycap>6</keycap></term>
270 <term><keycap>7</keycap></term>
271 <term><keycap>8</keycap></term>
272 <term><keycap>9</keycap></term>
ec07c3c8
AK
273 <listitem><para>Boot entry number 1 … 9</para>
274
275 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
276 </varlistentry>
277 </variablelist>
278
e14a0c21
LP
279 <para>The boot menu is shown when a non-zero menu timeout has been configured. If the menu timeout has
280 been set to zero, it is sufficient to press any key — before the boot loader initializes — to bring up
281 the boot menu, except for the keys listed immediately above as they directly boot into the selected boot
282 menu item. Note that depending on the firmware implementation the time window where key presses are
283 accepted before the boot loader initializes might be short. If the window is missed, reboot and try
284 again, possibly pressing a suitable key (e.g. the space bar) continuously; on most systems it should be
285 possible to hit the time window after a few attempts. To avoid this problem, consider setting a non-zero
286 timeout, thus showing the boot menu unconditionally. Some desktop environments might offer an option to
287 directly boot into the boot menu, to avoid the problem altogether. Alternatively, use the command line
288 <command>systemctl reboot --boot-loader-menu=0</command> from the shell.</para>
289
f37d3835
ZJS
290 <para>In the editor, most keys simply insert themselves, but the following keys
291 may be used to perform additional actions:</para>
292
293 <variablelist>
294 <varlistentry>
8c073dde
LP
295 <term><keycap>←</keycap> (Left)</term>
296 <term><keycap>→</keycap> (Right)</term>
297 <term><keycap>Home</keycap></term>
298 <term><keycap>End</keycap></term>
ec07c3c8
AK
299 <listitem><para>Navigate left/right</para>
300
301 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
302 </varlistentry>
303
304 <varlistentry>
8c073dde 305 <term><keycap>Esc</keycap></term>
230f7820 306 <term><keycombo><keycap>Ctrl</keycap><keycap>c</keycap></keycombo></term>
f37d3835
ZJS
307 <listitem><para>Abort the edit and quit the editor</para></listitem>
308 </varlistentry>
309
310 <varlistentry>
8c073dde 311 <term><keycombo><keycap>Ctrl</keycap><keycap>k</keycap></keycombo></term>
ec07c3c8
AK
312 <listitem><para>Clear the command line forwards</para>
313
314 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
f37d3835
ZJS
315 </varlistentry>
316
317 <varlistentry>
8c073dde
LP
318 <term><keycombo><keycap>Ctrl</keycap><keycap>w</keycap></keycombo></term>
319 <term><keycombo><keycap>Alt</keycap><keycap>Backspace</keycap></keycombo></term>
ec07c3c8
AK
320 <listitem><para>Delete word backwards</para>
321
322 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
f37d3835
ZJS
323 </varlistentry>
324
325 <varlistentry>
230f7820 326 <term><keycombo><keycap>Ctrl</keycap><keycap>Del</keycap></keycombo></term>
8c073dde 327 <term><keycombo><keycap>Alt</keycap><keycap>d</keycap></keycombo></term>
f37d3835
ZJS
328 <listitem><para>Delete word forwards</para></listitem>
329 </varlistentry>
330
331 <varlistentry>
8c073dde 332 <term><keycap>↵</keycap> (Enter)</term>
ec07c3c8
AK
333 <listitem><para>Boot entry with the edited command line</para>
334
335 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
f37d3835
ZJS
336 </varlistentry>
337 </variablelist>
338
70c8db75 339 <para>Note that unless configured otherwise in the UEFI firmware, systemd-boot will
f37d3835
ZJS
340 use the US keyboard layout, so key labels might not match for keys like +/-.
341 </para>
342 </refsect1>
343
53ddb667
LP
344 <refsect1>
345 <title>Files</title>
346
c5fcaed8
LP
347 <para>The files <command>systemd-boot</command> processes generally reside on the UEFI ESP which is
348 usually mounted to <filename>/efi/</filename>, <filename>/boot/</filename> or
349 <filename>/boot/efi/</filename> during OS runtime. It also processes files on the Extended Boot Loader
350 partition which is typically mounted to <filename>/boot/</filename>, if it
99d51ed9
LP
351 exists.</para>
352
353 <para><command>systemd-boot</command> reads runtime configuration such as the boot timeout and default
c5fcaed8
LP
354 entry from <filename>/loader/loader.conf</filename> on the ESP (in combination with data read from EFI
355 variables). See
99d51ed9
LP
356 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
357
358 <para>Boot entry description files following the <ulink
db811444 359 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink> are read from
99d51ed9
LP
360 <filename>/loader/entries/</filename> on the ESP and the Extended Boot Loader partition.</para>
361
362 <para>Unified kernel boot entries following the <ulink
db811444 363 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink> are read from
99d51ed9
LP
364 <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader partition.</para>
365
366 <para>Optionally, a random seed for early boot entropy pool provisioning is stored in
367 <filename>/loader/random-seed</filename> in the ESP.</para>
368
369 <para>During initialization, <command>sd-boot</command> automatically loads all driver files placed in
370 the <filename>/EFI/systemd/drivers/</filename> directory of the ESP. The files placed there must have an
371 extension of the EFI architecture ID followed by <filename>.efi</filename> (e.g. for x86-64 this means a
372 suffix of <filename>x64.efi</filename>). This may be used to automatically load file system drivers and
373 similar, to extend the native firmware support.</para>
e6b0cfad
VD
374
375 <para>Enrollment of Secure Boot variables can be performed manually or automatically if files are available
8d41101a 376 under <filename>/loader/keys/<replaceable>NAME</replaceable>/{db,KEK,PK}.auth</filename>, <replaceable>NAME</replaceable>
e6b0cfad
VD
377 being the display name for the set of variables in the menu. If one of the sets is named <filename>auto</filename>
378 then it might be enrolled automatically depending on whether <literal>secure-boot-enroll</literal> is set
379 to force or not.</para>
53ddb667
LP
380 </refsect1>
381
8eebff9e
LP
382 <refsect1>
383 <title>EFI Variables</title>
384
b8cdb662
LP
385 <para>The following EFI variables are defined, set and read by <command>systemd-boot</command>, under the
386 vendor UUID <literal>4a67b082-0a4c-41cf-b6c7-440b29bb8c4f</literal>, for communication between the boot
387 loader and the OS:</para>
8eebff9e 388
bc61c2b1 389 <variablelist class='efi-variables'>
8eebff9e
LP
390 <varlistentry>
391 <term><varname>LoaderBootCountPath</varname></term>
392 <listitem><para>If boot counting is enabled, contains the path to the file in whose name the boot counters are
393 encoded. Set by the boot
394 loader. <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
395 uses this information to mark a boot as successful as determined by the successful activation of the
ec07c3c8
AK
396 <filename>boot-complete.target</filename> target unit.</para>
397
398 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
399 </varlistentry>
400
401 <varlistentry>
402 <term><varname>LoaderConfigTimeout</varname></term>
fe2579dd 403 <term><varname>LoaderConfigTimeoutOneShot</varname></term>
3f9a0a52 404 <listitem><para>The menu timeout in seconds. Read by the boot loader. <varname>LoaderConfigTimeout</varname>
fe2579dd
LP
405 is maintained persistently, while <varname>LoaderConfigTimeoutOneShot</varname> is a one-time override which is
406 read once (in which case it takes precedence over <varname>LoaderConfigTimeout</varname>) and then
407 removed. <varname>LoaderConfigTimeout</varname> may be manipulated with the
ec07c3c8
AK
408 <keycap>t</keycap>/<keycap>T</keycap> keys, see above.</para>
409
410 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
411 </varlistentry>
412
413 <varlistentry>
414 <term><varname>LoaderDevicePartUUID</varname></term>
415
416 <listitem><para>Contains the partition UUID of the EFI System Partition the boot loader was run from. Set by
417 the boot
418 loader. <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
419 uses this information to automatically find the disk booted from, in order to discover various other partitions
ec07c3c8
AK
420 on the same disk automatically.</para>
421
422 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
423 </varlistentry>
424
425 <varlistentry>
426 <term><varname>LoaderEntries</varname></term>
427
428 <listitem><para>A list of the identifiers of all discovered boot loader entries. Set by the boot
ec07c3c8
AK
429 loader.</para>
430
431 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
432 </varlistentry>
433
434 <varlistentry>
435 <term><varname>LoaderEntryDefault</varname></term>
436 <term><varname>LoaderEntryOneShot</varname></term>
437
438 <listitem><para>The identifier of the default boot loader entry. Set primarily by the OS and read by the boot
439 loader. <varname>LoaderEntryOneShot</varname> sets the default entry for the next boot only, while
440 <varname>LoaderEntryDefault</varname> sets it persistently for all future
441 boots. <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
442 <option>set-default</option> and <option>set-oneshot</option> commands make use of these variables. The boot
443 loader modifies <varname>LoaderEntryDefault</varname> on request, when the <keycap>d</keycap> key is used, see
ec07c3c8
AK
444 above.</para>
445
446 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
447 </varlistentry>
448
449 <varlistentry>
450 <term><varname>LoaderEntrySelected</varname></term>
451
452 <listitem><para>The identifier of the boot loader entry currently being booted. Set by the boot
ec07c3c8
AK
453 loader.</para>
454
455 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
456 </varlistentry>
457
5dd5f7cf
LP
458 <varlistentry>
459 <term><varname>LoaderFeatures</varname></term>
460
461 <listitem><para>A set of flags indicating the features the boot loader supports. Set by the boot loader. Use
462 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
ec07c3c8
AK
463 data.</para>
464
465 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
5dd5f7cf
LP
466 </varlistentry>
467
8eebff9e
LP
468 <varlistentry>
469 <term><varname>LoaderFirmwareInfo</varname></term>
470 <term><varname>LoaderFirmwareType</varname></term>
471
472 <listitem><para>Brief firmware information. Set by the boot loader. Use
473 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
ec07c3c8
AK
474 data.</para>
475
476 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
477 </varlistentry>
478
479 <varlistentry>
480 <term><varname>LoaderImageIdentifier</varname></term>
481
482 <listitem><para>The path of executable of the boot loader used for the current boot, relative to the EFI System
483 Partition's root directory. Set by the boot loader. Use
484 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
ec07c3c8
AK
485 data.</para>
486
487 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
488 </varlistentry>
489
490 <varlistentry>
491 <term><varname>LoaderInfo</varname></term>
492
493 <listitem><para>Brief information about the boot loader. Set by the boot loader. Use
494 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
ec07c3c8
AK
495 data.</para>
496
497 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
8eebff9e
LP
498 </varlistentry>
499
500 <varlistentry>
501 <term><varname>LoaderTimeExecUSec</varname></term>
502 <term><varname>LoaderTimeInitUSec</varname></term>
503 <term><varname>LoaderTimeMenuUsec</varname></term>
504
505 <listitem><para>Information about the time spent in various parts of the boot loader. Set by the boot
506 loader. Use <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>
ec07c3c8
AK
507 to view this data. </para>
508
509 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
39867bb9
LP
510 </varlistentry>
511
39867bb9
LP
512 <varlistentry>
513 <term><varname>LoaderSystemToken</varname></term>
514
e9dd6984
ZJS
515 <listitem><para>A binary random data field, that is used for generating the random seed to pass to
516 the OS (see above). Note that this random data is generally only generated once, during OS
ec07c3c8
AK
517 installation, and is then never updated again.</para>
518
519 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
8eebff9e
LP
520 </varlistentry>
521 </variablelist>
39867bb9
LP
522
523 <para>Many of these variables are defined by the <ulink
524 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>.</para>
8eebff9e
LP
525 </refsect1>
526
2b6cc3ca
LP
527 <refsect1>
528 <title>Boot Counting</title>
529
530 <para><command>systemd-boot</command> implements a simple boot counting mechanism on top of the <ulink
db811444 531 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink>, for automatic and unattended
5238e957 532 fallback to older kernel versions/boot loader entries when a specific entry continuously fails. Any boot loader
2b6cc3ca
LP
533 entry file and unified kernel image file that contains a <literal>+</literal> followed by one or two numbers (if
534 two they need to be separated by a <literal>-</literal>), before the <filename>.conf</filename> or
535 <filename>.efi</filename> suffix is subject to boot counting: the first of the two numbers ('tries left') is
536 decreased by one on every boot attempt, the second of the two numbers ('tries done') is increased by one (if 'tries
537 done' is absent it is considered equivalent to 0). Depending on the current value of these two counters the boot
538 entry is considered to be in one of three states:</para>
539
540 <orderedlist>
541 <listitem><para>If the 'tries left' counter of an entry is greater than zero the entry is considered to be in
542 'indeterminate' state. This means the entry has not completed booting successfully yet, but also hasn't been
543 determined not to work.</para></listitem>
544
545 <listitem><para>If the 'tries left' counter of an entry is zero it is considered to be in 'bad' state. This means
546 no further attempts to boot this item will be made (that is, unless all other boot entries are also in 'bad'
547 state), as all attempts to boot this entry have not completed successfully.</para></listitem>
548
549 <listitem><para>If the 'tries left' and 'tries done' counters of an entry are absent it is considered to be in
550 'good' state. This means further boot counting for the entry is turned off, as it successfully booted at least
551 once. The
552 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
553 service moves the currently booted entry from 'indeterminate' into 'good' state when a boot attempt completed
554 successfully.</para></listitem>
555 </orderedlist>
556
557 <para>Generally, when new entries are added to the boot loader, they first start out in 'indeterminate' state,
558 i.e. with a 'tries left' counter greater than zero. The boot entry remains in this state until either it managed to
559 complete a full boot successfully at least once (in which case it will be in 'good' state) — or the 'tries left'
560 counter reaches zero (in which case it will be in 'bad' state).</para>
561
562 <para>Example: let's say a boot loader entry file <filename>foo.conf</filename> is set up for 3 boot tries. The
563 installer will hence create it under the name <filename>foo+3.conf</filename>. On first boot, the boot loader will
564 rename it to <filename>foo+2-1.conf</filename>. If that boot does not complete successfully, the boot loader will
565 rename it to <filename>foo+1-2.conf</filename> on the following boot. If that fails too, it will finally be renamed
566 <filename>foo+0-3.conf</filename> by the boot loader on next boot, after which it will be considered 'bad'. If the
567 boot succeeds however the entry file will be renamed to <filename>foo.conf</filename> by the OS, so that it is
568 considered 'good' from then on.</para>
569
570 <para>The boot menu takes the 'tries left' counter into account when sorting the menu entries: entries in 'bad'
f65a3326
LP
571 state are ordered at the beginning of the list, and entries in 'good' or 'indeterminate' at the end. The user can
572 freely choose to boot any entry of the menu, including those already marked 'bad'. If the menu entry to boot is
573 automatically determined, this means that 'good' or 'indeterminate' entries are generally preferred (as the bottom
574 item of the menu is the one booted by default), and 'bad' entries will only be considered if there are no 'good' or
2b6cc3ca
LP
575 'indeterminate' entries left.</para>
576
577 <para>The <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry> kernel
578 install framework optionally sets the initial 'tries left' counter to the value specified in
579 <filename>/etc/kernel/tries</filename> when a boot loader entry is first created.</para>
580 </refsect1>
581
941d418d 582 <refsect1>
8fb35004 583 <title>Using <command>systemd-boot</command> in virtual machines</title>
941d418d
GH
584
585 <para>When using qemu with OVMF (UEFI Firmware for virtual machines) the <option>-kernel</option> switch
586 works not only for linux kernels, but for any EFI binary, including sd-boot and unified linux
8fb35004 587 kernels. Example command line for loading <command>systemd-boot</command> on x64:</para>
941d418d
GH
588
589 <para>
590 <command>qemu-system-x86_64 <replaceable>[ ... ]</replaceable>
591 -kernel /usr/lib/systemd/boot/efi/systemd-bootx64.efi</command>
592 </para>
593
594 <para>systemd-boot will detect that it was started directly instead of being loaded from ESP and will
595 search for the ESP in that case, taking into account boot order information from the hypervisor (if
596 available).</para>
597 </refsect1>
598
f37d3835
ZJS
599 <refsect1>
600 <title>See Also</title>
601 <para>
602 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
603 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2b6cc3ca 604 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
921fc451 605 <citerefentry><refentrytitle>systemd-boot-random-seed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
2b6cc3ca 606 <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
3f9a615d 607 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
db811444 608 <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification</ulink>,
2fe82132 609 <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>
f37d3835
ZJS
610 </para>
611 </refsect1>
612</refentry>