1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"bootctl" conditional='HAVE_GNU_EFI'
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <productname>systemd
</productname>
14 <refentrytitle>bootctl
</refentrytitle>
15 <manvolnum>1</manvolnum>
19 <refname>bootctl
</refname>
20 <refpurpose>Control EFI firmware boot settings and manage boot loader
</refpurpose>
25 <command>bootctl
</command>
26 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
27 <arg choice=
"req">COMMAND
</arg>
32 <title>Description
</title>
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>
41 <title>Generic EFI Firmware/Boot Loader Commands
</title>
43 <para>These commands are available on any EFI system, regardless of the boot loader used.
</para>
47 <term><option>status
</option></term>
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>
54 <para>See the example below for details of the output.
</para>
59 <term><option>reboot-to-firmware
</option> <optional><replaceable>BOOL
</replaceable></optional></term>
61 <listitem><para>Query or set the
"Reboot-Into-Firmware-Setup" flag of the EFI firmware. Takes a
62 boolean argument which controls whether to show the firmware setup on next system reboot. If the
63 argument is omitted shows the current status of the flag, or whether the flag is supported. This
64 controls the same flag as
<command>systemctl reboot --firmware-setup
</command>, but is more low-level
65 and allows setting the flag independently from actually requesting a reboot.
</para>
67 <para>Hint: use
<command>systemctl reboot --firmware-setup
</command> to reboot into firmware setup
69 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
70 for details.
</para></listitem>
74 <term><option>systemd-efi-options
</option> <optional><replaceable>STRING
</replaceable></optional></term>
76 <listitem><para>When called without the optional argument, prints the current value of the
77 <literal>SystemdOptions
</literal> EFI variable. When called with an argument, sets the variable to
79 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry> for the
80 meaning of that variable.
</para></listitem>
86 <title>Boot Loader Specification Commands
</title>
88 <para>These commands are available for all boot loaders that implement the
<ulink
89 url=
"https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification
</ulink> and/or the
<ulink
90 url=
"https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface
</ulink>, such as
91 <command>systemd-boot
</command>.
</para>
95 <term><option>list
</option></term>
97 <listitem><para>Shows all available boot loader entries implementing the
<ulink
98 url=
"https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification
</ulink>, as well as any
99 other entries discovered or automatically generated by a boot loader implementing the
<ulink
100 url=
"https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface
</ulink>.
101 JSON output may be requested with
<option>--json=
</option>.
</para>
103 <para>See the example below for details of the output.
</para>
108 <term><option>set-default
</option> <replaceable>ID
</replaceable></term>
109 <term><option>set-oneshot
</option> <replaceable>ID
</replaceable></term>
111 <listitem><para>Sets the default boot loader entry. Takes a single boot loader entry ID string or a glob
112 pattern as argument. The
<option>set-oneshot
</option> command will set the default entry only for the next boot,
113 the
<option>set-default
</option> will set it persistently for all future boots.
</para>
115 <para><command>bootctl list
</command> can be used to list available boot loader entries and their
118 <para>In addition, the boot loader entry ID may be specified as one of:
<option>@default
</option>,
119 <option>@oneshot
</option> or
<option>@current
</option>, which correspond to the current default boot loader
120 entry for all future boots, the current default boot loader entry for the next boot, and the currently booted
121 boot loader entry. These special IDs are resolved to the current values of the EFI variables
122 <varname>LoaderEntryDefault
</varname>,
<varname>LoaderEntryOneShot
</varname> and
<varname>LoaderEntrySelected
</varname>,
123 see
<ulink url=
"https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification
</ulink> for details.
124 These special IDs are primarily useful as a quick way to persistently make the currently booted boot loader
125 entry the default choice, or to upgrade the default boot loader entry for the next boot to the default boot
126 loader entry for all future boots, but may be used for other operations too.
</para>
128 <para>If set to
<option>@saved
</option> the chosen entry will be saved as an EFI variable
129 on every boot and automatically selected the next time the boot loader starts.
</para>
131 <para>When an empty string (
"") is specified as the ID, then the corresponding EFI variable will be
134 <para>Hint: use
<command>systemctl reboot --boot-loader-entry=
<replaceable>ID
</replaceable></command>
135 to reboot into a specific boot entry and
136 <command>systemctl reboot --boot-loader-menu=
<replaceable>timeout
</replaceable></command>
137 to reboot into the boot loader menu once. See
138 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
139 for details.
</para></listitem>
143 <term><option>set-timeout
</option> <replaceable>TIMEOUT
</replaceable></term>
144 <term><option>set-timeout-oneshot
</option> <replaceable>TIMEOUT
</replaceable></term>
146 <listitem><para>Sets the boot loader menu timeout in seconds. The
<option>set-timeout-oneshot
</option>
147 command will set the timeout only for the next boot. See
148 <citerefentry><refentrytitle>systemd.time
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
149 for details about the syntax of time spans.
</para>
151 <para>If this is set to
<option>menu-hidden
</option> or
<option>0</option> no menu is shown and
152 the default entry will be booted immediately, while setting this to
<option>menu-force
</option>
153 disables the timeout while always showing the menu. When an empty string (
"") is specified the
154 bootloader will revert to its default menu timeout.
</para></listitem>
160 <title><command>systemd-boot
</command> Commands
</title>
162 <para>These commands manage the
<command>systemd-boot
</command> EFI boot loader, and do not work in
163 conjunction with other boot loaders.
</para>
167 <term><option>install
</option></term>
169 <listitem><para>Installs
<command>systemd-boot
</command> into the EFI system partition. A copy of
170 <command>systemd-boot
</command> will be stored as the EFI default/fallback loader at
171 <filename><replaceable>ESP
</replaceable>/EFI/BOOT/BOOT*.EFI
</filename>. The boot loader is then added
172 to the top of the firmware's boot loader list.
</para></listitem>
176 <term><option>update
</option></term>
178 <listitem><para>Updates all installed versions of
179 <citerefentry><refentrytitle>systemd-boot
</refentrytitle><manvolnum>7</manvolnum></citerefentry>, if the
180 available version is newer than the version installed in the EFI system partition. This also includes the EFI
181 default/fallback loader at
<filename><replaceable>ESP
</replaceable>/EFI/BOOT/BOOT*.EFI
</filename>. The boot
182 loader is then added to end of the firmware's boot loader list if missing.
</para></listitem>
186 <term><option>remove
</option></term>
188 <listitem><para>Removes all installed versions of
<command>systemd-boot
</command> from the EFI system partition
189 and the firmware's boot loader list.
</para></listitem>
193 <term><option>is-installed
</option></term>
195 <listitem><para>Checks whether
<command>systemd-boot
</command> is installed in the ESP. Note that a
196 single ESP might host multiple boot loaders; this hence checks whether
197 <command>systemd-boot
</command> is one (of possibly many) installed boot loaders — and neither
198 whether it is the default nor whether it is registered in any EFI variables.
</para></listitem>
202 <term><option>random-seed
</option></term>
204 <listitem><para>Generates a random seed and stores it in the EFI System Partition, for use by the
205 <command>systemd-boot
</command> boot loader. Also, generates a random 'system token' and stores it
206 persistently as an EFI variable, if one has not been set before. If the boot loader finds the random
207 seed in the ESP and the system token in the EFI variable it will derive a random seed to pass to the
208 OS and a new seed to store in the ESP from the combination of both. The random seed passed to the OS
209 is credited to the kernel's entropy pool by the system manager during early boot, and permits
210 userspace to boot up with an entropy pool fully initialized very early on. Also see
211 <citerefentry><refentrytitle>systemd-boot-random-seed.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
</para>
213 <para>See
<ulink url=
"https://systemd.io/RANDOM_SEEDS">Random Seeds
</ulink> for further
214 information.
</para></listitem>
221 <title>Options
</title>
222 <para>The following options are understood:
</para>
226 <term><option>--esp-path=
</option></term>
227 <listitem><para>Path to the EFI System Partition (ESP). If not specified,
<filename>/efi/
</filename>,
228 <filename>/boot/
</filename>, and
<filename>/boot/efi/
</filename> are checked in turn. It is
229 recommended to mount the ESP to
<filename>/efi/
</filename>, if possible.
</para></listitem>
233 <term><option>--boot-path=
</option></term>
234 <listitem><para>Path to the Extended Boot Loader partition, as defined in the
<ulink
235 url=
"https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification
</ulink>. If not
236 specified,
<filename>/boot/
</filename> is checked. It is recommended to mount the Extended Boot
237 Loader partition to
<filename>/boot/
</filename>, if possible.
</para></listitem>
241 <term><option>--root=
<replaceable>root
</replaceable></option></term>
242 <listitem><para>Takes a directory path as an argument. All
243 paths will be prefixed with the given alternate
244 <replaceable>root
</replaceable> path, including config search
245 paths.
</para></listitem>
249 <term><option>--image=
<replaceable>image
</replaceable></option></term>
251 <listitem><para>Takes a path to a disk image file or block device node. If specified, all operations
252 are applied to file system in the indicated disk image. This option is similar to
253 <option>--root=
</option>, but operates on file systems stored in disk images or block devices. The
254 disk image should either contain just a file system or a set of file systems within a GPT partition
255 table, following the
<ulink url=
"https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions
256 Specification
</ulink>. For further information on supported disk images, see
257 <citerefentry><refentrytitle>systemd-nspawn
</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
258 switch of the same name.
</para></listitem>
262 <term><option>--install-source=
</option></term>
263 <listitem><para>When installing binaries with
<option>--root=
</option> or
264 <option>--image=
</option>, selects where to source them from. Takes one of
<literal>auto
</literal>
265 (the default),
<literal>image
</literal> or
<literal>host
</literal>. With
<literal>auto
</literal>
266 binaries will be picked from the specified directory or image, and if not found they will be picked
267 from the host. With
<literal>image
</literal> or
<literal>host
</literal> no fallback search will be
268 performed if the binaries are not found in the selected source.
</para></listitem>
272 <term><option>-p
</option></term>
273 <term><option>--print-esp-path
</option></term>
274 <listitem><para>This option modifies the behaviour of
<command>status
</command>. Only prints the path
275 to the EFI System Partition (ESP) to standard output and exits.
</para></listitem>
279 <term><option>-x
</option></term>
280 <term><option>--print-boot-path
</option></term>
281 <listitem><para>This option modifies the behaviour of
<command>status
</command>. Only prints the path
282 to the Extended Boot Loader partition if it exists, and the path to the ESP otherwise to standard
283 output and exit. This command is useful to determine where to place boot loader entries, as they are
284 preferably placed in the Extended Boot Loader partition if it exists and in the ESP otherwise.
</para>
286 <para>Boot Loader Specification Type #
1 entries should generally be placed in the directory
287 <literal>$(bootctl -x)/loader/entries/
</literal>. Existence of that directory may also be used as
288 indication that boot loader entry support is available on the system. Similarly, Boot Loader
289 Specification Type #
2 entries should be placed in the directory
<literal>$(bootctl
290 -x)/EFI/Linux/
</literal>.
</para>
292 <para>Note that this option (similarly to the
<option>--print-booth-path
</option> option mentioned
293 above), is available independently from the boot loader used, i.e. also without
294 <command>systemd-boot
</command> being installed.
</para></listitem>
298 <term><option>--no-variables
</option></term>
299 <listitem><para>Do not touch the firmware's boot loader list stored in EFI variables.
</para></listitem>
303 <term><option>--graceful
</option></term>
304 <listitem><para>Ignore failure when the EFI System Partition cannot be found, when EFI variables
305 cannot be written, or a different or newer boot loader is already installed. Currently only applies
306 to
<command>is-installed
</command>,
<command>update
</command>, and
<command>random-seed
</command>
307 verbs.
</para></listitem>
311 <term><option>-q
</option></term>
312 <term><option>--quiet
</option></term>
314 <listitem><para>Suppress printing of the results of various commands and also the hints about ESP
315 being unavailable.
</para></listitem>
319 <term><option>--make-entry-directory=yes|no
</option></term>
320 <listitem><para>Controls creation and deletion of the
<ulink
321 url=
"https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification
</ulink> Type #
1 entry
322 directory on the file system containing resources such as kernel and initrd images during
323 <option>install
</option> and
<option>remove
</option>, respectively. The directory is named after the
324 entry token, as specified with
<option>--entry-token=
</option> parameter described below, and is
325 placed immediately below the
<varname>$BOOT
</varname> root directory (i.e. beneath the file system
326 returned by the
<option>--print-boot-path
</option> option, see above). Defaults to
327 <literal>no
</literal>.
</para></listitem>
331 <term><option>--entry-token=
</option></term>
333 <listitem><para>Controls how to name and identify boot loader entries for this OS
334 installation. Accepted during
<option>install
</option>, and takes one of
<literal>auto
</literal>,
335 <literal>machine-id
</literal>,
<literal>os-id
</literal>,
<literal>os-image-id
</literal> or an
336 arbitrary string prefixed by
<literal>literal:
</literal> as argument.
</para>
338 <para>If set to
<option>machine-id
</option> the entries are named after the machine ID of the running
339 system (e.g.
<literal>b0e793a9baf14b5fa13ecbe84ff637ac
</literal>). See
340 <citerefentry><refentrytitle>machine-id
</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
341 details about the machine ID concept and file.
</para>
343 <para>If set to
<option>os-id
</option> the entries are named after the OS ID of the running system,
344 i.e. the
<varname>ID=
</varname> field of
345 <citerefentry><refentrytitle>os-release
</refentrytitle><manvolnum>5</manvolnum></citerefentry> (e.g.
346 <literal>fedora
</literal>). Similarly, if set to
<option>os-image-id
</option> the entries are named
347 after the OS image ID of the running system, i.e. the
<varname>IMAGE_ID=
</varname> field of
348 <filename>os-release
</filename> (e.g.
<literal>vendorx-cashier-system
</literal>).
</para>
350 <para>If set to
<option>auto
</option> (the default), the
<filename>/etc/kernel/entry-token
</filename>
351 file will be read if it exists, and the stored value used. Otherwise if the local machine ID is
352 initialized it is used. Otherwise
<varname>IMAGE_ID=
</varname> from
<filename>os-release
</filename>
353 will be used, if set. Otherwise,
<varname>ID=
</varname> from
<filename>os-release
</filename> will be
356 <para>Unless set to
<literal>machine-id
</literal>, or when
357 <option>--make-entry-directory=yes
</option> is used the selected token string is written to a file
358 <filename>/etc/kernel/entry-token
</filename>, to ensure it will be used for future entries. This file
360 <citerefentry><refentrytitle>kernel-install
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
361 in order to identify under which name to generate boot loader entries for newly installed kernels, or
362 to determine the entry names for removing old ones.
</para>
364 <para>Using the machine ID for naming the entries is generally preferable, however there are cases
365 where using the other identifiers is a good option. Specifically: if the identification data that the
366 machine ID entails shall not be stored on the (unencrypted)
<varname>$BOOT
</varname> partition, or if
367 the ID shall be generated on first boot and is not known when the entries are prepared. Note that
368 using the machine ID has the benefit that multiple parallel installations of the same OS can coexist
369 on the same medium, and they can update their boot loader entries independently. When using another
370 identifier (such as the OS ID or the OS image ID), parallel installations of the same OS would try to
371 use the same entry name. To support parallel installations, the installer must use a different entry
372 token when adding a second installation.
</para></listitem>
376 <term><option>--all-architectures
</option></term>
377 <listitem><para>Install binaries for all supported EFI architectures (this implies
<option>--no-variables
</option>).
</para></listitem>
381 <term><option>--efi-boot-option-description=
</option></term>
382 <listitem><para>Description of the entry added to the firmware's boot option list. Defaults to
<literal>Linux
383 Boot Manager
</literal>.
</para>
385 <para>Using the default entry name
<literal>Linux Boot Manager
</literal> is generally preferable as only
386 one bootloader installed to a single ESP partition should be used to boot any number of OS installations
387 found on the various disks installed in the system. Specifically distributions should not use this flag
388 to install a branded entry in the boot option list. However in situations with multiple disks, each with
389 their own ESP partition, it can be beneficial to make it easier to identify the bootloader being used in
390 the firmware's boot option menu.
</para></listitem>
393 <xi:include href=
"standard-options.xml" xpointer=
"no-pager"/>
394 <xi:include href=
"standard-options.xml" xpointer=
"json" />
395 <xi:include href=
"standard-options.xml" xpointer=
"help"/>
396 <xi:include href=
"standard-options.xml" xpointer=
"version"/>
401 <title>Signed .efi files
</title>
402 <para><command>bootctl
</command> <option>install
</option> and
<option>update
</option> will look for a
403 <command>systemd-boot
</command> file ending with the
<literal>.efi.signed
</literal> suffix first, and copy
404 that instead of the normal
<literal>.efi
</literal> file. This allows distributions or end-users to provide
405 signed images for UEFI SecureBoot.
</para>
409 <title>Exit status
</title>
410 <para>On success,
0 is returned, a non-zero failure code otherwise.
</para>
414 <title>Environment
</title>
415 <para>If
<varname>$SYSTEMD_RELAX_ESP_CHECKS=
1</varname> is set the validation checks for the ESP are
416 relaxed, and the path specified with
<option>--esp-path=
</option> may refer to any kind of file system on
417 any kind of partition.
</para>
419 <para>Similarly,
<varname>$SYSTEMD_RELAX_XBOOTLDR_CHECKS=
1</varname> turns off some validation checks for
420 the Extended Boot Loader partition.
</para>
424 <title>Examples
</title>
427 <title>Output from
<command>status
</command> and
<command>list
</command></title>
429 <programlisting>$
<command>bootctl status
</command>
431 Firmware: UEFI
2.40 (
<replaceable>firmware-version
</replaceable>) ← firmware vendor and version
432 Secure Boot: disabled (setup) ← secure boot status
434 Boot into FW: supported ← does the firmware support booting into itself
436 Current Boot Loader: ← details about sd-boot or another boot loader
437 Product: systemd-boot
<replaceable>version
</replaceable> implementing the
<ulink
438 url=
"https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface
</ulink>
439 Features: ✓ Boot counting
440 ✓ Menu timeout control
441 ✓ One-shot menu timeout control
442 ✓ Default entry control
443 ✓ One-shot entry control
444 ✓ Support for XBOOTLDR partition
445 ✓ Support for passing random seed to OS
446 ✓ Load drop-in drivers
447 ✓ Boot loader sets ESP information
448 ESP: /dev/disk/by-partuuid/
01234567-
89ab-cdef-dead-beef00000000
449 File: └─/EFI/systemd/systemd-bootx64.efi
451 Random Seed: ← random seed used for entropy in early boot
456 Available Boot Loaders on ESP:
457 ESP: /boot/efi (/dev/disk/by-partuuid/
01234567-
89ab-cdef-dead-beef00000000)
458 File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot
251
459 File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot
251
461 Boot Loaders Listed in EFI Variables:
462 Title: Linux Boot Manager
464 Status: active, boot-order
465 Partition: /dev/disk/by-partuuid/…
466 File: └─/EFI/systemd/systemd-bootx64.efi
470 Status: active, boot-order
471 Partition: /dev/disk/by-partuuid/…
472 File: └─/EFI/fedora/shimx64.efi
474 Title: Linux-Firmware-Updater
476 Status: active, boot-order
477 Partition: /dev/disk/by-partuuid/…
478 File: └─/EFI/fedora/fwupdx64.efi
481 $BOOT: /boot/efi (/dev/disk/by-partuuid/
01234567-
89ab-cdef-dead-beef00000000)
483 Default Boot Loader Entry:
484 type: Boot Loader Specification Type #
1 (.conf)
485 title: Fedora Linux
36 (Workstation Edition)
487 source: /boot/efi/loader/entries/
<replaceable>entry-token
</replaceable>-
<replaceable>kernel-version
</replaceable>.conf
488 version:
<replaceable>kernel-version
</replaceable>
490 linux: /
<replaceable>entry-token
</replaceable>/
<replaceable>kernel-version
</replaceable>/linux
491 initrd: /
<replaceable>entry-token
</replaceable>/
<replaceable>kernel-version
</replaceable>/initrd
495 <programlisting>$
<command>bootctl list
</command>
497 type: Boot Loader Specification Type #
1 (.conf)
498 title: Fedora Linux
36 (Workstation Edition) (default) (selected)
500 source: /boot/efi/loader/entries/
<replaceable>entry-token
</replaceable>-
<replaceable>kernel-version
</replaceable>.conf
501 version:
<replaceable>kernel-version
</replaceable>
503 linux: /
<replaceable>entry-token
</replaceable>/
<replaceable>kernel-version
</replaceable>/linux
504 initrd: /
<replaceable>entry-token
</replaceable>/
<replaceable>kernel-version
</replaceable>/initrd
507 type: Boot Loader Specification Type #
2 (.efi)
508 title: Fedora Linux
35 (Workstation Edition)
510 source: /boot/efi/EFI/Linux/fedora-
<replaceable>kernel-version
</replaceable>.efi
511 version:
<replaceable>kernel-version
</replaceable>
513 linux: /EFI/Linux/fedora-
<replaceable>kernel-version
</replaceable>.efi
517 title: Reboot Into Firmware Interface
518 id: auto-reboot-to-firmware-setup
519 source: /sys/firmware/efi/efivars/LoaderEntries-
4a67b082-
0a4c-
41cf-b6c7-
440b29bb8c4f
522 <para>In the listing,
<literal>(default)
</literal> specifies the entry that will be
523 used by default, and
<literal>(selected)
</literal> specifies the entry that was
524 selected the last time (i.e. is currently running).
</para>
529 <title>See Also
</title>
531 <citerefentry><refentrytitle>systemd-boot
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
532 <ulink url=
"https://uapi-group.org/specifications/specs/boot_loader_specification">Boot Loader Specification
</ulink>,
533 <ulink url=
"https://systemd.io/BOOT_LOADER_INTERFACE">Boot Loader Interface
</ulink>,
534 <citerefentry><refentrytitle>systemd-boot-random-seed.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>