systemd-boot, formerly called gummiboot, is a simple UEFI boot manager capable of booting Linux and Windows in EFI mode.
As of systemd 220, systemd-boot has been included with systemd (accessible via the bootctl command). If sys-apps/systemd has been installed on the system, then sys-boot/systemd-boot does not need to be installed.
The installation of systemd-boot consists of the following steps:
- Emerging the package (not necessary if sys-apps/systemd has been emerged).
- Preparing the EFI System Partition.
- Installing the systemd-boot UEFI boot manager.
For the moment, systemd-boot is marked as unstable (~) so it must to be added to /etc/portage/package.accept_keywords:
mkdir -p /etc/portage/package.accept_keywords
echo "sys-boot/systemd-boot" >> /etc/portage/package.accept_keywords/systemd-boot
Next, install the sys-boot/systemd-boot package:
emerge --ask sys-boot/systemd-boot
EFI system partition
Make sure that an EFI System Partition (ESP) is available on the system. This is a GPT partition on the disk that is marked as EF00 (EFI System partition).
For instance, to create an ESP using sys-apps/gptfdisk:
Command (? for help): n Partition number (1-128, default 1): 1 First sector: (enter desired start sector and size, 100 MB should be plenty) Command (? for help): t Partition number (1-2): 1 Hex code or GUID (L to show codes, Enter = 8300): EF00 Command (? for help): w
The filesystem on this partition must be formatted as a FAT variant. FAT32 is recommended:
mkfs.vfat -F 32 /dev/sda1
Mount this location on the system (/boot/efi works just fine) and create the /boot/efi/EFI/boot location.
mkdir -p /boot/efi
mount /dev/sda1 /boot/efi
UEFI boot manager
The systemd-boot application makes the installation, which only needs to be performed once (unless a new version of systemd-boot needs to be installed), fairly simple. Verify the following:
- The system is booted with EFI to start with (either from a EFI compatible media, or through any other UEFI boot manager) as it will otherwise fail to install.
- The EFI variable file system (efivars) is mounted read/write:
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
Then perform the install itself:
bootctl --path /boot/efi install
The installation will install the proper EFI files so that the EFI-capable system will boot the systemd-boot bootloader.
A boot loader entry needs to be created for each operating system.
Next to the boot loader entries, a small default configuration file can be created as well.
Default configuration entries
In /boot/efi/loader a file called loader.conf can be created which contains at most the following two entries:
- specifying which operating system entry to boot by default.
- specifying the number of seconds to wait before the default boot entry is loaded.
For instance, this would look like so:
default gentoo timeout 3
The name of the default entry is the name of the configuration entry file, as created in the next section, without the .conf suffix.
Operating system configuration entries
These entry files need to be located in the ESP, in the /boot/efi/loader/entries location. So if the EFI system partition is mounted at /boot/efi then this is at /boot/efi/loader/entries. The following is an example configuration entry named "gentoo":
title Gentoo Linux linux /vmlinuz options root=/dev/sda3
The linux entry points to an EFI stub Linux kernel file, installed in the ESP.
Although the EFI stub kernel configuration works fine, it has the downside that
- New Linux kernels are somewhat risky to test out because only a single kernel is booted.
- Adding boot options requires rebuilding the Linux kernel.
With systemd-boot, additional entries can be configured for new Linux kernel tests, and additional boot options are easy to add to the configuration entry file, or even at boot time.
One-time boot loader options
In order to boot the system with a particular boot option, in the systemd-boot screen, press e to edit the options.
The changes made in the systemd-boot screen are not preserved!
- https://www.phoronix.com/scan.php?page=news_item&px=systemd-Gummiboot-Boot-Loader - Gummiboot UEFI Boot Loader To Be Added To Systemd.
- https://phoronix.com/scan.php?page=news_item&px=Gummiboot-Is-Dead - Gummiboot Is Dead.