Description: In this tutorial we will explain how to repair or reinstall the Grub2 on Ubuntu.
Follow 5 simple steps mention below and you will get your Grub back.
Prepare USB bootable and Insert the USB drive or Ubuntu CD and turn the live Ubuntu on.
Mount the partition where Ubuntu is install. If you are not sure then write the command:
sudo fdisk -l
to check the which partition has Ubuntu Installation and type of partition.
To mount the partition give command as follows:
sudo mount /dev/sdXY /mnt
sdXY is your type of partition, in my case it is sda1 so i give ” sudo mount /dev/sda1/mnt”
Now you need to bind the directories which is used by Grub to detect other OS . Give command as follows:
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
sudo chroot /mnt
Now update Grub by following command:
Please replace the (K) in /dev/sdK according to your partition type. In my case “grub-install /dev/sda”
grub-install –recheck /dev/sda
Now the grub is Updated and back to your system, now you need to exit the chroot and unmount the directories like this:
sudo umount /mnt/dev &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/proc &&
sudo umount /mnt/sys &&
sudo umount /mnt
This is all, now restart your system and you will see the grub-2 screen back on your system.
Happy commenting 🙂