Thursday, November 17, 2011

Recovering grub 2

Hard way: Manual fix from live CD

You will need a live CD that ships with GRUB 2, like Ubuntu or Kubuntu. Boot into the live session, mount the hard disk and install GRUB 2 to the MBR.

This is the sequence of commands you require (assuming disk = /dev/sda). You will need to mount the partition of your installed distribution (e.g. Ubuntu) containing the /boot directory. It may also be a separate partition on your system, depending on your setup.

After it is mounted, you will have to rerun the install-grub command.

mount /dev/sdax /mnt/

create an un breakable link from /dev folder on the live image you booted from to the /dev folder on the partition you mounted to /mnt

sudo mount --bind /dev /mnt/dev



chroot from the live images root to mounted partitions root

sudo chroot /mnt


Re install the grub2 boot loader to the drive on which exists the partition you mounted previously

sudo grub-install /dev/sda


Exit out of chroot shell (type exit)

cleanly unmount all the partitions you previously mounted

sudo umount
sudo umount /mnt/dev
sudo umount /mnt

No comments:

Post a Comment