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

Installation

# Install to EFI partition
sudo bootctl install

# Verify
bootctl status

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

Get UUID

# Get root partition UUID
blkid -s UUID -o value /dev/nvme0n1p2

# Or
lsblk -f

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

NVIDIA Configuration

# Add nvidia_drm.modeset=1 for Wayland
options root=UUID=xxx rw quiet nvidia_drm.modeset=1

Fallback Entry

# /boot/loader/entries/arch-fallback.conf
title   Arch Linux (fallback)
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux-fallback.img
options root=UUID=YOUR-ROOT-UUID rw

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

Dual Boot

# Install os-prober
sudo pacman -S os-prober

# Enable in config
# GRUB_DISABLE_OS_PROBER=false

# Mount Windows EFI if separate
# Regenerate config
sudo grub-mkconfig -o /boot/grub/grub.cfg

GRUB Theme

# Install theme (example: grub-theme-vimix)
yay -S grub-theme-vimix

# Configure
# /etc/default/grub
GRUB_THEME="/usr/share/grub/themes/Vimix/theme.txt"

# Regenerate
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)

Btrfs RAID

MODULES=(btrfs)
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)

NVIDIA (Proprietary)

# Add nvidia modules
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

# Remove kms hook if using early KMS
HOOKS=(base udev autodetect microcode modconf keyboard keymap consolefont block filesystems fsck)

Regenerate Initramfs

# Rebuild all presets
sudo mkinitcpio -P

# Rebuild specific kernel
sudo mkinitcpio -p linux
sudo mkinitcpio -p linux-lts

# Generate to custom path
sudo mkinitcpio -g /boot/initramfs-custom.img

Presets

# /etc/mkinitcpio.d/linux.preset
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"

PRESETS=('default' 'fallback')

default_image="/boot/initramfs-linux.img"

fallback_image="/boot/initramfs-linux-fallback.img"
fallback_options="-S autodetect"

EFI Boot Manager

View Boot Entries

# List all entries
efibootmgr

# Verbose output
efibootmgr -v

Manage Boot Order

# Change boot order
sudo efibootmgr -o 0001,0002,0000

# Set next boot
sudo efibootmgr -n 0002

Create Boot Entry

# Add entry manually
sudo efibootmgr --create --disk /dev/nvme0n1 --part 1 \
    --label "Arch Linux" --loader /EFI/systemd/systemd-bootx64.efi

Delete Boot Entry

# Delete entry by number
sudo efibootmgr -b 0003 -B

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"

Kernel Command Line for UKI

# /etc/kernel/cmdline
root=UUID=YOUR-ROOT-UUID rw quiet

Rebuild UKI

sudo mkinitcpio -P

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

Rebuild Initramfs

# After chroot
mkinitcpio -P

Fix Missing Kernel

# In chroot
pacman -S linux linux-headers
mkinitcpio -P

Debug Boot Issues

# Remove quiet from kernel options
# Add debug options
options root=UUID=xxx rw debug systemd.log_level=debug

# View boot log after successful boot
journalctl -b -p warning
dmesg | less

Emergency Shell

# If boot drops to emergency shell
# Check what failed
systemctl --failed
journalctl -xb

# Common fixes
fsck /dev/nvme0n1p2       # Filesystem check
mount -o remount,rw /     # Remount root writable

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