systemd-boot

systemd-boot, previously called gummiboot (German for "rubber dinghy"), is an easy-to-configure UEFI boot manager. It provides a textual menu to select the boot entry and an editor for the kernel command line. It is included with systemd.

Note that systemd-boot can only start EFI executables (e.g., the Linux kernel EFISTUB, UEFI shell, GRUB, or the Windows Boot Manager.)

Installation

Installing the EFI boot manager

To install systemd-boot, first make sure that the system is booted into UEFI mode and UEFI variables are accessible. This can be verified by running efivar --list or, if efivar is not installed, by running ls /sys/firmware/efi/efivars (if the directory exists, the system is booted into UEFI mode.)

Throughout, esp will denote the ESP mountpoint, e.g. or . This assumes that you have chrooted to the system's mount point.

Use to install systemd-boot to the ESP:

# bootctl install

This will copy the systemd-boot EFI boot manager to the ESP: on an x64 architecture system will be copied to esp/EFI/systemd/systemd-bootx64.efi and esp/EFI/BOOT/BOOTX64.EFI, and systemd-boot will be set as the default EFI application.

To conclude the installation, configure systemd-boot.

Installation using XBOOTLDR

A separate /boot partition of type "Linux extended boot" (XBOOTLDR) can be created to keep the kernel and initramfs separate from the ESP. This is particularly helpful to dual boot with Windows with an existing ESP that is too small.

Prepare an ESP as usual and create another partition for XBOOTLDR on the same physical drive. The XBOOTLDR partition must have a partition type GUID of . The size of the XBOOTLDR partition should be large enough to accommodate all of the kernels you are going to install.

During install, mount the ESP to and the XBOOTLDR partition to .

Once in chroot, use the command:

# bootctl --esp-path=/efi --boot-path=/boot install

To conclude the installation, configure systemd-boot.

Updating the EFI boot manager

Whenever there is a new version of systemd-boot, the EFI boot manager can be optionally reinstalled by the user. This can be done manually or automatically; the two approaches are described thereafter.

Manual update

Use bootctl to update systemd-boot:

# bootctl update

Automatic update

To update systemd-boot automatically, either use a systemd service or a pacman hook. The two methods are described below.

systemd service

As of version 250, systemd ships with systemd-boot-update.service. Enabling this service will update the bootloader upon the next boot.

pacman hook

The package adds a pacman hook which is executed every time systemd is upgraded.

Rather than installing systemd-boot-pacman-hook, you may prefer to manually place the following file in /etc/pacman.d/hooks/:

If you have Secure Boot enabled, you may want to add a pacman hook to automatically re-sign the kernel and bootloader upon every upgrade of the respective packages:

Make sure that the parameters point to your signing key and certificate. For better understanding of this hook, consult and .

Configuration

Loader configuration

The loader configuration is stored in the file . See loader.conf(5) §OPTIONS for details.

A loader configuration example is provided below:

Tip:
  • systemd-boot does not accept tabs for indentation, use spaces instead.
  • default and timeout can be changed in the boot menu itself and changes will be stored as EFI variables LoaderEntryDefault and LoaderConfigTimeout, overriding these options.
  • bootctl set-default "" and bootctl set-timeout "" can be used to clear the EFI variables overriding the default and timeout options, respectively.
  • A basic loader configuration file is located at /usr/share/systemd/bootctl/loader.conf.
  • If the bootloader (during the entry selection) appears distorted/uses the wrong resolution you can try to set the console-mode to auto (uses heuristics to select the best resolution), keep (keeps the firmware provided resolution) or 2 (tries to select the first non-UEFI-standard resolution).

Adding loaders

systemd-boot will search for boot menu items in and additionally in if using XBOOTLDR. Note that entries in esp can only use files (e.g. kernels, initramfs, images, etc.) in esp. Similarly, entries in can only use files in .

The possible options are:

  • – operating system name. Required.
  • – kernel version, shown only when multiple entries with same title exist. Optional.
  • – machine identifier from /etc/machine-id, shown only when multiple entries with same title and version exist. Optional.
  • – EFI program to start, relative to your ESP (esp); e.g. . Either this parameter or (see below) is required.
  • options – space-separated command line options to pass to the EFI program or kernel parameters. Optional, but you will need at least if booting Linux. This parameter can be omitted if the root partition is assigned the correct Root Partition Type GUID as defined in Discoverable Partitions Specification and if the mkinitcpio hook is present.

For Linux boot, you can also use instead of . Or in addition to options. The syntax is:

  • or followed by the relative path of the corresponding files in the ESP; e.g. ; this will be automatically translated into and – this syntax is only supported for convenience and has no differences in function.
Note: If options is present in a boot entry and Secure Boot is disabled, the value of options will override any .cmdline string embedded in the EFI image that is specified by efi or linux (see Unified kernel image#Preparing a unified kernel image). With Secure Boot, however, options (and any edits made to the kernel command line in the bootloader UI) will be ignored, and only the embedded .cmdline will be used.

An example of loader files launching Arch from a volume labeled and loading Intel CPU microcode is:

systemd-boot will automatically check at boot time for Windows Boot Manager at the location , UEFI shell and EFI Default Loader , as well as specially prepared kernel files found in . When detected, corresponding entries with titles , and auto-efi-default, respectively, will be generated. These entries do not require manual loader configuration. However, it does not auto-detect other EFI applications (unlike rEFInd), so for booting the Linux kernel, manual configuration entries must be created.

EFI Shells or other EFI applications

In case you installed an EFI shell with the package edk2-shell, systemd-boot will auto-detect and create a new entry if the EFI file is placed in . To perform this and example command after installing the package would be:

# cp /usr/share/edk2-shell/x64/Shell.efi /boot/shellx64.efi

Otherwise in case you installed other EFI applications into the ESP, you can use the following snippets.

Boot from another disk

systemd-boot cannot launch binaries from partitions other than the ESP or the XBOOTLDR partition, but it can run an external script to do so.

First we need to install edk2-shell (will be the interpreter to be used) and using the EFI shell (as explained above) we can use the map command to take notes of the FS alias (ex: HD0a66666a2) and the full path of the destination EFI file (ex: EFI\Microsoft\Boot\Bootmgfw.efi).

Then using the exit command we can boot back into Linux where we can create the new entry. To do so we need to first create in the root of the esp mount point a .nsh filename with the FS alias, a colon and the EFI path, here an example:

Once we created this file we can proceed to create the loader entry to run the script:

Its important that the efi path matches where the edk2-shell has been copied in the esp partition, and the last argument of options matches the .nsh filename in the root of the esp partition. Also note that the edk2-shell EFI file can be moved to avoid the entry auto-creation of systemd-boot.

Booting into EFI Firmware Setup

systemd-boot will automatically add an entry to boot into UEFI Firmware Setup if your device's firmware supports rebooting into setup from the OS.

Support hibernation

See Suspend and hibernate.

Kernel parameters editor with password protection

Alternatively you can install which supports password basic configuration option. Use to generate a value for this option.

Install systemd-boot-password with the following command:

# sbpctl install esp

With enabled editor you will be prompted for your password before you can edit kernel parameters.

Tips and tricks

Keys inside the boot menu

See for the available key bindings inside the boot menu.

Choosing next boot

The boot manager is integrated with the systemctl command, allowing you to choose what option you want to boot after a reboot. For example, suppose you have built a custom kernel and created an entry file esp/loader/entries/arch-custom.conf to boot into it, you can just launch

$ systemctl reboot --boot-loader-entry=arch-custom.conf

and your system will reboot into that entry maintaining the default option intact for subsequent boots. To see a list of possible entries pass the option.

If you want to boot into the firmware of your motherboard directly, then you can use this command:

$ systemctl reboot --firmware-setup

Unified kernel images

Unified kernel images in are automatically sourced by systemd-boot, and do not need an entry in . (Note that unified kernel images must have a extension to be identified by systemd-boot.)

Grml on ESP

Tip: A PKGBUILD is available: grml-systemd-bootAUR.

Grml is a small live system with a collection of software for system administration and rescue.

In order to install Grml on the ESP, we only need to copy the kernel , the initramfs , and the squashed image grml64-small.squashfs from the iso file to the ESP. To do so, first download grml64-small.iso and mount the file (the mountpoint is henceforth denoted mnt); the kernel and initramfs are located in , and the squashed image resides in .

Next, create a directory for Grml in your ESP,

# mkdir -p esp/grml

and copy the above-mentioned files in there:

# cp mnt/boot/grml64small/vmlinuz esp/grml
# cp mnt/boot/grml64small/initrd.img esp/grml
# cp mnt/live/grml64-small/grml64-small.squashfs esp/grml

In the last step, create an entry for the systemd-boot loader: In create a file with the following content:

For an overview of the available boot options, consult the cheatcode for Grml.

systemd-boot on BIOS systems

If you need a bootloader for BIOS systems that follows The Boot Loader Specification, then systemd-boot can be pressed into service on BIOS systems. The Clover boot loader supports booting from BIOS systems and provides a simulated EFI environment.

Troubleshooting

Installing after booting in BIOS mode

If booted in BIOS mode, you can still install systemd-boot, however this process requires you to tell firmware to launch systemd-boot's EFI file at boot, usually via two ways:

  • you have a working EFI Shell somewhere else.
  • your firmware interface provides a way of properly setting the EFI file that needs to be loaded at boot time.

If you can do it, the installation is easier: go into your EFI Shell or your firmware configuration interface and change your machine's default EFI file to esp/EFI/systemd/systemd-bootx64.efi.

Manual entry using efibootmgr

If the bootctl install command failed, you can create a EFI boot entry manually using :

# efibootmgr --create --disk /dev/sdX --part Y --loader "\EFI\systemd\systemd-bootx64.efi" --label "Linux Boot Manager" --unicode

where is the EFI system partition.

Manual entry using bcdedit from Windows

If for any reason you need to create an EFI boot entry from Windows, you can use the following commands from an Administrator prompt:

> bcdedit /copy {bootmgr} /d "Linux Boot Manager"
> bcdedit /set {guid} path \EFI\systemd\systemd-bootx64.efi

Replace with the id returned by the first command. You can also set it as the default entry using

> bcdedit /default {guid}

See UEFI#Windows changes boot order.

gollark: ONLY for purposes, mind you.
gollark: <@277565426551226370> Yes, it is sending h repeatedly for purposes.
gollark: <:apioform:812013353165389875> <:cryoapioform:812015306662477864>
gollark: <@805534998660775986> <@509849474647064576>
gollark: <@805534998660775986>

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.