You’ll need to boot from a live CD or USB drive, as in the graphical method
above. Ensure the version of Ubuntu on from a live CD or USB drive, as in the graphical method above. Ensure the version of Ubuntu on
the CD is the same as the version of Ubuntu installed on your computer — for example, if you
have Ubuntu 12.04 installed, ensure you use a Ubuntu 12.04 live CD.
Open a terminal after booting into the live environment. Identify the partition Ubuntu is
installed on using one of the following commands:
sudo fdisk -l
Here’s the output of both commands. In the fdisk -l command, the Ubuntu partition is identified
by the word Linux in the System column. In the blkid command, the partition is identified by its
ext4 file system.Run the following command to mount the Ubuntu partition at /mnt, replacing /dev/sdX# with
the device name of your Ubuntu partition from the above commands:
For example, use /dev/sda1 for the first partition of the first hard disk device.
Mount the partition your Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. It is usually a EXT4 Partition. Replace the XY
with the drive letter, and partition number, for example: sudo mount /dev/sda1 /mnt.
sudo mount /dev/sdXY /mnt
Now bind the directories that grub needs access to to detect other operating systems, like so.
sudo mount –bind /dev /mnt/dev &&
sudo mount –bind /dev/pts /mnt/dev/pts &&
sudo mount –bind /proc /mnt/proc &&
sudo mount –bind /sys /mnt/sys
Now we jump into that using chroot.
sudo chroot /mnt
Now install, check, and update grub.
This time you only need to add the drive letter (usually a) to replace X, for example: grub-install /dev/sda, grub-install –recheck /dev/sda.
grub-install –recheck /dev/sdX
Now grub is back, all that is left is to exit the chrooted system and unmount everything.
sudo umount /mnt/sys &&
sudo umount /mnt/dev/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt
Shut down and turn your computer back on, and you will be met with the default Grub2 screen.
You may want to update grub or re-install burg however you like it.
Congratulations, you have just Repaired/Restored/Reinstalled Grub 2 with a Ubuntu Live CD!