]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-boot.xml
Merge pull request #16336 from yuwata/ifindex-cleanups
[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">
f37d3835
ZJS
4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
70c8db75 6<refentry id="systemd-boot" conditional='ENABLE_EFI'
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
LP
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>
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
33 <filename>/boot/efi/</filename> during OS runtime, as well as from the Extended Boot Loader partition if
34 it exists (usually mounted to <filename>/boot/</filename>). Configuration file fragments, kernels,
35 initrds and other EFI images to boot generally need to reside on the ESP or the Extended Boot Loader
36 partition. Linux kernels must be built with <option>CONFIG_EFI_STUB</option> to be able to be directly
37 executed as an EFI image. During boot <command>systemd-boot</command> automatically assembles a list of
38 boot entries from the following sources:</para>
53ddb667
LP
39
40 <itemizedlist>
41 <listitem><para>Boot entries defined with <ulink
c5fcaed8
LP
42 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink> description files
43 located in <filename>/loader/entries/</filename> on the ESP and the Extended Boot Loader
44 Partition. These usually describe Linux kernel images with associated initrd images, but alternatively
45 may also describe arbitrary other EFI executables.</para></listitem>
53ddb667
LP
46
47 <listitem><para>Unified kernel images following the <ulink
c5fcaed8
LP
48 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>, as executable EFI
49 binaries in <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader Partition.
48691dca 50 </para></listitem>
53ddb667
LP
51
52 <listitem><para>The Microsoft Windows EFI boot manager, if installed</para></listitem>
53
54 <listitem><para>The Apple MacOS X boot manager, if installed</para></listitem>
55
56 <listitem><para>The EFI Shell binary, if installed</para></listitem>
57
58 <listitem><para>A reboot into the UEFI firmware setup option, if supported by the firmware</para></listitem>
59 </itemizedlist>
60
39867bb9
LP
61 <para><command>systemd-boot</command> supports the following features:</para>
62
63 <itemizedlist>
64 <listitem><para>Basic boot manager configuration changes (such as timeout
65 configuration, default boot entry selection, …) may be made directly from the boot loader UI at
66 boot-time, as well as during system runtime with EFI variables.</para></listitem>
67
68 <listitem><para>The boot manager integrates with the <command>systemctl</command> command to implement
69 features such as <command>systemctl reboot --boot-loader-entry=…</command> (for rebooting into a
70 specific boot menu entry, i.e. "reboot into Windows") and <command>systemctl reboot
71 --boot-loader-menu=…</command> (for rebooting into the boot loader menu), by implementing the <ulink
72 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. See
73 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
74 details.</para></listitem>
75
76 <listitem><para>An EFI variable set by the boot loader informs the OS about the ESP partition used
77 during boot. This is then used to automatically mount the correct ESP partition to
78 <filename>/efi/</filename> or <filename>/boot/</filename> during OS runtime. See
79 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
80 for details.</para></listitem>
81
82 <listitem><para>The boot manager provides information about the boot time spent in UEFI firmware using
83 the <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>. This
84 information can be displayed using
85 <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
86 </para></listitem>
87
88 <listitem><para>The boot manager implements boot counting and automatic fallback to older, working boot
89 entries on failure. See <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot
90 Assessment</ulink>.</para></listitem>
91
92 <listitem><para>The boot manager optionally reads a random seed from the ESP partition, combines it
11fcfc53 93 with a 'system token' stored in a persistent EFI variable and derives a random seed to use by the OS as
39867bb9
LP
94 entropy pool initializaton, providing a full entropy pool during early boot.</para></listitem>
95 </itemizedlist>
96
97 <para><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
c5fcaed8
LP
98 may be used from a running system to locate the ESP and the Extended Boot Loader Partition, list
99 available entries, and install <command>systemd-boot</command> itself.</para>
53ddb667 100
39867bb9
LP
101 <para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>
102 may be used to copy kernel images onto the ESP or the Extended Boot Loader Partition and to generate
103 description files compliant with the Boot Loader
104 Specification.</para>
f37d3835
ZJS
105 </refsect1>
106
f37d3835
ZJS
107 <refsect1>
108 <title>Key bindings</title>
109 <para>The following keys may be used in the boot menu:</para>
110
111 <variablelist>
112 <varlistentry>
8c073dde
LP
113 <term><keycap>↑</keycap> (Up)</term>
114 <term><keycap>↓</keycap> (Down)</term>
115 <term><keycap>j</keycap></term>
116 <term><keycap>k</keycap></term>
117 <term><keycap>PageUp</keycap></term>
118 <term><keycap>PageDown</keycap></term>
119 <term><keycap>Home</keycap></term>
120 <term><keycap>End</keycap></term>
f37d3835
ZJS
121 <listitem><para>Navigate up/down in the entry list</para></listitem>
122 </varlistentry>
123
124 <varlistentry>
8c073dde 125 <term><keycap>↵</keycap> (Enter)</term>
904ebcb2 126 <term><keycap>→</keycap> (Right)</term>
f37d3835
ZJS
127 <listitem><para>Boot selected entry</para></listitem>
128 </varlistentry>
129
130 <varlistentry>
8c073dde 131 <term><keycap>d</keycap></term>
f37d3835
ZJS
132 <listitem><para>Make selected entry the default</para></listitem>
133 </varlistentry>
134
135 <varlistentry>
8c073dde 136 <term><keycap>e</keycap></term>
f37d3835
ZJS
137 <listitem><para>Edit the kernel command line for selected entry</para></listitem>
138 </varlistentry>
139
140 <varlistentry>
8c073dde
LP
141 <term><keycap>+</keycap></term>
142 <term><keycap>t</keycap></term>
f37d3835
ZJS
143 <listitem><para>Increase the timeout before default entry is booted</para></listitem>
144 </varlistentry>
145
146 <varlistentry>
8c073dde
LP
147 <term><keycap>-</keycap></term>
148 <term><keycap>T</keycap></term>
f37d3835
ZJS
149 <listitem><para>Decrease the timeout</para></listitem>
150 </varlistentry>
151
152 <varlistentry>
8c073dde 153 <term><keycap>v</keycap></term>
70c8db75 154 <listitem><para>Show systemd-boot, UEFI, and firmware versions</para></listitem>
f37d3835
ZJS
155 </varlistentry>
156
157 <varlistentry>
8c073dde 158 <term><keycap>P</keycap></term>
f37d3835
ZJS
159 <listitem><para>Print status</para></listitem>
160 </varlistentry>
161
162 <varlistentry>
8c073dde 163 <term><keycap>Q</keycap></term>
f37d3835
ZJS
164 <listitem><para>Quit</para></listitem>
165 </varlistentry>
166
167 <varlistentry>
8c073dde
LP
168 <term><keycap>h</keycap></term>
169 <term><keycap>?</keycap></term>
f37d3835
ZJS
170 <listitem><para>Show a help screen</para></listitem>
171 </varlistentry>
172
173 <varlistentry>
8c073dde 174 <term><keycombo><keycap>Ctrl</keycap><keycap>l</keycap></keycombo></term>
f37d3835
ZJS
175 <listitem><para>Reprint the screen</para></listitem>
176 </varlistentry>
177 </variablelist>
178
e14a0c21
LP
179 <para>The following keys may be pressed during bootup or in the boot menu to directly boot a specific
180 entry:</para>
f37d3835
ZJS
181
182 <variablelist>
183 <varlistentry>
8c073dde 184 <term><keycap>l</keycap></term>
f37d3835
ZJS
185 <listitem><para>Linux</para></listitem>
186 </varlistentry>
187
188 <varlistentry>
8c073dde 189 <term><keycap>w</keycap></term>
f37d3835
ZJS
190 <listitem><para>Windows</para></listitem>
191 </varlistentry>
192
193 <varlistentry>
8c073dde 194 <term><keycap>a</keycap></term>
f37d3835
ZJS
195 <listitem><para>OS X</para></listitem>
196 </varlistentry>
197
198 <varlistentry>
8c073dde 199 <term><keycap>s</keycap></term>
f37d3835
ZJS
200 <listitem><para>EFI shell</para></listitem>
201 </varlistentry>
202
203 <varlistentry>
8c073dde
LP
204 <term><keycap>1</keycap></term>
205 <term><keycap>2</keycap></term>
206 <term><keycap>3</keycap></term>
207 <term><keycap>4</keycap></term>
208 <term><keycap>5</keycap></term>
209 <term><keycap>6</keycap></term>
210 <term><keycap>7</keycap></term>
211 <term><keycap>8</keycap></term>
212 <term><keycap>9</keycap></term>
53ddb667 213 <listitem><para>Boot entry number 1 … 9</para></listitem>
f37d3835
ZJS
214 </varlistentry>
215 </variablelist>
216
e14a0c21
LP
217 <para>The boot menu is shown when a non-zero menu timeout has been configured. If the menu timeout has
218 been set to zero, it is sufficient to press any key — before the boot loader initializes — to bring up
219 the boot menu, except for the keys listed immediately above as they directly boot into the selected boot
220 menu item. Note that depending on the firmware implementation the time window where key presses are
221 accepted before the boot loader initializes might be short. If the window is missed, reboot and try
222 again, possibly pressing a suitable key (e.g. the space bar) continuously; on most systems it should be
223 possible to hit the time window after a few attempts. To avoid this problem, consider setting a non-zero
224 timeout, thus showing the boot menu unconditionally. Some desktop environments might offer an option to
225 directly boot into the boot menu, to avoid the problem altogether. Alternatively, use the command line
226 <command>systemctl reboot --boot-loader-menu=0</command> from the shell.</para>
227
f37d3835
ZJS
228 <para>In the editor, most keys simply insert themselves, but the following keys
229 may be used to perform additional actions:</para>
230
231 <variablelist>
232 <varlistentry>
8c073dde
LP
233 <term><keycap>←</keycap> (Left)</term>
234 <term><keycap>→</keycap> (Right)</term>
235 <term><keycap>Home</keycap></term>
236 <term><keycap>End</keycap></term>
f37d3835
ZJS
237 <listitem><para>Navigate left/right</para></listitem>
238 </varlistentry>
239
240 <varlistentry>
8c073dde 241 <term><keycap>Esc</keycap></term>
f37d3835
ZJS
242 <listitem><para>Abort the edit and quit the editor</para></listitem>
243 </varlistentry>
244
245 <varlistentry>
8c073dde 246 <term><keycombo><keycap>Ctrl</keycap><keycap>k</keycap></keycombo></term>
f37d3835
ZJS
247 <listitem><para>Clear the command line</para></listitem>
248 </varlistentry>
249
250 <varlistentry>
8c073dde
LP
251 <term><keycombo><keycap>Ctrl</keycap><keycap>w</keycap></keycombo></term>
252 <term><keycombo><keycap>Alt</keycap><keycap>Backspace</keycap></keycombo></term>
f37d3835
ZJS
253 <listitem><para>Delete word backwards</para></listitem>
254 </varlistentry>
255
256 <varlistentry>
8c073dde 257 <term><keycombo><keycap>Alt</keycap><keycap>d</keycap></keycombo></term>
f37d3835
ZJS
258 <listitem><para>Delete word forwards</para></listitem>
259 </varlistentry>
260
261 <varlistentry>
8c073dde 262 <term><keycap>↵</keycap> (Enter)</term>
f37d3835
ZJS
263 <listitem><para>Boot entry with the edited command line</para></listitem>
264 </varlistentry>
265 </variablelist>
266
70c8db75 267 <para>Note that unless configured otherwise in the UEFI firmware, systemd-boot will
f37d3835
ZJS
268 use the US keyboard layout, so key labels might not match for keys like +/-.
269 </para>
270 </refsect1>
271
53ddb667
LP
272 <refsect1>
273 <title>Files</title>
274
c5fcaed8
LP
275 <para>The files <command>systemd-boot</command> processes generally reside on the UEFI ESP which is
276 usually mounted to <filename>/efi/</filename>, <filename>/boot/</filename> or
277 <filename>/boot/efi/</filename> during OS runtime. It also processes files on the Extended Boot Loader
278 partition which is typically mounted to <filename>/boot/</filename>, if it
279 exists. <command>systemd-boot</command> reads runtime configuration such as the boot timeout and default
280 entry from <filename>/loader/loader.conf</filename> on the ESP (in combination with data read from EFI
281 variables). See
282 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Boot
283 entry description files following the <ulink url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot
284 Loader Specification</ulink> are read from <filename>/loader/entries/</filename> on the ESP and the
285 Extended Boot Loader partition. Unified kernel boot entries following the <ulink
286 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink> are read from
39867bb9
LP
287 <filename>/EFI/Linux/</filename> on the ESP and the Extended Boot Loader partition. Optionally, a random
288 seed for early boot entropy pool provisioning is stored in <filename>/loader/random-seed</filename> in
289 the ESP.</para>
53ddb667
LP
290 </refsect1>
291
8eebff9e
LP
292 <refsect1>
293 <title>EFI Variables</title>
294
295 <para>The following EFI variables are defined, set and read by <command>systemd-boot</command>, under the vendor
296 UUID <literal>4a67b082-0a4c-41cf-b6c7-440b29bb8c4</literal>, for communication between the OS and the boot
297 loader:</para>
298
bc61c2b1 299 <variablelist class='efi-variables'>
8eebff9e
LP
300 <varlistentry>
301 <term><varname>LoaderBootCountPath</varname></term>
302 <listitem><para>If boot counting is enabled, contains the path to the file in whose name the boot counters are
303 encoded. Set by the boot
304 loader. <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
305 uses this information to mark a boot as successful as determined by the successful activation of the
306 <filename>boot-complete.target</filename> target unit.</para></listitem>
307 </varlistentry>
308
309 <varlistentry>
310 <term><varname>LoaderConfigTimeout</varname></term>
fe2579dd 311 <term><varname>LoaderConfigTimeoutOneShot</varname></term>
3f9a0a52 312 <listitem><para>The menu timeout in seconds. Read by the boot loader. <varname>LoaderConfigTimeout</varname>
fe2579dd
LP
313 is maintained persistently, while <varname>LoaderConfigTimeoutOneShot</varname> is a one-time override which is
314 read once (in which case it takes precedence over <varname>LoaderConfigTimeout</varname>) and then
315 removed. <varname>LoaderConfigTimeout</varname> may be manipulated with the
316 <keycap>t</keycap>/<keycap>T</keycap> keys, see above.)</para></listitem>
8eebff9e
LP
317 </varlistentry>
318
319 <varlistentry>
320 <term><varname>LoaderDevicePartUUID</varname></term>
321
322 <listitem><para>Contains the partition UUID of the EFI System Partition the boot loader was run from. Set by
323 the boot
324 loader. <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
325 uses this information to automatically find the disk booted from, in order to discover various other partitions
326 on the same disk automatically.</para></listitem>
327 </varlistentry>
328
329 <varlistentry>
330 <term><varname>LoaderEntries</varname></term>
331
332 <listitem><para>A list of the identifiers of all discovered boot loader entries. Set by the boot
333 loader.</para></listitem>
334 </varlistentry>
335
336 <varlistentry>
337 <term><varname>LoaderEntryDefault</varname></term>
338 <term><varname>LoaderEntryOneShot</varname></term>
339
340 <listitem><para>The identifier of the default boot loader entry. Set primarily by the OS and read by the boot
341 loader. <varname>LoaderEntryOneShot</varname> sets the default entry for the next boot only, while
342 <varname>LoaderEntryDefault</varname> sets it persistently for all future
343 boots. <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
344 <option>set-default</option> and <option>set-oneshot</option> commands make use of these variables. The boot
345 loader modifies <varname>LoaderEntryDefault</varname> on request, when the <keycap>d</keycap> key is used, see
346 above.)</para></listitem>
347 </varlistentry>
348
349 <varlistentry>
350 <term><varname>LoaderEntrySelected</varname></term>
351
352 <listitem><para>The identifier of the boot loader entry currently being booted. Set by the boot
353 loader.</para></listitem>
354 </varlistentry>
355
5dd5f7cf
LP
356 <varlistentry>
357 <term><varname>LoaderFeatures</varname></term>
358
359 <listitem><para>A set of flags indicating the features the boot loader supports. Set by the boot loader. Use
360 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
361 data.</para></listitem>
362 </varlistentry>
363
8eebff9e
LP
364 <varlistentry>
365 <term><varname>LoaderFirmwareInfo</varname></term>
366 <term><varname>LoaderFirmwareType</varname></term>
367
368 <listitem><para>Brief firmware information. Set by the boot loader. Use
369 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
370 data.</para></listitem>
371 </varlistentry>
372
373 <varlistentry>
374 <term><varname>LoaderImageIdentifier</varname></term>
375
376 <listitem><para>The path of executable of the boot loader used for the current boot, relative to the EFI System
377 Partition's root directory. Set by the boot loader. Use
378 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
379 data.</para></listitem>
380 </varlistentry>
381
382 <varlistentry>
383 <term><varname>LoaderInfo</varname></term>
384
385 <listitem><para>Brief information about the boot loader. Set by the boot loader. Use
386 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
387 data.</para></listitem>
388 </varlistentry>
389
390 <varlistentry>
391 <term><varname>LoaderTimeExecUSec</varname></term>
392 <term><varname>LoaderTimeInitUSec</varname></term>
393 <term><varname>LoaderTimeMenuUsec</varname></term>
394
395 <listitem><para>Information about the time spent in various parts of the boot loader. Set by the boot
396 loader. Use <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>
39867bb9
LP
397 to view this data. </para></listitem>
398 </varlistentry>
399
400 <varlistentry>
401 <term><varname>LoaderRandomSeed</varname></term>
402
403 <listitem><para>A binary random seed <command>systemd-boot</command> may optionally pass to the
404 OS. This is a volatile EFI variable that is hashed at boot from the combination of a random seed
405 stored in the ESP (in <filename>/loader/random-seed</filename>) and a "system token" persistently
406 stored in the EFI variable <varname>LoaderSystemToken</varname> (see below). During early OS boot the
407 system manager reads this variable and passes it to the OS kernel's random pool, crediting the full
408 entropy it contains. This is an efficient way to ensure the system starts up with a fully initialized
409 kernel random pool — as early as the initial RAM disk phase. <command>systemd-boot</command> reads
410 the random seed from the ESP, combines it with the "system token", and both derives a new random seed
411 to update in-place the seed stored in the ESP, and the random seed to pass to the OS from it via
412 SHA256 hashing in counter mode. This ensures that different physical systems that boot the same
413 "golden" OS image — i.e. containing the same random seed file in the ESP — will still pass a
414 different random seed to the OS. It is made sure the random seed stored in the ESP is fully
415 overwritten before the OS is booted, to ensure different random seed data is used between subsequent
93f59100
LP
416 boots.</para>
417
418 <para>See <ulink url="https://systemd.io/RANDOM_SEEDS">Random Seeds</ulink> for
419 further information.</para></listitem>
39867bb9
LP
420 </varlistentry>
421
422 <varlistentry>
423 <term><varname>LoaderSystemToken</varname></term>
424
425 <listitem><para>A binary random data field, that is used for generating the random see to pass to the
426 OS (see above). Note that this random data is generally only generated once, during OS installation,
427 and is then never updated again.</para></listitem>
8eebff9e
LP
428 </varlistentry>
429 </variablelist>
39867bb9
LP
430
431 <para>Many of these variables are defined by the <ulink
432 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>.</para>
8eebff9e
LP
433 </refsect1>
434
2b6cc3ca
LP
435 <refsect1>
436 <title>Boot Counting</title>
437
438 <para><command>systemd-boot</command> implements a simple boot counting mechanism on top of the <ulink
439 url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>, for automatic and unattended
5238e957 440 fallback to older kernel versions/boot loader entries when a specific entry continuously fails. Any boot loader
2b6cc3ca
LP
441 entry file and unified kernel image file that contains a <literal>+</literal> followed by one or two numbers (if
442 two they need to be separated by a <literal>-</literal>), before the <filename>.conf</filename> or
443 <filename>.efi</filename> suffix is subject to boot counting: the first of the two numbers ('tries left') is
444 decreased by one on every boot attempt, the second of the two numbers ('tries done') is increased by one (if 'tries
445 done' is absent it is considered equivalent to 0). Depending on the current value of these two counters the boot
446 entry is considered to be in one of three states:</para>
447
448 <orderedlist>
449 <listitem><para>If the 'tries left' counter of an entry is greater than zero the entry is considered to be in
450 'indeterminate' state. This means the entry has not completed booting successfully yet, but also hasn't been
451 determined not to work.</para></listitem>
452
453 <listitem><para>If the 'tries left' counter of an entry is zero it is considered to be in 'bad' state. This means
454 no further attempts to boot this item will be made (that is, unless all other boot entries are also in 'bad'
455 state), as all attempts to boot this entry have not completed successfully.</para></listitem>
456
457 <listitem><para>If the 'tries left' and 'tries done' counters of an entry are absent it is considered to be in
458 'good' state. This means further boot counting for the entry is turned off, as it successfully booted at least
459 once. The
460 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
461 service moves the currently booted entry from 'indeterminate' into 'good' state when a boot attempt completed
462 successfully.</para></listitem>
463 </orderedlist>
464
465 <para>Generally, when new entries are added to the boot loader, they first start out in 'indeterminate' state,
466 i.e. with a 'tries left' counter greater than zero. The boot entry remains in this state until either it managed to
467 complete a full boot successfully at least once (in which case it will be in 'good' state) — or the 'tries left'
468 counter reaches zero (in which case it will be in 'bad' state).</para>
469
470 <para>Example: let's say a boot loader entry file <filename>foo.conf</filename> is set up for 3 boot tries. The
471 installer will hence create it under the name <filename>foo+3.conf</filename>. On first boot, the boot loader will
472 rename it to <filename>foo+2-1.conf</filename>. If that boot does not complete successfully, the boot loader will
473 rename it to <filename>foo+1-2.conf</filename> on the following boot. If that fails too, it will finally be renamed
474 <filename>foo+0-3.conf</filename> by the boot loader on next boot, after which it will be considered 'bad'. If the
475 boot succeeds however the entry file will be renamed to <filename>foo.conf</filename> by the OS, so that it is
476 considered 'good' from then on.</para>
477
478 <para>The boot menu takes the 'tries left' counter into account when sorting the menu entries: entries in 'bad'
e6190e28 479 state are ordered at the beginning of the list, and entries in 'good' or 'indeterminate' at the end. The user can
2b6cc3ca 480 freely choose to boot any entry of the menu, including those already marked 'bad'. If the menu entry to boot is
e6190e28
DF
481 automatically determined, this means that 'good' or 'indeterminate' entries are generally preferred (as the bottom
482 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
483 'indeterminate' entries left.</para>
484
485 <para>The <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry> kernel
486 install framework optionally sets the initial 'tries left' counter to the value specified in
487 <filename>/etc/kernel/tries</filename> when a boot loader entry is first created.</para>
488 </refsect1>
489
f37d3835
ZJS
490 <refsect1>
491 <title>See Also</title>
492 <para>
493 <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
494 <citerefentry><refentrytitle>loader.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2b6cc3ca 495 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
39867bb9 496 <citerefentry><refentrytitle>systemd-boot-system-token.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
2b6cc3ca 497 <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
a0848495 498 <ulink url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink>,
2fe82132 499 <ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>
f37d3835
ZJS
500 </para>
501 </refsect1>
502</refentry>