HOW TO: Re-install Grub2

Has it happened to you that you install Windows after you installed Ubuntu and your machine does only boot Windows and doesn’t give any sign of Ubuntu?

Or have you installed Ubuntu after you installed Windows and you try to boot and the only screens that appears is a prompt with “grub>” ?

Well the answer is just: RE-INSTALL GRUB2 !!!

What normally happens, is that there is a conflict between Grub and MBR (Master Boot Record) from Windows, they both want to be the “oficial” boot loader.

First of all, what is Grub and MBR? Well basically it is a part in the hard disk (at the beginning of the disk) that contains the information about the boot (and more information, if you want a detailed information about MBR check here)

How to Re-install Grub2?

What do we need?

  • Linux Live CD (in this case we will use Ubuntu 10.10)

How to get it?

Now that we have the tools necessary, let’s start:

Boot the live CD and open a terminal with Ctrl+Alt+T

Now in the console:

Get root privileges:

[code]sudo -i[/code]

Check where Ubuntu is installed.

[code]fdisk -l[/code]

It should appear something similar to this:

List of partitions

In this case my Ubuntu is installed in the partition ‘/dev/sda5’. You have to check where your partition of Linux is.

Now we will create some directories. Remember, you have to do this as root!

[code]mkdir /mnt/reinstall

mkdir /mnt/reinstall/dev

mkdir /mnt/reinstall/proc

mkdir /mnt/reinstall/sys[/code]

Now we have to use what we got from ‘fdisk -l’. Do you remember where your Ubuntu was installed?

[code]mount /dev/sda5 /mnt/reinstall
mount –bind /dev /mnt/reinstall/dev
mount –bind /proc /mnt/reinstall/proc
mount –bind /sys /mnt/reinstall/sys
chroot /mnt/reinstall [/code]

Now we are at the shell of /dev/sda5 . Exactly as if we had boot our Ubuntu from the Hard disk.

The only missing is: REINSTALL GRUB!!

How to do it?

[code]grub-install /dev/sda


Notice that in this case we DO NOT USE /dev/sda5 !!! We used /dev/sda because is the name of the hard disk! (/dev/sda5 is the name of the partition)

Exit your console and reboot. Your Grub2 is now installed!!! Congratulations!!

[social_share style=”circle” align=”horizontal” heading_align=”inline” text=”” heading=”” facebook=”1″ twitter=”1″ google_plus=”1″ linkedin=”1″ pinterest=”1″ link=”” /]

Author: Rocko

Share This Post On