Skip to main content

Boot Loader

systemd-boot

Install

systemd-boot comes with systemd already, so no additional packages need to be installed

bootctl install

Configure

Loader

/boot/loader/loader.conf

default       arch
timeout       3
auto-entries  1
auto-firmware 1
console-mode  keep

Boot entry

/boot/loader/entries/arch.conf

title	Arch Linux
linux	/vmlinuz-linux
initrd	/amd-ucode.img
initrd	/initramfs-linux.img
options	root=/dev/mapper/vg0-lv_root rw rootflags=subvol=@ quiet splash amdgpu.dpm=0

Fallback

/boot/loader/entries/arch-fallback.conf

title	Arch Linux (fallback initramfs)
linux	/vmlinuz-linux
initrd	/amd-ucode.img
initrd	/initramfs-linux-fallback.img
options	root=/dev/mapper/vg0-lv_root rw rootflags=subvol=root quiet splash amdgpu.dpm=0

rEFInd

Install

pacman -S refind
refind-install

Configure

/boot/refind_linux.conf

"Boot using default options"     "root=/dev/mapper/vg0-lv_root rw rootflags=subvol=@ amdgpu.dpm=0 add_efi_memmap initrd=amd-ucode.img initrd=initramfs-%v.img"
"Boot using fallback initramfs"  "root=/dev/mapper/vg0-lv_root rw rootflags=subvol=@ amdgpu.dpm=0 add_efi_memmap initrd=amd-ucode.img initrd=initramfs-%v-fallback.img"
"Boot to terminal"               "root=/dev/mapper/vg0-lv_root rw rootflags=subvol=@ amdgpu.dpm=0 add_efi_memmap initrd=amd-ucode.img initrd=initramfs-%v.img systemd.unit=multi-user.target"

EFISTUB

Install

pacman -S efibootmgr

Configure

WARNING: efibootmgr can only be run as root!

efibootmgr cannot overwrite existing boot entries and will disregard the creation of a boot entry if one with the same label already exists. If this is the case, delete the boot entry you want to replace first by listing current boot entries with

efibootmgr

and then delete the boot entry with

efibootmgr -Bb XXXX # Your corresponding bootnum

To create a new entry efibootmgr needs to know the disk and partition where your bootloader resides. This is typically the ESP (EFI System Partition).

In this example the ESP is the first partition of /dev/nvme0n1. Kernel parameters are part of the --unicode argument. The root partition needs to be passed as a persistent block device name (further reading: Arch Wiki: Persistent block device naming). You can get the persistent block device name with the blkid command, i.e. to get the UUID of the second partition on /dev/nvme0n1:

blkid -s UUID -o value /dev/nvme0n1p2

You can also supply a different identifier like PARTUUID.

NOTE: If you use LVM, you can supply device mapper paths as these already are persistent.

For ease of scriptability, save the values to environment variables:

ASSUMPTIONS: rootfs is on /dev/nvme0n1, there is a swap partition, and the file system is btrfs.

export ROOT=$(blkid -s UUID -o value /dev/nvme0n1p2)
export SWAP=$(blkid -s UUID -o value /dev/nvme0n1p3)
export CMDL=$(echo 'root=UUID='$ROOT' resume=UUID='$SWAP' rw quiet splash rootflags=subvol=@ add_efi_memmap initrd=\\amd-ucode.img initrd=\\initramfs-linux.img')

Then create the boot entry:

efibootmgr --create --label "Arch Linux" --disk /dev/nvme0n1 --part 1 --loader /vmlinuz-linux --unicode $CMDL --verbose

When using a unified kernel image create the boot entry like this:

efibootmgr --create --label "Arch Linux" --disk /dev/nvme0n1 --part 1 --loader "EFI\Arch\linux-signed.efi" --verbose

GRUB2

Install

Install GRUB for either target x86_64-efi or i386-pc. Install to a drive, not a partition!

pacman -S grub
grub-install --target=x86_64-efi /dev/nvme0n1

Configure

Edit /etc/default/grub with desired options and run

grub-mkconfig -o /boot/grub/grub.cfg