Background
From time to time, I have encountered a system where due to some conditions the GRUB installation has become corrupted. It is a fairly simple matter to reinstall GRUB, and sometimes this can quickly salvage a broken installation.
This is not meant to be a comprehensive guide, but is a compilation of information I found online ([1], [2]) that was useful to me in repairing a few problematic GRUB loaders. Please feel free to contribute in the comments section if you have something to add.
Setting Up The Environment
The first thing you will want to do is locate a live CD as close to the version of Linux you have installed as possible. Boot into the Live CD.
You need to set up a functional chroot. For the purposes of this guide, I will assume /dev/sda1 is your / partition on your installation. We will make a chroot in /mnt/chroot/.
mkdir /mnt/chroot/ mount /dev/sda1 /mnt/chroot/
Next, you need to bind the directories that GRUB needs to access.
mount --bind /dev /mnt/chroot/dev mount --bind /dev/pts /mnt/chroot/dev/pts mount --bind /proc /mnt/chroot/proc mount --bind /sys /mnt/chroot/sys
Finally, chroot to your environment.
chroot /mnt/chroot/
Reinstalling GRUB Automatically
You can try a simple reinstall of GRUB automatically first, see if any insightful errors are produced.
grub-install /dev/sda
Failing that, try the following which will rescan the BIOS drives and update information in the GRUB configuration.
grub-install --recheck /dev/sda
Reinstalling GRUB Manually
If the automatic reinstall does not work for you, try reinstalling via the GRUB shell.
grub
grub> root(hd0,0) grub> setup(hd0) grub> quit
Recent Comments