Install systemd-boot (x86_64)
This page is for x86_64 PCs. On a Raspberry Pi, skip it and go to Configure the Pi firmware instead.
Either way, Build the initramfs comes first. If you have not done that yet, go back and do it now.
UEFI firmware boots an EFI program from the EFI System Partition. systemd-boot is that program: it is part of systemd, already installed, and it is a menu and nothing else – no modules, no scripting, no second config language to learn.
Install it
bootctl install
That copies the EFI binary onto the ESP mounted at /boot and
registers it with the firmware as a boot entry, which is the step
that makes the machine choose it without being asked.
Configure the menu
default arch.conf timeout 3 console-mode keep editor no
timeout 3 gives you three seconds to interrupt; a headless machine
could use 0, but a short pause is worth having the first time you
boot. editor no matters more than it looks: with the editor
enabled, anyone at the keyboard can append init=/bin/sh to the
kernel command line and get a root shell without a password.
Write the boot entry
This is the step that tells the kernel where its root is. Generate it rather than typing the UUID by hand:
cat > /boot/loader/entries/arch.conf <<EOF title Arch Linux linux /vmlinuz-linux initrd /initramfs-linux.img options root=UUID=$(findmnt -no UUID /) rootflags=subvol=@ rw EOF cat /boot/loader/entries/arch.conf
findmnt -no UUID / reads the UUID of the filesystem currently
mounted at /, which inside the chroot is the one you are
installing onto. rootflags=subvol=@ is the part specific to this
book’s layout: without it the kernel mounts the top of the btrfs
filesystem, finds the subvolumes sitting there as directories, and
fails to boot.
If you encrypted the disk
The root device is now the unlocked mapper device, and the initramfs needs to be told which partition to unlock. Use the LUKS partition’s UUID – not the filesystem UUID above:
cat > /boot/loader/entries/arch.conf <<EOF title Arch Linux linux /vmlinuz-linux initrd /initramfs-linux.img options rd.luks.name=$(blkid -s UUID -o value /dev/nvme0n1p2)=cryptroot root=/dev/mapper/cryptroot rootflags=subvol=@ rw EOF cat /boot/loader/entries/arch.conf
Substitute your own root partition for /dev/nvme0n1p2. The two
UUIDs are easy to confuse: blkid on the partition gives the LUKS
container’s UUID, while findmnt gives the UUID of the btrfs
filesystem inside it.
Check it
bootctl list
It should show your entry as the default. If it reports no entries,
/boot is not the ESP, and nothing you do later will make the
machine boot.