endeavouros

Last Friday, just before closing my laptop and enjoying my weekend I managed to break my EndeavourOS VM by accidentally shutting it down while it was still updating the kernel in another terminal session. It no longer booted as a result.

To fix it, I found a helpful blog post by Edmund Goodman which proved useful, albeit slightly different from my environment. Goodman was using GRUB and Ext4, whereas my environment is using Systemd-boot and Btrfs.

The repair process proved very similar but I decided to briefly document it just in case, if only to help a fellow Nerd in need:

  1. Boot with an EndeavourOS live image.

  2. Identify the boot and root partitions:

    root # lsblk -f
    

    For me it was:

    • /dev/sda1 (EFI boot);

    • /dev/sda2 (encrypted root).

  3. Decrypt the encrypted root partition:

    root # cryptsetup open /dev/sda2 luks_root
    
  4. Mount the decrypted root partition, and mount the EFI boot partition inside:

    root # mount /dev/mapper/luks_root -o subvol=/@ /mnt
    root # mount /dev/sda1 /mnt/efi
    
    Note
    I’m using Timeshift, which assumes a Btrfs root subvolume named /@. Your setup may vary.
  5. Chroot into the unbootable environment:

    root # arch-chroot /mnt
    
  6. Repair the environment:

    root (chroot) # rm /var/lib/pacman/db.lck
    root (chroot) # pacman -Syu
    root (chroot) # pacman -Syu linux linux-headers
    root (chroot) # reinstall-kernels
    
    Note
    Replace the above kernel and kernel headers with the ones you yourself use (.e.g. linux-lts, and linux-lts-headers). When in doubt, try the above default ones.
  7. Cleaning up:

    root (chroot) # exit
    root # umount /mnt/boot/
    root # umount /mnt/tmp/
    root # cryptsetup close luks_root
    

Then reboot, and remove the live image. This should help booting the system again.