Restore Ubuntu Boot Loader

To repair your Ubuntu GRUB, you need Ubuntu LiveCD, boot from this CD, and open a terminal. Be a root, by typing “sudo su” and enter your password.

Find the partition which your Ubuntu system is installed.

# fdisk -l

On my machine, my Ubuntu partition is on /dev/sda3, so i’ll use this for example.

Create a mountpoint for this:

# mkdir /media/rootgrub
# mount /dev/sda3 /media/rootgrub

Check if your partition is the correct partition

# ls /media/rootgrub

if the output is not like this, then you have the wrong partition

bin dev home lib mnt root srv usr boot etc initrd lib64 opt sbin sys
var cdrom initrd.img media proc selinux tmp vmlinuz

unmount the partition if have the wrong one, then mount the others. To make sure you have the correct partition, run ls /media/root/boot, which should output something like this :

config-2.6.18-3-686 ¬ ¬ initrd.img-2.6.18-3-686.bak ¬ ¬
grub lost+found ¬ ¬ ¬ ¬ ¬ vmlinuz-2.6.18-3-686 ¬ ¬ ¬ ¬ ¬ ¬ initrd.img-2.6.18-3-686

Now when everything is ok, install the Grub:

# sudo grub-install –root-directory=/media/rootgrub¬ /dev/sda

If you have some warning, try this:

# sudo grub-install –root-directory=/media/rootgrub¬ /dev/sda –recheck

Change /dev/sda to other partition you want to install Grub on. If all goes fine, you will see the output like this:

Installation finished. No error reported. This is the contents of the device map /boot/grub/ Check if this is correct or not. If any of the lines is incorrect, fix it and re-run the script `grub-install’.

(hd0) /dev/sda

Restart to your harddrive (not to LiveCD) and see, your GRUB should be AUTOMAGICALLY appear!

Published by Miaz Akemapa

Book minded!!!

Reader Comments

Leave a Reply

Your email address will not be published. Required fields are marked *