Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB

We can easily reinstall grub using live cd.

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/sda7 /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 /dev/sdX

#grub-install --recheck /dev/sdX

#update-grub

Now grub is back, all that is left is to exit the chrooted system and unmount everything.

#exit && sudo umount /mnt/dev && sudo umount /mnt/dev/pts && sudo umount /mnt/proc && sudo umount /mnt/sys && sudo umount /mnt

Now reboot the system from live cd and remove live cd or usb. This will restore your grub.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s