I had a scare yesterday. I was running pacman -Syu when I powered off my
laptop by mistake before updates could finish installing.
With my luck, I’d
interrupted the installation of a linux kernel update, so when I tried booting
up again, I was greeted with this message:

Loading Linux linux ...
error: file `/boot/vmlinuz-linux` not found.
Loading initial ramdisk ...
error: you need to load the kernel first.
I couldn’t progress further; I was returned to the main GRUB menu.
After a cursory internet search, I used my Arch liveUSB to boot into my computer
in order to fix this. I ran lsblk to check that my partitions were intact
(thank heavens). I wanted to enter chroot, so I tried mounting my partitions:
# mount /dev/sda2 /mnt
… but this gave an error – mount: unknown filesystem ext4. This was just
weird, because it is an ext4 filesystem! So next I tried running filesystem
check (fsck) to fix this. For future reference, the command is:
# fsck -y /dev/sda2
I did not run this; I foolishly ran fsck -A -y, which runs fsck on all
disks, including the liveUSB. Which was then borked. 🤦♀️
I quickly downloaded the latest Arch .iso, flashed it to my liveUSB, and booted
back in. My fsck seemed to have fixed the error, so I was able to successfully
mount my HDD partitions and enter chroot:
# mount /dev/sda2 /mnt
# mount /dev/sda1 /mnt/efi
# arch-chroot /mnt
I tried running pacman -Syu, but got the error unable to lock database; I
renamed /var/lib/pacman/db.lck to /var/lib/pacman/db.lck.bak (though what
you’re supposed to do in this situation is delete it).
My beloved wifi-menu has been removed from the latest version of the Arch
installation image (September 2020); now you have to use iwctl. I didn’t
do that; I chroot-ed and used wpa_supplicant, which I already had on my
system. I created a simple wpa_supplicant.conf (full path:
/etc/wpa_supplicant/wpa_supplicant.conf):
ctrl_interface=/run/wpa_supplicant
update_config=1
network=
And voilà, I was able to run pacman -Syu. For good measure, I installed
another
kernel
too.
# pacman -Syu linux-lts
I was then able to boot with no issues. However, I don’t think this is the right way to resolve this issue; I was in a hurry so this is what I resorted to. This may actually be a pretty hacky method. Even so, I’m happy because my laptop’s working fine and my data’s safe; and I had a good idea of what to do without looking it up. My Arch Linux knowledge has grown. 😁