GRUB Repair (After windows install/reinstall)

Ok, this is getting ridiculous now… i never seem to remember how to do this without checking online… so here it is, ready for me when I need it next:

  • First of all, you’re going to need a boot disc/device of some sort
    My favourite lately is a USB boot disc of Ubuntu…
    *I wonder if I should just move all my files and settings there and forget about dual booting….*
  • Boot into your boot disc now (I use disc now because it is short, regardless of  whether you’re booting from USB, CD, DVD or whatever;) and open a terminal window.
  • Now we need root access so, assuming you’re running uBuntu, throw in:
sudo -i

(if you’ve gone the knoppix route, another fav, this’ll do the trick: ‘su -‘ )

  • Now we need to mount your currently ‘absent’ system so create an empty folder in the temp or media folder.
    If you have your /boot/ directory on a separate partition create a folder for it as well:
mkdir /media/root
mkdir /media/root/boot
from here on I will be assuming your linux boot partition is the third on you sata drive at /dev/sda3 and that the boot files are on the same partition
  • Now we just need to link, load and prepare to use your filesystem so run the following:
mount /dev/sda3 /media/root
mount -o bind /dev /media/root/dev
mount -o bind /proc /media/root/proc
cp /proc/mounts /media/root/etc/mtab
  • Now finally we can enter the newly prepared environment:
chroot /media/root/ /bin/bash/
  • Now, run grub and finish it’s repair (if you’re not in uBuntu you may need to /sbin/grub)
remember that under grub, sd is hd and the numbering starts at 0 not 1, so sda1 becomes (hd0,0)
grub
root (hd0,2)
setup (hd0)
quit
  • Now  reboot and you’re done!!! (sorry, no pretty pictures this time…)

Leave a Reply

Your email address will not be published. Required fields are marked *