Unbootable GRUB after updates

This was a very messy situation. I  was not able to boot a Debian based server after some updates. When booting, I got the following errors:

error: file not found

followed by

grub rescue

However, since I manage the server on distance it was not possible for me to use the grub rescue command prompt, and so the suggested solution at this link was not possible to apply.

Getting access to the partition

Luckily I could boot the system from a rescue system, but if you have physical access to your server you can also use a Live CD. When booted, first mount the relevant partition. I was running a RAID 1 with two hard drives, so I mounted everything as follows:

cd /mnt
mkdir rescue
mount /dev/md2 /mnt/rescue
mount /dev/md1 /mnt/rescue/boot
mount –bind /dev /mnt/rescue/dev/
mount –bind /proc /mnt/rescue/proc/
mount –bind /sys /mnt/rescue/sys/

You can then chroot:

chroot /mnt/rescue /bin/bash

Reinstalling GRUB

The fix was to reinstall GRUB. But first update the config files:

update-grub2

Reinstalling GRUB:

grub-install /dev/sda

and one last recheck to make sure everything is ok:

grub-install –recheck /dev/sda

Last steps

Exit from the shell, unmount and reboot:

exit
umount /mnt/rescue/dev
umount /mnt/rescue/sys
umount /mnt/rescue/proc
umount /mnt/rescue/boot
umount /mnt/rescue
reboot