Boot Management
Quick Reference
# systemd-boot
bootctl status # Check status
bootctl update # Update bootloader
bootctl install # Install bootloader
# mkinitcpio
mkinitcpio -P # Rebuild all presets
mkinitcpio -p linux # Rebuild specific preset
# GRUB
grub-mkconfig -o /boot/grub/grub.cfg
# EFI entries
efibootmgr # List boot entries
systemd-boot
Why systemd-boot?
-
Simple and minimal
-
Fast boot times
-
Native systemd integration
-
Easy configuration
-
Automatic kernel detection with kernel-install
Directory Structure
/boot/
├── EFI/
│ ├── systemd/
│ │ └── systemd-bootx64.efi
│ └── BOOT/
│ └── BOOTX64.EFI
├── loader/
│ ├── loader.conf # Main configuration
│ └── entries/
│ ├── arch.conf # Arch entry
│ └── arch-fallback.conf # Fallback entry
├── vmlinuz-linux # Kernel
├── initramfs-linux.img # Initramfs
├── initramfs-linux-fallback.img
└── intel-ucode.img # Microcode
loader.conf
# /boot/loader/loader.conf
default arch.conf
timeout 3
console-mode max
editor no
# Options:
# default - Default entry (filename without .conf)
# timeout - Menu timeout (0 = no menu)
# console-mode - keep, max, auto, or resolution
# editor - Allow editing (security: set to no)
Boot Entry Configuration
Basic Entry
# /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=UUID=YOUR-ROOT-UUID rw quiet
With AMD CPU
# /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=UUID=YOUR-ROOT-UUID rw quiet
Btrfs Root
# /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=UUID=YOUR-ROOT-UUID rootflags=subvol=@ rw quiet
LUKS Encryption
# /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=UUID=YOUR-LUKS-UUID:cryptroot root=/dev/mapper/cryptroot rw quiet
Multiple Kernels
# /boot/loader/entries/arch-lts.conf
title Arch Linux LTS
linux /vmlinuz-linux-lts
initrd /intel-ucode.img
initrd /initramfs-linux-lts.img
options root=UUID=YOUR-ROOT-UUID rw quiet
# /boot/loader/entries/arch-zen.conf
title Arch Linux Zen
linux /vmlinuz-linux-zen
initrd /intel-ucode.img
initrd /initramfs-linux-zen.img
options root=UUID=YOUR-ROOT-UUID rw quiet
Update and Maintenance
# Update bootloader (after systemd updates)
sudo bootctl update
# Check status
bootctl status
# List boot entries
bootctl list
# Set default entry
bootctl set-default arch.conf
# Set one-time boot
bootctl set-oneshot arch-lts.conf
Automatic Updates
# Enable systemd hook for bootloader updates
# Install systemd-boot-pacman-hook (AUR)
yay -S systemd-boot-pacman-hook
# Or create hook manually
# /etc/pacman.d/hooks/100-systemd-boot.hook
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd
[Action]
Description = Updating systemd-boot
When = PostTransaction
Exec = /usr/bin/bootctl update
GRUB
Installation
# Install packages
sudo pacman -S grub efibootmgr
# Install GRUB to EFI
sudo grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
# Generate configuration
sudo grub-mkconfig -o /boot/grub/grub.cfg
Configuration
# /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
# For NVIDIA
GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia_drm.modeset=1"
# Disable submenu
GRUB_DISABLE_SUBMENU=true
# Enable os-prober (for dual boot)
GRUB_DISABLE_OS_PROBER=false
# After changes
sudo grub-mkconfig -o /boot/grub/grub.cfg
mkinitcpio
Understanding Initramfs
The initramfs (initial RAM filesystem) is a temporary filesystem loaded into memory during boot:
-
Mounts root filesystem
-
Loads required kernel modules
-
Handles encrypted volumes
-
Prepares system for init
Configuration File
# /etc/mkinitcpio.conf
# Modules to load early
MODULES=()
# Binaries to include
BINARIES=()
# Files to include
FILES=()
# Hooks to run (order matters!)
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)
Essential Hooks
| Hook | Purpose |
|---|---|
base |
Essential utilities (switch_root, mount, etc.) |
udev |
Device manager |
autodetect |
Detect needed modules (smaller initramfs) |
microcode |
CPU microcode loading |
modconf |
Load modules from /etc/modprobe.d |
kms |
Kernel Mode Setting (early display) |
keyboard |
Keyboard support |
keymap |
Custom keyboard layout |
consolefont |
Console font |
block |
Block device support |
filesystems |
Filesystem support |
fsck |
Filesystem check |
encrypt |
LUKS encryption |
lvm2 |
LVM support |
btrfs |
Btrfs multi-device |
Common Configurations
Standard Setup
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)
LUKS Encryption
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt filesystems fsck)
LVM
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block lvm2 filesystems fsck)
LUKS on LVM
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt lvm2 filesystems fsck)
EFI Boot Manager
Unified Kernel Images
What is UKI?
Unified Kernel Image combines: * Kernel * Initramfs * Kernel command line * Microcode
Into a single EFI executable.
Create UKI with mkinitcpio
# /etc/mkinitcpio.d/linux.preset
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"
ALL_microcode=(/boot/*-ucode.img)
PRESETS=('default' 'fallback')
default_uki="/boot/EFI/Linux/arch-linux.efi"
default_options="--splash /usr/share/systemd/bootctl/splash-arch.bmp"
fallback_uki="/boot/EFI/Linux/arch-linux-fallback.efi"
fallback_options="-S autodetect"
Troubleshooting
Boot to Recovery
# Boot from Arch USB
# Mount system
mount /dev/nvme0n1p2 /mnt
mount /dev/nvme0n1p1 /mnt/boot
# Chroot
arch-chroot /mnt
# Fix issues...
Rebuild Bootloader
# systemd-boot
bootctl install
# GRUB
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
Quick Reference
# systemd-boot
bootctl install # Install
bootctl update # Update
bootctl status # Status
bootctl list # List entries
# mkinitcpio
mkinitcpio -P # Rebuild all
mkinitcpio -p linux # Rebuild linux preset
# GRUB
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
# EFI
efibootmgr # List entries
efibootmgr -o 0001,0002 # Set boot order
efibootmgr -b 0003 -B # Delete entry
# Config files
/boot/loader/loader.conf # systemd-boot main config
/boot/loader/entries/*.conf # Boot entries
/etc/mkinitcpio.conf # Initramfs config
/etc/default/grub # GRUB config