My Arch Linux emergency procedure

Today, for the first time after a system update, I had an Arch system that wouldn’t boot properly anymore. This has not happened in about 10 years — I probably overlooked an error during the update process and rebooted without noticing.

My take-away: Do not do system updates unattended.

This was the error message:

Loading Linux linux
Error: premature end of file /vmlinuz-linux.
Loading initial ramdisk
Error: you need to load the kernel first
Press a key to continue

Basically the kernel and initramfs were missing.

I took this incident as an opportunity to write down my personal emergency procedure.

Context: I use a LUKS-encrypted Btrfs file system.

Follow these steps after booting from an Arch Linux ISO:

# load german kernel keymap so I won't go crazy
loadkeys de-latin1 # omit if you are not german

# open LUKS device
cryptsetup luksOpen /dev/nvme0n1p2 cryptlvm # enter passphrase

# mount btrfs subvols
mount /dev/mapper/cryptlvm -o subvol=@ /mnt
mount /dev/mapper/cryptlvm -o subvol=@home /mnt/home

# mount boot drive
mount /dev/nvme0n1p1 /mnt/boot

# make virtual file systems available in future chroot
cd /mnt
mount -t proc /proc proc/
mount -t sysfs /sys sys/
mount --rbind /dev dev/

# enter chroot env, leave with `exit`
arch-chroot /mnt

Now I’d continue repairing the system. In this particular case I reinstalled the Linux kernels (I’m using “linux-lts” and regular “linux” as fallback). After “exit” and “shutdown -r now” the system booted properly.


Posted

in

,

by

Tags: