Boot Loader
systemd-boot
Install
comes with systemd-bootsystemd
already, so no additional packages need to be installed.systemdsystemd-boot
ATTENTION: ThisBy default, systemd-boot
will install
itself to either of the well-known ESP locations, e.g. systemd-boot/efi
, /boot
, or /boot/efi
. If your ESP is located somewhere else pass the localtion with the --esp-path
parameter.
bootctl install
Configure
ATTENTION: In this example the ESP is mounted at /systemd-boot. Changehas accordingly!two configs:
Loader
- one for the loader
itself,itself located at/boot/$YOUR_ESP/loader/loader.conf - one for each individual boot entry located at
$YOUR_ESP/loader/entries/*.conf
Configuration
Loader
NOTE: For a full list of options and their explanation refer to man loader.conf(5)
(alternatively: Web Version)
An example loader configuration could look something like this:
default arch
timeout 3
auto-entries 1
auto-firmware 1
console-mode keep
Key | Value | Description |
---|---|---|
default |
file name | The default selected entry (e.g. arch.conf ) |
timeout |
number | Seconds until the default entry is booted (e.g. 3 ) |
auto-entries |
boolean | Show or hide other boot entries found by scanning the boot partition |
auto-firmware |
boolean | Show or hide "Reboot into firmware" entry |
console-mode |
number/string | Resolution of the console (e.g. keep to keep the resolution selected by firmware) |
Boot entry
NOTE: For a full list of options and their explanation refer to the Boot Loader Specification. All paths are relative to the path of your ESP.
Bootloader entry for the main kernel, located at /boot/$YOUR_ESP/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
Fallback
Key | Value | Description |
---|---|---|
title |
string | The name of the entry |
linux |
path | Location of the Linux kernel (relative to ESP) |
initrd |
path | Location of the Linux initrd image (relative to ESP) |
options |
string | Kernel command line parameters |
When using a unified kernel image (e.g. as an
executable) you will need to supply the /boot/loader/entries/arch-fallback.conf.efiefi
key instead of initrd
.
NOTE: Unified kernel images have most things needed to boot baked in, so a loader entry really only consists of two lines.
title Arch Linux
(fallback initramfs)
linuxefi /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux-fallback.img
options root=/dev/mapper/vg0-lv_root rw rootflags=subvol=root quiet splashEFI/Arch/linux.efi
rEFInd
Install
pacman -S refind
refind-install
Configure
ATTENTION: In this example the ESP is mounted at /boot
. Change accordingly!
Default options for every entry, located at /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 to load the kernel directly:
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