How to Repair/Restore/Reinstall GRUB Using Ubuntu Live CD


GRUB is the default bootloader of Linux. It is installed on your Hard Disk, but it’s not accessible as a drive. GRUB is installed on your Hard Disk when you install a Linux Operating System.

Without GRUB, you can’t boot in to OSs. Windows, Mac and other OS have their own bootloader. Linux too have different bootloaders. GRUB, BURG are examples.

When you install Windows after you install Ubuntu, Windows replaces the GRUB in the Hard Disk to Windows’ boot loader which won’t identify Linux systems (Damn you Windows !). But, our GRUB detects every OS. So, it’s better to have GRUB over Windows Boot Loader.

You have to re install GRUB after the following scenarios :

  • Changed Partitions of Hard Disk
  • Installed Windows after Ubuntu

GRUB comes with every Linux Distros. So, all you have to do is install GRUB from those distros. Luckily, Ubuntu can be booted from the Install Disk itself. Therefore you can install GRUB from the Lice CD.

Boot From Live CD

Insert the CD or Pendrive that has Ubuntu in to your computer.

Restart your computer and press F12 repeatedly until the BIOS Boot Menu appears. You can see 2 or 3 items in the menu.

If you inserted a Ubuntu CD then Select CD-ROM or others accordingly.

Note : Boot menu might change according to the BIOS version.

After selecting you will enter in to the Ubuntu Installation Process.

After some time, Ubuntu Installation Window appears.

Select Run Ubuntu / Try Ubuntu from the options. You will now boot in to Ubuntu.

For more information about booting into Ubuntu from CD, see the official Ubuntu Community Page : Boot From CD

Re Install GRUB

When you reach the Ubuntu Desktop, open the Terminal using CTRL + ALT + T key combination or by the Dash menu or on Old systems by Applications -> Accessories -> Terminal.

Mount the partition where you’re Ubuntu is on. If you are not sure which it is, launch gparted (included in the Live CD) and find out. You can open gparted from the Terminal with the command :

gparted

Latest Ubuntu Versions have the  ext4 Partition. Now, mount the installed Ubuntu Drive :

sudo mount /dev/sd<span style="color: #ff6600;">XY</span> /mnt

Replace the XY with the drive letter, and partition number. Example:

sudo mount /dev/sda5 /mnt

Then bind the directories we need. Do each of the following command separately.

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

Then we need to be the super use of the installed Ubuntu. For that use chroot.

sudo chroot /mnt

Now install, check, and update grub.

grub-install <span style="background-color: white; line-height: 24px; text-align: justify;"><span style="color: red;">/dev/sdX<span style="color: #000000;"> &&</span> </span></span>grub-install --recheck <span style="line-height: 24px; text-align: justify;"><span style="color: red;">/dev/sdX<span style="color: #000000;"> &&</span> </span></span>update-grub

Replace X  in the above command (usually a) with only the drive letter. Example:

grub-install /dev/sd<span style="color: #ff6600;">a</span>

GRUB is now installed in the MBR (Master Boot Recorder).

Now you can exit you mounted hard disk, and unmount everything we mounted

exit && sudo umount /mnt/dev && sudo umount /mnt/proc && sudo umount /mnt

Restart your computer and you will get the default GRUB Boot Screen.

Can’t See Windows

When you reboot after installing GRUB, you night not see Windows. To fix this do as below.

Boot in to the installed Ubuntu (not live CD) and open Terminal. Then do the following command :

sudo update-grub

It will ask for your password. Type it and press enter. Reboot your computer and you will see Windows now.

If you have any problems, comment on this post. I will help you.