Saturday, January 15, 2011

HOW TO reinstall grub

Most of the time I install any OS on my computer, I search google to get a guide to recover grub. I forget how to do it every single time. So I thought I'll put in online.

Note:This works for ubuntu 10.10.

Insert install disc and
choose try ubuntu desktop option.

sudo su

This command gives root access.

Now just goto the places menu and click on the drive where you installed ubuntu. That will mount the partition and an icon will be displayed in the desktop.

mount

This will show all that is mounted for the current session.Note the last output line. There you will find the dev name. Should look something like "/dev/sda5". In my case its "/dev/sda5". So replace that in the following commands as per your needs.

mount /dev/sda5 /mnt && mount -o bind /dev /mnt/dev && mount -o bind /proc /mnt/proc && chroot /mnt

This mount the root partition of the installed ubuntu in /mnt of the current session. It also binds the proc amd dev of the ubuntu installation. Finally the root is switched to the ubuntu installation. Please ignore any warnings.

grub-install

This will install grub.

update-grub2

This will update , if amy new distributions are found

gedit /boot/grub/grub.cfg

You can edit the various options in grub. Like timeout,unwanted entries in grub etc...

umount /mnt/dev && umount /mnt/proc && umount /mnt

unmount everything that was mounted

reboot

Hope this will work out for anyone who uses Ubuntu 10.10

No comments:

Post a Comment