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


Read {count} times since 2020

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 your Ubuntu is installed. 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

Linux distros use ext4 partition. Locate your installed Ubuntu partition (drive) from gparted and note the partition (drive) letter and number (example: sda5).

Now, mount the installed Ubuntu Drive. Replace XY with the drive letter, and partition number. Example: sudo mount /dev/sda5 /mnt

sudo mount /dev/sdXY /mnt

Then bind the directories we need. Copy the whole command (it’s separate commands wrapped into one) below and run it :

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

If your system uses UEFI for booting, you may need to do additional steps as mentioned here.

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. Replace X in the following command with only the drive letter (usually a). Example: grub-install /dev/sda

grub-install /dev/sdX && grub-install --recheck /dev/sdX && update-grub

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.

Show Comments