- bookworm 252.30-1~deb12u2
- bookworm-backports 254.16-1~bpo12+1
- testing 256.7-3
- unstable 257~rc1-4
SYSTEMD-BOOT(7) | systemd-boot | SYSTEMD-BOOT(7) |
NAME¶
systemd-boot, sd-boot - A simple UEFI boot manager
DESCRIPTION¶
systemd-boot (short: sd-boot) is a simple UEFI boot manager. It provides a textual menu to select the entry to boot and an editor for the kernel command line. systemd-boot supports systems with UEFI firmware only.
systemd-boot loads boot entry information from the EFI system partition (ESP), usually mounted at /efi/, /boot/, or /boot/efi/ during OS runtime, as well as from the Extended Boot Loader partition (XBOOTLDR) if it exists (usually mounted to /boot/). Configuration file fragments, kernels, initrds and other EFI images to boot generally need to reside on the ESP or the Extended Boot Loader partition. Linux kernels must be built with CONFIG_EFI_STUB to be able to be directly executed as an EFI image. During boot systemd-boot automatically assembles a list of boot entries from the following sources:
systemd-boot supports the following features:
bootctl(1) may be used from a running system to locate the ESP and the Extended Boot Loader Partition, list available entries, and install systemd-boot itself.
kernel-install(8) may be used to copy kernel images onto the ESP or the Extended Boot Loader Partition and to generate description files compliant with the Boot Loader Specification.
systemd-stub(7) may be used as UEFI boot stub for executed kernels, which is useful to show graphical boot splashes before transitioning into the Linux world. It is also capable of automatically picking up auxiliary credential files (for boot parameterization) and system extension images, as companion files to the booted kernel images.
KEY BINDINGS¶
The following keys may be used in the boot menu:
↑ (Up), ↓ (Down), j, k, PageUp, PageDown, Home, End
↵ (Enter), → (Right)
d
e
+, t
-, T
r
R
p
h, ?, F1
f
For compatibility with the keybindings of several firmware implementations this operation may also be reached with F2, F10, Del and Esc.
The following keys may be pressed during bootup or in the boot menu to directly boot a specific entry:
l
w
a
s
1, 2, 3, 4, 5, 6, 7, 8, 9
The boot menu is shown when a non-zero menu timeout has been configured. If the menu timeout has been set to zero, it is sufficient to press any key — before the boot loader initializes — to bring up the boot menu, except for the keys listed immediately above as they directly boot into the selected boot menu item. Note that depending on the firmware implementation the time window where key presses are accepted before the boot loader initializes might be short. If the window is missed, reboot and try again, possibly pressing a suitable key (e.g. the space bar) continuously; on most systems it should be possible to hit the time window after a few attempts. To avoid this problem, consider setting a non-zero timeout, thus showing the boot menu unconditionally. Some desktop environments might offer an option to directly boot into the boot menu, to avoid the problem altogether. Alternatively, use the command line systemctl reboot --boot-loader-menu=0 from the shell.
In the editor, most keys simply insert themselves, but the following keys may be used to perform additional actions:
← (Left), → (Right), Home, End
Esc, Ctrl+c
Ctrl+k
Ctrl+w, Alt+Backspace
Ctrl+Del, Alt+d
↵ (Enter)
Note that unless configured otherwise in the UEFI firmware, systemd-boot will use the US keyboard layout, so key labels might not match for keys like +/-.
FILES¶
The files systemd-boot processes generally reside on the UEFI ESP which is usually mounted to /efi/, /boot/ or /boot/efi/ during OS runtime. It also processes files on the Extended Boot Loader partition which is typically mounted to /boot/, if it exists.
systemd-boot reads runtime configuration such as the boot timeout and default entry from /loader/loader.conf on the ESP (in combination with data read from EFI variables). See loader.conf(5).
Boot entry description files following the Boot Loader Specification[1] are read from /loader/entries/ on the ESP and the Extended Boot Loader partition.
Unified kernel boot entries following the Boot Loader Specification[1] are read from /EFI/Linux/ on the ESP and the Extended Boot Loader partition.
Optionally, a random seed for early boot entropy pool provisioning is stored in /loader/random-seed in the ESP.
During initialization, sd-boot automatically loads all driver files placed in the /EFI/systemd/drivers/ directory of the ESP. The files placed there must have an extension of the EFI architecture ID followed by .efi (e.g. for x86-64 this means a suffix of x64.efi). This may be used to automatically load file system drivers and similar, to extend the native firmware support.
Enrollment of Secure Boot variables can be performed manually or automatically if files are available under /loader/keys/NAME/{db,KEK,PK}.auth, NAME being the display name for the set of variables in the menu. If one of the sets is named auto then it might be enrolled automatically depending on whether "secure-boot-enroll" is set to force or not.
EFI VARIABLES¶
The following EFI variables are defined, set and read by systemd-boot, under the vendor UUID "4a67b082-0a4c-41cf-b6c7-440b29bb8c4f", for communication between the boot loader and the OS:
LoaderBootCountPath
LoaderConfigTimeout, LoaderConfigTimeoutOneShot
LoaderDevicePartUUID
LoaderEntries
LoaderEntryDefault, LoaderEntryOneShot
LoaderEntrySelected
LoaderFeatures
LoaderFirmwareInfo, LoaderFirmwareType
LoaderImageIdentifier
LoaderInfo
LoaderTimeExecUSec, LoaderTimeInitUSec, LoaderTimeMenuUsec
LoaderSystemToken
Many of these variables are defined by the Boot Loader Interface[2].
BOOT COUNTING¶
systemd-boot implements a simple boot counting mechanism on top of the Boot Loader Specification[1], for automatic and unattended fallback to older kernel versions/boot loader entries when a specific entry continuously fails. Any boot loader entry file and unified kernel image file that contains a "+" followed by one or two numbers (if two they need to be separated by a "-"), before the .conf or .efi suffix is subject to boot counting: the first of the two numbers ('tries left') is decreased by one on every boot attempt, the second of the two numbers ('tries done') is increased by one (if 'tries done' is absent it is considered equivalent to 0). Depending on the current value of these two counters the boot entry is considered to be in one of three states:
Generally, when new entries are added to the boot loader, they first start out in 'indeterminate' state, i.e. with a 'tries left' counter greater than zero. The boot entry remains in this state until either it managed to complete a full boot successfully at least once (in which case it will be in 'good' state) — or the 'tries left' counter reaches zero (in which case it will be in 'bad' state).
Example: let's say a boot loader entry file foo.conf is set up for 3 boot tries. The installer will hence create it under the name foo+3.conf. On first boot, the boot loader will rename it to foo+2-1.conf. If that boot does not complete successfully, the boot loader will rename it to foo+1-2.conf on the following boot. If that fails too, it will finally be renamed foo+0-3.conf by the boot loader on next boot, after which it will be considered 'bad'. If the boot succeeds however the entry file will be renamed to foo.conf by the OS, so that it is considered 'good' from then on.
The boot menu takes the 'tries left' counter into account when sorting the menu entries: entries in 'bad' state are ordered at the beginning of the list, and entries in 'good' or 'indeterminate' at the end. The user can freely choose to boot any entry of the menu, including those already marked 'bad'. If the menu entry to boot is automatically determined, this means that 'good' or 'indeterminate' entries are generally preferred (as the bottom item of the menu is the one booted by default), and 'bad' entries will only be considered if there are no 'good' or 'indeterminate' entries left.
The kernel-install(8) kernel install framework optionally sets the initial 'tries left' counter to the value specified in /etc/kernel/tries when a boot loader entry is first created.
USING SYSTEMD-BOOT IN VIRTUAL MACHINES¶
When using qemu with OVMF (UEFI Firmware for virtual machines) the -kernel switch works not only for linux kernels, but for any EFI binary, including sd-boot and unified linux kernels. Example command line for loading systemd-boot on x64:
qemu-system-x86_64 [ ... ] -kernel /usr/lib/systemd/boot/efi/systemd-bootx64.efi
systemd-boot will detect that it was started directly instead of being loaded from ESP and will search for the ESP in that case, taking into account boot order information from the hypervisor (if available).
SEE ALSO¶
bootctl(1), loader.conf(5), systemd-bless-boot.service(8), systemd-boot-random-seed.service(8), kernel-install(8), systemd-stub(7), Boot Loader Specification[1], Boot Loader Interface[2]
NOTES¶
- 1.
- Boot Loader Specification
- 2.
- Boot Loader Interface
- 3.
- Automatic Boot Assessment
systemd 254 |