How to update the systemd-boot loader in /boot
December 28, 2021
Update /boot
During the installation of Arch Linux on modern computers with UEFI (BIOS replacement), we create a small partition on the disk with a mount point in /boot into which we install the boot loader using bootctl. This bootloader is systemd-boot, which is part of systemd. Over time, systemd can be updated like any other Arch Linux package. This does not automatically update the loader in /boot. For this reason, if you have been using the same Arch Linux installation for a long time, then your boot loader in /boot may be out of date.
This article will show you how to view version and supported features, and how to update systemd-boot in /boot on Arch Linux (as well as BlackArch and Manjaro).
What is systemd-boot
systemd-boot (short for sd-boot) is a simple UEFI boot manager. It provides a graphical menu for selecting an entry to boot and a kernel command line editor. Systemd-boot only supports systems with UEFI firmware.
systemd-boot loads boot record information from the EFI system partition (ESP), usually mounted in /efi/, /boot/, or /boot/efi/ during OS startup, and from an extended bootloader partition if it exists (usually mounted in /boot/). Fragments of the configuration file, kernels, initrds, and other EFI images to boot should usually reside on an ESP or extended boot loader partition. Linux kernels must be built with CONFIG_EFI_STUB so that they can be directly run as an EFI image. At boot time, systemd-boot automatically collects a list of boot records from the following sources:
- Boot entries defined using the loader specification descriptor files located in /loader/entries/ on ESP and in the advanced loader section. They usually describe Linux kernel images with associated initrd images, but can also describe arbitrary other EFI binaries.
- Unified kernel images as per bootloader specification as EFI executable binaries in /EFI/Linux/ on ESP and in the extended bootloader section.
- Microsoft Windows EFI Boot Manager, if installed.
- Apple MacOS X Boot Manager, if installed.
- EFI Shell binary, if installed
- Reboot to the option UEFI Firmware Configuration, if supported.
systemd-boot supports the following features:
- Major changes to the boot manager configuration (such as setting a timeout, choosing a default boot record, etc.) can be made directly from the boot loader UI at boot time as well as at run time with EFI variables.
- The boot manager integrates with the systemctl command to implement features such as systemctl reboot --boot-loader-entry=… (to reboot to a specific boot menu item, eg “reboot to Windows”) and systemctl reboot --boot-loader-menu=… (to reboot in the bootloader menu) by implementing the bootloader interface.
- The EFI variable, set by the bootloader, tells the OS about the ESP used at boot time. It is then used to automatically mount the correct ESP partition in /efi/ or /boot/ while the OS is running.
- The Boot Manager provides information about the boot time taken by the UEFI firmware using the Boot Loader Interface. This information can be displayed using systemd-analyze
- Boot Manager implements load counting and automatic rollback to older workload records in case of failure.
- The boot manager additionally reads a random seed from the ESP, concatenates it with the “system token” stored in the constant EFI variable, and extracts a random seed for the OS to use as an initialization of the entropy pool, providing a full pool of entropy during early boot.
How to update the bootloader in /boot
The bootctl program can check EFI firmware and bootloader status, list and manage available bootloaders and bootloader entries, and install, update, or remove systemd-boot on the current system.
To check if your system uses systemd-boot, run the command:
bootctl is-installed
To check the current version of the bootloader and see other information about it, run the following command:
bootctl
You will see something like the following:
Pay attention to the Product line - it contains the version, in the screenshot it is 249.5-3.
Also look at the Features list - if you installed your system a long time ago, then some features may be disabled - an update will fix this.
For example, the Features list in the screenshot:
✓ Boot counting ✓ Menu timeout control ✓ One-shot menu timeout control ✓ Default entry control ✓ One-shot entry control ✓ Support for XBOOTLDR partition ✓ Support for passing random seed to OS ✗ Load drop-in drivers ✓ Boot loader sets ESP information
Most of the list is marked with green checkmarks (✓), but one item (in your case, these may be other items) is marked with a red cross (✗). This means that systemd supports all of the listed functions, including those marked with a cross, but the currently installed bootloader does not support what is marked with a cross. In order for the bootloader to start supporting the entire list, it needs to be updated.
Using the command
pacman -Ss systemd
you can see the current version of the systemd package. In the screenshot, it is 250-1. That is, you can upgrade to a newer version.
To check the current version of systemd, you may prefer the following command:
pacman -Si systemd
Updating the systemd-boot loader in /boot is performed with the following command:
sudo bootctl update
You need to restart your computer for the changes to take effect.
Related articles:
- How to change the default operating system in Arch Linux (for UEFI and systemd-boot) (100%)
- How to check if a computer is using BIOS or UEFI; GRUB or systemd-boot bootloader; MBR or GPT partition table (97.2%)
- UEFI does not see installed Linux (SOLVED) (67.2%)
- How to downgrade to a previous kernel version in Arch Linux. How to install and switch to linux-lts (62.9%)
- How to check if your computer supports TPM 2.0 on Linux (58.6%)
- Linux does not see Wi-Fi on Intel chipset. “firmware: failed to load iwlwifi” error (SOLVED) (RANDOM - 50%)