Tuesday, February 5, 2013

Ubuntu 12.04 fresh installation failed to install GRUB

Download: Fast, Fun, Awesome

Ubuntu 12.04 LTS fresh installation even though completed successfully it might fail to install grub correctly on system.  In such a situation to install grub you can follow following steps using LiveCD or bootable installation disk.

Boot from LiveCD, open terminal and run following commands to note down drive and partition number on which Ubuntu is installed.

$sudo fdisk -l
OR
$sudo df -h

$sudo blkid   #it gives more information on partition and file system type

Now mount hard disk partition on which Ubuntu is installed.
$sudo  mount  /dev/saXY   /mnt   
Where X is drive letter such as a,b,c,, etc. and
Y is partition number such as 1, 5, 6, 8, etc,

For example:
  sudo mount /dev/sda8 /mnt

Now install grub loader.
$sudo  grub-install  --boot-directory=/mnt/boot    /dev/sdX   
For example:
  sudo grub-install --boot-rectory=/mnt/boot /dev/sda

--boot-directory is folder in which GRUB is located. It is normally /boot. Note that in above command we only provided sdX as input. We didn't use Y i.e. partition number.

In command prompt, do not install grub loader when your are inside the /mnt directory or the directory where your target hard disk is mounted.  It doesn't work sometime.

1 comment: