Restoring GRUB after a reinstall

You had just did a weekly install of some OS which did not detected Linux, Follow the steps mentioned below to get GRUB working again. Please note this would erase the current bootloader and install a new one for you if you are unsure of what you are doing do not try this

  1. Boot from a Linux Live CD ( ex ubuntu or knopix, i use Ubuntu)
  2. Open the terminal
  3. Follow the commands mentioned below
  • sudo grub

if sudo doesnot works switch to root user and use grub drectly, Find the ROOT device you will get the values for X & Y which will be used later.

  • grub> find /boot/grub/stage1

Set the root device from the information achieved from the above command

  • grub> root (hdX,Y)

Install GRUB

  • grub> setup (hd0)

Exit GRUB

  • grub> quit

Reboot the system without using the live CD you will dind your boot loader back :)

From http://ubuntuforums.org/showpost.php?p=121355&postcount=5


2 comments

3
Apr

other preferable way to get back boot loader

Good one.
few points:
sudo may not be applicable to all distro, i.e. it has to be configures.
preferably say change to root and then run the commands.

Secondly, before proceeding with the manual restore, Always give a try with the install CD/DVD you had used for installing the system. It usually has a option of rescue mode which offers to restore the boot loader.

Some time the Install CD also offers to boot the available Linux distro from the disk, if that is possible, boot into your distro and rerun either grub-install script or lilo, whatever is you boot loader.

Want to be really safe, most distros will let you make bootable CD/DVD/floppy, make one and keep for situations like this.

Dexter
http://fossist.net

16
Apr

Thanks

Thanks for the suggestions edited the post to show swith user :)