Recover Archlinux Kernel

My recent kernel upgrade for my ArchLinux server failed because my /tmp folder was full and the package manager couldn’t use the /tmp folder to build the necessary modules and tools. Despite knowing this, I decided to reboot the server anyway and that’s when I saw the dreaded kernel panic message making my server completely unusable. However, I knew my data was still safe on the server, it just couldn’t boot up so I did what any geek would do, I decided to fix it.

Getting it fixed was alot easier than I remmebered. Below are the steps I used to get my kernel up and running again after a failed kernel upgrade.

  1. Boot my server using the Arch Linux ISO.

  2. Once it is booted, I proceeded to mount my disk to a mountpoint. Replace vda1 with your own disk partition.

    mount /dev/vda1 /mnt
  3. Now execute arch-chroot to gain access to the broken system.

    arch-chroot /mnt /bin/bash
  4. My packages don’t get cleared often from the cache so I know the package exists in /var/cache/pacman/pkg and install it from there. Replace linux-4.18.8.arch1-1-x86_64.pkg.tar.xz with the linux kernel you want.

    cd /var/cache/pacman/pkg
    pacman -U linux-4.18.8.arch1-1-x86_64.pkg.tar.xz
  5. And that’s it. Exit the chroot and reboot the system. Remember to unmount the ISO before you start your OS again.

And with this, my server is back up happily serving the universe again. Yay!! :-D

Now, what would you do if you don’t have the linux package on your system. I would download it from https://www.archlinux.org/packages/core/x86_64/linux/download/ to get the latest kernel and replace the name for step (4).

Happy recovering.