Updating the systemd-boot loader in /boot
February 18, 2021
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:
To check the current version of the bootloader and see other information about it, run the following command:
You will see something like the following:
Pay attention to the Product line – it contains the version, in the screenshot it is 246.6-1.
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.
Using the command
pacman -Ss systemd
you can see the current version of the systemd package. In the screenshot, it is 247.2-1. That is, you can upgrade to a newer version.
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.
- How to change the default operating system in Arch Linux (for UEFI and systemd-boot) (100%)
- How to completely uninstall a package along with dependencies on Arch Linux (as well as BlackArch and Manjaro) (52.4%)
- Analogue of the --force option in pacman (52.4%)
- How to downgrade to a previous kernel in Arch Linux (52.4%)
- How to view package information in Arch Linux (BlackArch, Manjaro) (52.4%)
- How to install a web server (Apache, PHP, MySQL, phpMyAdmin) on Linux Mint, Ubuntu and Debian (RANDOM - 50%)