Debian Codegraph @

man/bootctl.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="bootctl"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8 <refentryinfo>
9 <title>bootctl</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>bootctl</refentrytitle>
15 <manvolnum>1</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>bootctl</refname>
20 <refpurpose>Control EFI firmware boot settings and manage boot loader</refpurpose>
21 </refnamediv>
22
23 <refsynopsisdiv>
24 <cmdsynopsis>
25 <command>bootctl</command>
26 <arg choice="opt" rep="repeat">OPTIONS</arg>
27 <arg choice="req">COMMAND</arg>
28 </cmdsynopsis>
29 </refsynopsisdiv>
30
31 <refsect1>
32 <title>Description</title>
33
34 <para><command>bootctl</command> can check the EFI firmware and boot loader status, list and manage
35 available boot loaders and boot loader entries, and install, update, or remove the
36 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry> boot
37 loader on the current system.</para>
38 </refsect1>
39
40 <refsect1>
41 <title>Generic EFI Firmware/Boot Loader Commands</title>
42
43 <para>These commands are available on any EFI system, regardless of the boot loader used.</para>
44
45 <variablelist>
46 <varlistentry>
47 <term><option>status</option></term>
48
49 <listitem><para>Shows brief information about the system firmware, the boot loader that was used to
50 boot the system, the boot loaders currently available in the ESP, the boot loaders listed in the
51 firmware's list of boot loaders and the current default boot loader entry. If no command is
52 specified, this is the implied default.</para>
53
54 <para>See the example below for details of the output.</para>
55
56 <xi:include href="version-info.xml" xpointer="v239"/>
57 </listitem>
58 </varlistentry>
59
60 <varlistentry>
61 <term><option>reboot-to-firmware</option> <optional><replaceable>BOOL</replaceable></optional></term>
62
63 <listitem><para>Query or set the "Reboot-Into-Firmware-Setup" flag of the EFI firmware. Takes a
64 boolean argument which controls whether to show the firmware setup on next system reboot. If the
65 argument is omitted shows the current status of the flag, or whether the flag is supported. This
66 controls the same flag as <command>systemctl reboot --firmware-setup</command>, but is more low-level
67 and allows setting the flag independently from actually requesting a reboot.</para>
68
69 <para>Hint: use <command>systemctl reboot --firmware-setup</command> to reboot into firmware setup
70 once. See
71 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
72 for details.</para>
73
74 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
75 </varlistentry>
76 </variablelist>
77 </refsect1>
78
79 <refsect1>
80 <title>Boot Loader Specification Commands</title>
81
82 <para>These commands are available for all boot loaders that
83 implement the <ulink
84 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot
85 Loader Specification</ulink>, such as
86 <command>systemd-boot</command>.</para>
87
88 <variablelist>
89 <varlistentry>
90 <term><option>list</option></term>
91
92 <listitem><para>Shows all available boot loader entries implementing the <ulink
93 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink>, as well as any
94 other entries discovered or automatically generated by a boot loader implementing the <ulink
95 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>.
96 JSON output may be requested with <option>--json=</option>.</para>
97
98 <para>See the example below for details of the output.</para>
99
100 <xi:include href="version-info.xml" xpointer="v239"/>
101 </listitem>
102 </varlistentry>
103
104 <varlistentry>
105 <term><option>unlink</option> <optional><replaceable>ID</replaceable></optional></term>
106
107 <listitem><para>Removes a boot loader entry including the files it refers to. Takes an optional boot
108 loader entry ID string or a glob pattern as argument. Referenced files such as the kernel, initrds,
109 system extensions (sysexts), configuration extensions (confexts) or credential files are only removed
110 if no other entry refers to them.</para>
111
112 <para>If no <replaceable>ID</replaceable> argument is specified, the <option>--oldest</option> option
113 must be specified, in which case the boot loader entry with the lowest version is removed (for
114 robustness reasons the currently booted menu entry is never removed, nor is the last existing boot
115 loader entry).</para>
116
117 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term><option>link</option> <replaceable>KERNEL</replaceable></term>
122
123 <listitem><para>Creates one or more Type #1 boot loader entries pointing to the specified UKI. Takes
124 the path to a Unified Kernel Image (UKI) as argument. The UKI is copied into the ESP (or XBOOTLDR
125 partition if present) below the configured entry token directory, and one or more <ulink
126 url="https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader
127 Specification</ulink> Type #1 entries are generated referring to it (one per UKI profile, if multiple
128 profiles are embedded).</para>
129
130 <para>The title, version, commit number and initial try counter of the generated entries
131 may be overridden with <option>--entry-title=</option>, <option>--entry-version=</option>,
132 <option>--entry-commit=</option> and <option>--tries-left=</option>. Additional sidecar resources
133 (system extension images, configuration extension images, credential files) to pass to the UKI at
134 boot may be specified with <option>--extra=</option>.</para>
135
136 <para>If the ESP/XBOOTLDR do not have enough free space for the new boot loader entry and its
137 referenced resources the oldest existing boot loader entry matching the selected entry token is
138 removed (along with any resources referenced by it that are no longer referenced by any other
139 entry). This step is repeated until the new boot loader entry fits. For robustness reasons the
140 currently booted boot loader entry is never removed, nor is the last existing boot loader
141 entry.</para>
142
143 <para>By default, the operation refuses to proceed if the resulting ESP/XBOOTLDR free space would
144 drop below a safety threshold after automatic removal of older entries completes; use
145 <option>--keep-free=</option> to adjust.</para>
146
147 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
148 </varlistentry>
149
150 <varlistentry>
151 <term><option>cleanup</option></term>
152
153 <listitem><para>Removes files from the ESP and XBOOTLDR partitions that belong to the entry token but
154 are not referenced in any boot loader entries.</para>
155
156 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
157 </varlistentry>
158 </variablelist>
159 </refsect1>
160
161 <refsect1>
162 <title>Boot Loader Interface Commands</title>
163
164 <para>These commands are available for all boot loaders that implement the <ulink
165 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink> and the <ulink
166 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>, such as
167 <command>systemd-boot</command>.</para>
168
169 <variablelist>
170 <varlistentry>
171 <term><option>set-preferred</option> <replaceable>ID</replaceable></term>
172 <term><option>set-default</option> <replaceable>ID</replaceable></term>
173 <term><option>set-oneshot</option> <replaceable>ID</replaceable></term>
174 <term><option>set-sysfail</option> <replaceable>ID</replaceable></term>
175
176 <listitem><para>Sets the default boot loader entry. Takes a single boot loader entry ID string or a glob
177 pattern as argument. The <option>set-oneshot</option> command will set the default entry only for the next boot,
178 <option>set-default</option> will set it persistently for all future boots,
179 <option>set-preferred</option> is like <option>set-default</option>,
180 but is aware of boot assessment and will skip boot entries that have their tries-left counter set to zero.
181 The <option>set-sysfail</option> command
182 will set the boot loader entry to be used in case of a system failure. System failure (SysFail) boot entries can
183 optionally modify the automatic selection order in the event of a failure, such as a boot firmware update failure with
184 the failure status recorded in the EFI system table.</para>
185
186 <para><command>bootctl list</command> can be used to list available boot loader entries and their
187 IDs.</para>
188
189 <para>In addition, the boot loader entry ID may be specified as one of: <option>@default</option>,
190 <option>@oneshot</option> or <option>@current</option>, which correspond to the current default boot loader
191 entry for all future boots, the current default boot loader entry for the next boot, and the currently booted
192 boot loader entry. These special IDs are resolved to the current values of the EFI variables
193 <varname>LoaderEntryDefault</varname>, <varname>LoaderEntrySysFail</varname>, <varname>LoaderEntryOneShot</varname>
194 and <varname>LoaderEntrySelected</varname>, see <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">
195 UAPI.1 Boot Loader Specification</ulink> for details.
196 These special IDs are primarily useful as a quick way to persistently make the currently booted boot loader
197 entry the default choice, or to upgrade the default boot loader entry for the next boot to the default boot
198 loader entry for all future boots, but may be used for other operations too.</para>
199
200 <para>If set to <option>@saved</option> the chosen entry will be saved as an EFI variable
201 on every boot and automatically selected the next time the boot loader starts.</para>
202
203 <para>When an empty string ("") is specified as the ID, then the corresponding EFI variable will be
204 unset.</para>
205
206 <para>Hint: use <command>systemctl reboot --boot-loader-entry=<replaceable>ID</replaceable></command>
207 to reboot into a specific boot entry and
208 <command>systemctl reboot --boot-loader-menu=<replaceable>timeout</replaceable></command>
209 to reboot into the boot loader menu once. See
210 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
211 for details.</para>
212
213 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
214 </varlistentry>
215
216 <varlistentry>
217 <term><option>set-timeout</option> <replaceable>TIMEOUT</replaceable></term>
218 <term><option>set-timeout-oneshot</option> <replaceable>TIMEOUT</replaceable></term>
219
220 <listitem><para>Sets the boot loader menu timeout in seconds. The <option>set-timeout-oneshot</option>
221 command will set the timeout only for the next boot. See
222 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>
223 for details about the syntax of time spans.</para>
224
225 <para>If this is set to <option>menu-disabled</option> or <option>menu-hidden</option> or
226 <option>0</option>, no menu is shown and the default entry will be booted immediately, while
227 setting this to <option>menu-force</option> disables the timeout while always showing the menu.
228 When an empty string ("") is specified the bootloader will revert to its default menu timeout.</para>
229
230 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
231 </varlistentry>
232 </variablelist>
233 </refsect1>
234
235 <refsect1>
236 <title><command>systemd-boot</command> Commands</title>
237
238 <para>These commands manage the <command>systemd-boot</command> EFI boot loader, and do not work in
239 conjunction with other boot loaders.</para>
240
241 <variablelist>
242 <varlistentry>
243 <term><option>install</option></term>
244
245 <listitem><para>Installs <command>systemd-boot</command> into the EFI system partition. A copy of
246 <command>systemd-boot</command> will be stored as the EFI default/fallback loader at
247 <filename><replaceable>ESP</replaceable>/EFI/BOOT/BOOT*.EFI</filename>. The boot loader is then added
248 to the top of the firmware's boot loader list.</para>
249
250 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><option>update</option></term>
255
256 <listitem><para>Updates all installed versions of
257 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>, if the
258 available version is newer than the version installed in the EFI system partition. This also includes the EFI
259 default/fallback loader at <filename><replaceable>ESP</replaceable>/EFI/BOOT/BOOT*.EFI</filename>. The boot
260 loader is then added to end of the firmware's boot loader list if missing.</para>
261
262 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
263 </varlistentry>
264
265 <varlistentry>
266 <term><option>remove</option></term>
267
268 <listitem><para>Removes all installed versions of <command>systemd-boot</command> from the EFI system partition
269 and the firmware's boot loader list.</para>
270
271 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
272 </varlistentry>
273
274 <varlistentry>
275 <term><option>is-installed</option></term>
276
277 <listitem><para>Checks whether <command>systemd-boot</command> is installed in the ESP. Note that a
278 single ESP might host multiple boot loaders; this hence checks whether
279 <command>systemd-boot</command> is one (of possibly many) installed boot loaders — and neither
280 whether it is the default nor whether it is registered in any EFI variables.</para>
281
282 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
283 </varlistentry>
284
285 <varlistentry>
286 <term><option>random-seed</option></term>
287
288 <listitem><para>Generates a random seed and stores it in the EFI System Partition (ESP), for use by
289 the <command>systemd-boot</command> boot loader. If a random seed already exists in the ESP it is
290 refreshed. Also generates a random 'system token' and stores it persistently as an EFI variable, if
291 one has not been set before. If the boot loader finds the random seed in the ESP and the system token
292 in the EFI variable it will derive a random seed to pass to the OS and a new seed to store in the ESP
293 from the combination of both. The random seed passed to the OS is credited to the kernel's entropy
294 pool by the system manager during early boot, and permits userspace to boot up with an entropy pool
295 fully initialized very early on. Also see
296 <citerefentry><refentrytitle>systemd-boot-random-seed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
297
298 <para>See <ulink url="https://systemd.io/RANDOM_SEEDS">Random Seeds</ulink> for further
299 information.</para>
300
301 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
302 </varlistentry>
303
304 </variablelist>
305 </refsect1>
306
307 <refsect1>
308 <title>Kernel Image Commands</title>
309
310 <variablelist>
311 <varlistentry>
312 <term><option>kernel-identify</option> <replaceable>KERNEL-IMAGE</replaceable></term>
313
314 <listitem><para>Takes a kernel image as argument. Checks what kind of kernel the image is. Returns
315 one of <literal>uki</literal>, <literal>addon</literal>, <literal>pe</literal>, and
316 <literal>unknown</literal>.
317 </para>
318
319 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
320 </varlistentry>
321
322 <varlistentry>
323 <term><option>kernel-inspect</option> <replaceable>KERNEL-IMAGE</replaceable></term>
324
325 <listitem><para>Takes a kernel image as argument. Prints details about the image.</para>
326
327 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
328 </varlistentry>
329 </variablelist>
330 </refsect1>
331
332 <refsect1>
333 <title>Options</title>
334 <para>The following options are understood:</para>
335
336 <variablelist>
337 <xi:include href="standard-options.xml" xpointer="esp-path"/>
338 <xi:include href="standard-options.xml" xpointer="boot-path"/>
339
340 <varlistentry>
341 <term><option>--root=<replaceable>root</replaceable></option></term>
342 <listitem><para>Takes a directory path as an argument. All
343 paths will be prefixed with the given alternate
344 <replaceable>root</replaceable> path, including config search
345 paths. </para>
346
347 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
348 </varlistentry>
349
350 <varlistentry>
351 <term><option>--image=<replaceable>image</replaceable></option></term>
352
353 <listitem><para>Takes a path to a disk image file or block device node. If specified, all operations
354 are applied to file system in the indicated disk image. This option is similar to
355 <option>--root=</option>, but operates on file systems stored in disk images or block devices. The
356 disk image should either contain just a file system or a set of file systems within a GPT partition
357 table, following the <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable Partitions
358 Specification</ulink>. For further information on supported disk images, see
359 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
360 switch of the same name.</para>
361
362 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
363 </varlistentry>
364
365 <xi:include href="standard-options.xml" xpointer="image-policy-open" />
366
367 <varlistentry>
368 <term><option>--install-source=</option></term>
369 <listitem><para>When installing binaries with <option>--root=</option> or
370 <option>--image=</option>, selects where to source them from. Takes one of <literal>auto</literal>
371 (the default), <literal>image</literal> or <literal>host</literal>. With <literal>auto</literal>
372 binaries will be picked from the specified directory or image, and if not found they will be picked
373 from the host. With <literal>image</literal> or <literal>host</literal> no fallback search will be
374 performed if the binaries are not found in the selected source.</para>
375
376 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
377 </varlistentry>
378
379 <varlistentry>
380 <term><option>-p</option></term>
381 <term><option>--print-esp-path</option></term>
382 <listitem><para>This option modifies the behaviour of <command>status</command>. Only prints the path
383 to the EFI System Partition (ESP) to standard output and exits.</para>
384
385 <xi:include href="version-info.xml" xpointer="v236"/></listitem>
386 </varlistentry>
387
388 <varlistentry>
389 <term><option>-x</option></term>
390 <term><option>--print-boot-path</option></term>
391 <listitem><para>This option modifies the behaviour of <command>status</command>. Only prints the path
392 to the Extended Boot Loader partition if it exists, and the path to the ESP otherwise to standard
393 output and exit. This command is useful to determine where to place boot loader entries, as they are
394 preferably placed in the Extended Boot Loader partition if it exists and in the ESP otherwise.</para>
395
396 <para>Boot Loader Specification Type #1 entries should generally be placed in the directory
397 <literal>$(bootctl -x)/loader/entries/</literal>. Existence of that directory may also be used as
398 indication that boot loader entry support is available on the system. Similarly, Boot Loader
399 Specification Type #2 entries should be placed in the directory <literal>$(bootctl
400 -x)/EFI/Linux/</literal>.</para>
401
402 <para>Note that this option (similarly to the <option>--print-esp-path</option> option mentioned
403 above), is available independently from the boot loader used, i.e. also without
404 <command>systemd-boot</command> being installed.</para>
405
406 <xi:include href="version-info.xml" xpointer="v242"/></listitem>
407 </varlistentry>
408
409 <varlistentry>
410 <term><option>--print-loader-path</option></term>
411 <listitem><para>This option modifies the behaviour of <command>status</command>: it shows the
412 absolute path to the boot loader EFI binary used for the current boot if this information is
413 available. Note that no attempt is made to verify whether the binary still exists.</para>
414
415 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
416 </varlistentry>
417
418 <varlistentry>
419 <term><option>--print-stub-path</option></term>
420 <listitem><para>This option modifies the behaviour of <command>status</command>: it shows the
421 absolute path to the UKI/stub EFI binary used for the current boot if this information is
422 available. Note that no attempt is made to verify whether the binary still exists.</para>
423
424 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
425 </varlistentry>
426
427 <varlistentry>
428 <term><option>-R</option></term>
429 <term><option>--print-root-device</option></term>
430
431 <listitem><para>Print the path to the block device node backing the root file system of the local
432 OS. This prints a path such as <filename>/dev/nvme0n1p5</filename>. If the root file system is backed
433 by dm-crypt/LUKS or dm-verity the underlying block device is returned. If the root file system is
434 backed by multiple block devices (as supported by btrfs) the operation will fail. If the switch is
435 specified twice (i.e. <option>-RR</option>) and the discovered block device is a partition device the
436 "whole" block device it belongs to is determined and printed
437 (e.g. <filename>/dev/nvme0n1</filename>). If the root file system is <literal>tmpfs</literal> (or a
438 similar in-memory file system), the block device backing <filename>/usr/</filename> is returned if
439 applicable. If the root file system is a network file system (e.g. NFS, CIFS) the operation will
440 fail.</para>
441
442 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
443 </varlistentry>
444
445 <varlistentry>
446 <term><option>--print-efi-architecture</option></term>
447
448 <listitem><para>Print the EFI architecture string of the local firmware. This is useful to
449 generically format filenames such as <filename>boot<replaceable>x64</replaceable>.efi</filename> that
450 include the local firmware architecture in the name.</para>
451 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
452 </varlistentry>
453
454 <varlistentry>
455 <term><option>--variables=yes|no|auto</option></term>
456 <listitem><para>Controls whether to touch the firmware's boot loader list stored in EFI variables,
457 and other EFI variables. If not specified or set to <option>auto</option>, EFI variables will not
458 be modified when execution in a container runtime is detected. <option>yes</option> may be used to
459 explicit override the check.</para>
460
461 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
462 </varlistentry>
463
464 <varlistentry>
465 <term><option>--random-seed=yes|no</option></term>
466 <listitem><para>By default, the <command>install</command> command initializes a random seed file in
467 the ESP. When creating an image it may be desirable to disable that in order to avoid having the
468 same seed in all instances.</para>
469
470 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
471 </varlistentry>
472
473 <varlistentry>
474 <term><option>--graceful</option></term>
475 <listitem><para>Ignore failure when the EFI System Partition cannot be found, when EFI variables
476 cannot be written, or a different or newer boot loader is already installed. Currently only applies
477 to <command>is-installed</command>, <command>update</command>, <command>random-seed</command> and
478 <command>install</command> verbs. Since version v258, it is implicitly enabled when running inside a
479 chroot.</para>
480
481 <xi:include href="version-info.xml" xpointer="v244"/></listitem>
482 </varlistentry>
483
484 <varlistentry>
485 <term><option>-q</option></term>
486 <term><option>--quiet</option></term>
487
488 <listitem><para>Suppress printing of the results of various commands and also the hints about ESP
489 being unavailable.</para>
490
491 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
492 </varlistentry>
493
494 <varlistentry>
495 <term><option>--make-entry-directory=yes|no</option></term>
496 <listitem><para>Controls creation and deletion of the <ulink
497 url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink> Type #1 entry
498 directory on the file system containing resources such as kernel and initrd images during
499 <option>install</option> and <option>remove</option>, respectively. The directory is named after the
500 entry token, as specified with <option>--entry-token=</option> parameter described below, and is
501 placed immediately below the <varname>$BOOT</varname> root directory (i.e. beneath the file system
502 returned by the <option>--print-boot-path</option> option, see above). Defaults to
503 <literal>no</literal>.</para>
504
505 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
506 </varlistentry>
507
508 <varlistentry>
509 <term><option>--entry-token=</option></term>
510
511 <listitem><para>Controls how to name and identify boot loader entries for this OS
512 installation. Accepted during <option>install</option>, and takes one of <literal>auto</literal>,
513 <literal>machine-id</literal>, <literal>os-id</literal>, <literal>os-image-id</literal> or an
514 arbitrary string prefixed by <literal>literal:</literal> as argument.</para>
515
516 <para>If set to <option>machine-id</option> the entries are named after the machine ID of the running
517 system (e.g. <literal>b0e793a9baf14b5fa13ecbe84ff637ac</literal>). See
518 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
519 details about the machine ID concept and file.</para>
520
521 <para>If set to <option>os-id</option> the entries are named after the OS ID of the running system,
522 i.e. the <varname>ID=</varname> field of
523 <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> (e.g.
524 <literal>fedora</literal>). Similarly, if set to <option>os-image-id</option> the entries are named
525 after the OS image ID of the running system, i.e. the <varname>IMAGE_ID=</varname> field of
526 <filename>os-release</filename> (e.g. <literal>vendorx-cashier-system</literal>).</para>
527
528 <para>If set to <option>auto</option> (the default), the <filename>/etc/kernel/entry-token</filename>
529 file will be read if it exists, and the stored value used. Otherwise, if the local machine ID is
530 initialized it is used. Otherwise, <varname>IMAGE_ID=</varname> from <filename>os-release</filename>
531 will be used, if set. Otherwise, <varname>ID=</varname> from <filename>os-release</filename> will be
532 used, if set.</para>
533
534 <para>Unless set to <literal>machine-id</literal>, or when
535 <option>--make-entry-directory=yes</option> is used the selected token string is written to a file
536 <filename>/etc/kernel/entry-token</filename>, to ensure it will be used for future entries. This file
537 is also read by
538 <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
539 in order to identify under which name to generate boot loader entries for newly installed kernels, or
540 to determine the entry names for removing old ones.</para>
541
542 <para>Using the machine ID for naming the entries is generally preferable, however there are cases
543 where using the other identifiers is a good option. Specifically: if the identification data that the
544 machine ID entails shall not be stored on the (unencrypted) <varname>$BOOT</varname> partition, or if
545 the ID shall be generated on first boot and is not known when the entries are prepared. Note that
546 using the machine ID has the benefit that multiple parallel installations of the same OS can coexist
547 on the same medium, and they can update their boot loader entries independently. When using another
548 identifier (such as the OS ID or the OS image ID), parallel installations of the same OS would try to
549 use the same entry name. To support parallel installations, the installer must use a different entry
550 token when adding a second installation.</para>
551
552 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
553 </varlistentry>
554
555 <varlistentry>
556 <term><option>--all-architectures</option></term>
557 <listitem><para>Install binaries for all supported EFI architectures (this implies <option>--variables=no</option>).</para>
558
559 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
560 </varlistentry>
561
562 <varlistentry>
563 <term><option>--efi-boot-option-description=</option></term>
564 <listitem><para>Description of the entry added to the firmware's boot option list. Defaults to <literal>Linux
565 Boot Manager</literal>.</para>
566
567 <para>Using the default entry name <literal>Linux Boot Manager</literal> is generally preferable as only
568 one bootloader installed to a single ESP partition should be used to boot any number of OS installations
569 found on the various disks installed in the system. Specifically distributions should not use this flag
570 to install a branded entry in the boot option list. However, in situations with multiple disks, each with
571 their own ESP partition, it can be beneficial to make it easier to identify the bootloader being used in
572 the firmware's boot option menu.</para>
573
574 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
575 </varlistentry>
576
577 <varlistentry>
578 <term><option>--efi-boot-option-description-with-device=</option></term>
579 <listitem><para>Takes a boolean, defaults to false. Controls whether to append disk model information
580 to the firmware boot option item description (as configured with
581 <option>--efi-boot-option-description=</option> above). This is useful when installing multiple
582 operating systems on separate disks on the same system, as it ensures the firmware boot options are discernible
583 and give a hint which disk is booted into. Note that this uses hardware model information, and hence
584 might not be too useful in case multiple disks of an identical model are used.</para>
585
586 <xi:include href="version-info.xml" xpointer="v260"/></listitem>
587 </varlistentry>
588
589 <varlistentry>
590 <term><option>--dry-run</option></term>
591 <listitem><para>Dry run for <option>unlink</option> and <option>cleanup</option>.</para>
592
593 <para>In dry run mode, the unlink and cleanup operations only print the files that would get deleted
594 without actually deleting them.</para>
595
596 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
597 </varlistentry>
598
599 <varlistentry>
600 <term><option>--oldest</option></term>
601
602 <listitem><para>When used with <command>unlink</command>, selects the oldest installed boot loader
603 entry matching the boot entry token for removal (rather than passing an explicit entry ID). This is
604 useful for pruning older installed boot loader entries. Note that the currently booted entry is never
605 removed, nor is the last remaining one.</para>
606
607 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
608 </varlistentry>
609
610 <varlistentry>
611 <term><option>--keep-free=<replaceable>BYTES</replaceable></option></term>
612
613 <listitem><para>When used with <command>link</command>, controls the minimum amount of free space
614 (in bytes) that must remain on the target partition (ESP or XBOOTLDR) after the new entry has been
615 materialized. The operation fails if installing the entry would drop the free space below this
616 threshold. Accepts the usual size suffixes (K, M, G, …). If empty, the built-in default is
617 restored. If set to zero no minimum amount of free space is kept.</para>
618
619 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
620 </varlistentry>
621
622 <varlistentry>
623 <term><option>--entry-title=<replaceable>TITLE</replaceable></option></term>
624
625 <listitem><para>When used with <command>link</command>, specifies the title of the generated boot
626 loader entry (the <literal>title</literal> field of the Type #1 entry). If not specified, a title is
627 derived from the UKI's embedded metadata.</para>
628
629 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
630 </varlistentry>
631
632 <varlistentry>
633 <term><option>--entry-version=<replaceable>VERSION</replaceable></option></term>
634
635 <listitem><para>When used with <command>link</command>, specifies the version string of the
636 generated boot loader entry (the <literal>version</literal> field of the Type #1 entry). If not
637 specified, the version is derived from the UKI's embedded metadata. Used by the boot loader to sort
638 and select entries.</para>
639
640 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
641 </varlistentry>
642
643 <varlistentry>
644 <term><option>--entry-commit=<replaceable>NR</replaceable></option></term>
645
646 <listitem><para>When used with <command>link</command>, specifies the commit number for the generated
647 boot loader entry.</para>
648
649 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
650 </varlistentry>
651
652 <varlistentry>
653 <term><option>--extra=<replaceable>PATH</replaceable></option></term>
654 <term><option>-X <replaceable>PATH</replaceable></option></term>
655
656 <listitem><para>When used with <command>link</command>, registers an additional sidecar resource
657 file that shall be passed to the UKI at boot. This may be a system extension image
658 (<filename>*.sysext.raw</filename>), configuration extension image
659 (<filename>*.confext.raw</filename>), or credential file
660 (<filename>*.cred</filename>). The file is copied into the ESP/XBOOTLDR alongside the UKI and the
661 boot loader will load and pass it to the kernel via initrd. This option may be used multiple times
662 to register more than one extra resource. If passed an empty argument, all previously specified
663 extras are cleared.</para>
664
665 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
666 </varlistentry>
667
668 <varlistentry>
669 <term><option>--tries-left=<replaceable>NR</replaceable></option></term>
670
671 <listitem><para>When used with <command>link</command>, initializes the boot counting
672 <literal>tries-left</literal> counter for the generated entry. If set, the resulting boot entry file
673 is named according to the boot counting scheme described in the <ulink
674 url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot Assessment</ulink> documentation,
675 so that the boot loader decreases the counter on each attempted boot and eventually marks the entry
676 as bad. If not specified, boot counting is not enabled for the generated entry.</para>
677
678 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
679 </varlistentry>
680
681 <varlistentry>
682 <term><option>--secure-boot-auto-enroll=yes|no</option></term>
683 <term><option>--private-key=<replaceable>PATH/URI</replaceable></option></term>
684 <term><option>--private-key-source=<replaceable>TYPE</replaceable>[:<replaceable>NAME</replaceable>]</option></term>
685 <term><option>--certificate=<replaceable>PATH</replaceable></option></term>
686 <term><option>--certificate-source=<replaceable>TYPE</replaceable>[:<replaceable>NAME</replaceable>]</option></term>
687
688 <listitem><para>Configure the ESP for secure boot auto-enrollment when invoking the
689 <command>install</command> command. Takes a boolean argument. Disabled by default. Enabling this
690 option will make <command>bootctl</command> populate the ESP with signed <literal>PK</literal>,
691 <literal>KEK</literal> and <literal>db</literal> signature databases, each containing the given
692 certificate in <literal>DER</literal> format as their only entry. These secure boot signature
693 databases will be picked up and enrolled by <command>systemd-boot</command> if secure boot is in
694 setup mode and secure boot auto-enrollment is enabled.</para>
695
696 <para>When specifying this option, a certificate and private key have to be provided as well using
697 the <option>--certificate=</option> and <option>--private-key=</option> options. The
698 <option>--certificate=</option> option takes a path to a PEM encoded X.509 certificate or a URI
699 that's passed to the OpenSSL provider configured with <option>--certificate-source</option> which
700 takes one of <literal>file</literal> or <literal>provider</literal>, with the latter being followed
701 by a specific provider identifier, separated with a colon, e.g. <literal>provider:pkcs11</literal>.
702 The <option>--private-key=</option> option can take a path or a URI that will be passed to the
703 OpenSSL engine or provider, as specified by <option>--private-key-source=</option> as a
704 <literal>type:name</literal> tuple, such as <literal>engine:pkcs11</literal>. The specified OpenSSL
705 signing engine or provider will be used to sign the EFI signature lists.</para>
706
707 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
708 </varlistentry>
709
710 <xi:include href="standard-options.xml" xpointer="no-pager"/>
711 <xi:include href="standard-options.xml" xpointer="json" />
712 <xi:include href="standard-options.xml" xpointer="help"/>
713 <xi:include href="standard-options.xml" xpointer="version"/>
714 </variablelist>
715 </refsect1>
716
717 <refsect1>
718 <title>Signed .efi files</title>
719 <para><command>bootctl</command> <option>install</option> and <option>update</option> will look for a
720 <command>systemd-boot</command> file ending with the <literal>.efi.signed</literal> suffix first, and copy
721 that instead of the normal <literal>.efi</literal> file. This allows distributions or end-users to provide
722 signed images for UEFI SecureBoot.</para>
723 </refsect1>
724
725 <refsect1>
726 <title>Exit status</title>
727 <para>On success, 0 is returned, a non-zero failure code otherwise. <command>bootctl
728 --print-root-device</command> returns exit status 80 in case the root file system is not backed by single
729 block device, and other non-zero exit statuses on other errors.</para>
730 </refsect1>
731
732 <refsect1>
733 <title>Environment</title>
734 <para>If <varname>$SYSTEMD_RELAX_ESP_CHECKS=1</varname> is set the validation checks for the ESP are
735 relaxed, and the path specified with <option>--esp-path=</option> may refer to any kind of file system on
736 any kind of partition.</para>
737
738 <para>Similarly, <varname>$SYSTEMD_RELAX_XBOOTLDR_CHECKS=1</varname> turns off some validation checks for
739 the Extended Boot Loader partition.</para>
740 </refsect1>
741
742 <refsect1>
743 <title>Examples</title>
744
745 <example>
746 <title>Output from <command>status</command> and <command>list</command></title>
747
748 <programlisting>$ <command>bootctl status</command>
749 System:
750 Firmware: UEFI 2.40 (<replaceable>firmware-version</replaceable>) ← firmware vendor and version
751 Secure Boot: disabled (setup) ← Secure Boot status
752 TPM2 Support: yes
753 Boot into FW: supported ← does the firmware support booting into itself
754
755 Current Boot Loader: ← details about systemd-boot or another boot loader
756 Product: systemd-boot <replaceable>version</replaceable> implementing the <ulink
757 url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink>
758 Features: ✓ Boot counting
759 ✓ Menu timeout control
760 ✓ One-shot menu timeout control
761 ✓ Default entry control
762 ✓ One-shot entry control
763 ✓ Support for XBOOTLDR partition
764 ✓ Support for passing random seed to OS
765 ✓ Load drop-in drivers
766 ✓ Boot loader sets ESP information
767 ✓ Menu can be disabled
768 ESP: /dev/disk/by-partuuid/01234567-89ab-cdef-dead-beef00000000
769 File: └─/EFI/systemd/systemd-bootx64.efi
770
771 Random Seed: ← random seed used for entropy in early boot
772 Passed to OS: yes
773 System Token: set
774 Exists: yes
775
776 Available Boot Loaders on ESP:
777 ESP: /boot/efi (/dev/disk/by-partuuid/01234567-89ab-cdef-dead-beef00000000)
778 File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot 251
779 File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot 251
780
781 Boot Loaders Listed in EFI Variables:
782 Title: Linux Boot Manager
783 ID: 0x0001
784 Status: active, boot-order
785 Partition: /dev/disk/by-partuuid/…
786 File: └─/EFI/systemd/systemd-bootx64.efi
787
788 Title: Fedora
789 ID: 0x0000
790 Status: active, boot-order
791 Partition: /dev/disk/by-partuuid/…
792 File: └─/EFI/fedora/shimx64.efi
793
794 Title: Linux-Firmware-Updater
795 ID: 0x0002
796 Status: active, boot-order
797 Partition: /dev/disk/by-partuuid/…
798 File: └─/EFI/fedora/fwupdx64.efi
799
800 Boot Loader Entries:
801 $BOOT: /boot/efi (/dev/disk/by-partuuid/01234567-89ab-cdef-dead-beef00000000)
802
803 Default Boot Loader Entry:
804 type: Boot Loader Specification Type #1 (.conf)
805 title: Fedora Linux 36 (Workstation Edition)
806 id: …
807 source: /boot/efi/loader/entries/<replaceable>entry-token</replaceable>-<replaceable>kernel-version</replaceable>.conf
808 version: <replaceable>kernel-version</replaceable>
809 machine-id: …
810 linux: /<replaceable>entry-token</replaceable>/<replaceable>kernel-version</replaceable>/linux
811 initrd: /<replaceable>entry-token</replaceable>/<replaceable>kernel-version</replaceable>/initrd
812 options: root=…
813 </programlisting>
814
815 <programlisting>$ <command>bootctl list</command>
816 Boot Loader Entries:
817 type: Boot Loader Specification Type #1 (.conf)
818 title: Fedora Linux 36 (Workstation Edition) (default) (selected)
819 id: …
820 source: /boot/efi/loader/entries/<replaceable>entry-token</replaceable>-<replaceable>kernel-version</replaceable>.conf
821 version: <replaceable>kernel-version</replaceable>
822 machine-id: …
823 linux: /<replaceable>entry-token</replaceable>/<replaceable>kernel-version</replaceable>/linux
824 initrd: /<replaceable>entry-token</replaceable>/<replaceable>kernel-version</replaceable>/initrd
825 options: root=…
826
827 type: Boot Loader Specification Type #2 (.efi)
828 title: Fedora Linux 35 (Workstation Edition)
829 id: …
830 source: /boot/efi/EFI/Linux/fedora-<replaceable>kernel-version</replaceable>.efi
831 version: <replaceable>kernel-version</replaceable>
832 machine-id: …
833 linux: /EFI/Linux/fedora-<replaceable>kernel-version</replaceable>.efi
834 options: root=…
835
836 type: Automatic
837 title: Reboot Into Firmware Interface
838 id: auto-reboot-to-firmware-setup
839 source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f
840 </programlisting>
841
842 <para>In the listing, <literal>(default)</literal> specifies the entry that will be
843 used by default, and <literal>(selected)</literal> specifies the entry that was
844 selected the last time (i.e. is currently running).</para>
845 </example>
846 </refsect1>
847
848 <refsect1>
849 <title>See Also</title>
850 <para><simplelist type="inline">
851 <member><citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
852 <member><ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader Specification</ulink></member>
853 <member><ulink url="https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface</ulink></member>
854 <member><citerefentry><refentrytitle>systemd-boot-random-seed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
855 </simplelist></para>
856 </refsect1>
857 </refentry>