How to recover GRUB after a Kernel update

Updated the Kernel and GRUB doesn't show your other operational systems anymore? Follow the steps below to solve this annoying issue.

This guide is for legacy boot. For the UEFI boot, see here: https://wiki.manjaro.org/index.php/Restore_the_GRUB_Bootloader

Manjaro

Boot with a Live USB (or CD, DVD) with Manjaro inside it
Open a Terminal and copy(Ctrl+C) the commands below and paste(Ctrl+Shift+V) inside the Terminal:

manjaro-chroot -a
grub-install --recheck /dev/sdaX /mnt (instead of the “X”, put the number of your Linux partition)
update-grub
exit
reboot
Remove your pendrive, CD or DVD

That's it, your GRUB works now and your other operational system are listed, select the one you wish to boot and press Enter.


Other Linux distros

Boot with a Live USB (or CD, DVD) of any Linux distro
Open a Terminal, and copy(Ctrl+C) the commands below and paste(Ctrl+Shift+V) inside the Terminal:
su
fdisk -l to find your Linux partition, it would be something like /dev/sdaX and the "X" is the number of your partition
mount /dev/sdaX /mnt (instead of the "X", put the number of your Linux partition)
if there is a separate /boot partition in sdaY, mount /dev/sdaY /mnt/boot
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
pacman -S mtools os-prober
grub-install /dev/sda
grub-install --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
exit
reboot
Remove your pendrive, CD or DVD

3 Likes

Thanks for the guide!

Some feedback:

  • if the commands are meant to be copy-pasted, you could use code tags instead of bullet points

  • your guide should specify that it is for legacy boot. For the uefi option, see here: https://wiki.manjaro.org/index.php/Restore_the_GRUB_Bootloader

  • manjaro includes update-grub, so you can replace grub-mkconfig -o /boot/grub/grub.cfg with simple update-grub. Basically the same thing, just shorter to write and easier to tab complete.

  • manjaro install media includes manjaro-chroot, so you can replace all the special mount commands with it. So instead of

    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

just do

manjaro-chroot /mnt

Manjaro-chroot also has an automatic mode, if your installation is not on btrfs, you can usually also opt to not even mount your partitions manually and just do

 manjaro-chroot -a

So, in the simplest scenario you could do this all with just these commands:

manjaro-chroot -a
grub-install --recheck /dev/sda
update-grub

Of course, with your commands, you can use pretty much any linux live disc instead of just manjaro.

3 Likes

Or nine times out of ten just open every partition with your file manager and sudo update-grub

1 Like

I updated the guide adding your suggestions, thank you!

Shouldn't this be in the tutorial category?.

1 Like

This is in error. I think you mean to say if there is a separate /boot partition in sdaY,
mount /dev/sdaY /mnt/boot

'mount -t devpts pts /mnt/dev/pts/' is optional

I've updated the guide with your suggestions:

if there is a separate /boot partition in sdaY, mount /dev/sdaY /mnt/boot

What do you mean mount -t devpts pts /mnt/dev/pts/ is optional? I'm not an expert, what does this command does?

I'm no sure if I can move it there, I'm a new user, I think I don't have permission yet. If any admin see this and think it fits there, please move it to Tutorial.

I think to be clearer.....

mount /dev/sdaX /mnt (instead of the “X”, put the number of your Linux partition)
mount /dev/sdaY /mnt/boot (if there is a separate /boot partition in sdaY, additionally mount it)

ps: sorry to keep you so busy editing your post. :grinning:

Neither am I, neither am I. :grin:
I rarely use chroot nowadays, and different distros have different ways to chroot.
Some mount shm too, like..
mount -o bind /dev/shm /mnt/dev/shm

So I am very careful and check on each distro commands if I have to do it. And I always try to avoid it if I can. I've messed up so many times in the past...oh... we need to exit from chroot too (that's one of the things we need to be careful with) before continuing in the er.... chrooting OS. Some have, like manjaro-chroot, their own chroot short cuts, like Ubuntu's debootstrap, and I prefer not to use these because they may be ... obsoleted... in the test/unstable/beta versions that I normally use. But of course, chroot may be easier now and less dangerous.

Thanks for the tutorial. Cheers.

1 Like

It's not that there was a lack of tutorials about chroot and recover GRUB. Just read them all and select the one you understand and trust.

I recommend these two:



And the Manajro Wiki which is not completely up to date, but still works:
https://wiki.manjaro.org/index.php/Restore_the_GRUB_Bootloader

My humble guide is about how to chroot a LUKS encrypted system:

@user_z: I can tell that my guide wasn't perfect from begin on, but I edited it several times. Just a minute ago last time. Your's has improved a lot since the first version!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by