HowTo - Restore an unbootable system after an interrupted kernel update

When you are updating your system with pacman, you should generally always let the command complete fully without interruption. However, sometimes the update is interrupted - for example when

  • your terminal/dekstop/xorg crashes while updating and takes the pacman process with it
  • computer is shut down by power outage or third party involvement

A broken update can result in an unbootable system, if the kernel is updated, but the post update hooks have not yet been executed. After choosing manjaro from grub, you get a message saying "Failed to load kernel modules" and other errors. Fortunately, this is usually easy to fix.

What you need:

  • Another linux system, preferrably manjaro or arch linux
    • this can be a live cd/usb, a grub entry to boot a linux iso (see here: Booting Manjaro iso using grub2) or another linux installation in a multiboot environment
    • you should keep one or more of these available at all times
  • to chill out and not panic

Step 1
Boot to your other linux system.
Step 2
Mount the root partition of the system that you are fixing.

You can check your partition layout with the command

lsblk

We are assuming now that your broken system is in the partition /dev/sda2.

sudo su
mkdir /mnt
mount /dev/sda2 /mnt

or
If you have installed on btrfs subvolume (for example the standard @), you need to mount your root partition like this:

mount -o subvol=@ /dev/sda2 /mnt

In an uefi system, you should also usually mount your EFI partition (for example /dev/sda1)

mount /dev/sda1 /mnt/boot/efi

If you have a separate /boot partition (for example /dev/sda3) , you need to mount that too:

 mount /dev/sda3 /mnt/boot

Step 3
Chroot into your broken system.

 manjaro-chroot /mnt /bash

OR if using arch linux

 arch-chroot /mnt /bash

OR if using some other linux, chroot with manual method:

mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
mount -t devpts pts /mnt/dev/pts/
chroot /mnt

OR if if using some other linux in a uefi environment

modprobe efivars
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
mount -t devpts pts /mnt/dev/pts/
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
chroot /mnt

STEP 4
Complete the update properly.

Following set of commands takes care of various things that may have gone wrong with the update:

pacman -Syu
mkinitcpio -P
update-grub

The first updates the system. Second command rebuilds initramfs for all installed kernels. Third command updates grub, so that entries for all the kernels are up to date.

Step 5

Profit.

Your manjaro installation should now be bootable again.

27 Likes

add others kernels linux ,
that you can change on boot grub menu

and

manjaro-chroot -a

do all step before
( Step 1 & 2 ( except btrfs ) & step 3 )

2 Likes

While also useful and good safeguard, an extra kernel is not the same level of fallback option as the others mentioned, because an interrupted update can result in all kernels becoming unbootable. Also, if you another working kernel, there is no reason to chroot.

Good point about the automatic mode in manjaro-chroot. There is also a plan to add btrfs support to the automatic mode (no idea when I have time to do it though).

Shouldn't this step be performed after the
chroot /mnt
?
If not then Wiki needs correction.
Almost at the bottom of the page for GRUB/Restore the GRUB Bootloader in "Note" it says:

and in the chroot

mount -t efivarfs efivarfs /sys/firmware/efi/efivars

Forum kindly sponsored by