Reinstall GRUB bootloader from LiveCD

by

A major problem faced by multi-os users having Windows and Linux is that when one installs Windows again after linux the GRUB boot loader will be busted from the MBR. Installing linux again is a strenous process. A better option would be to use a Live CD.

Total credit for the following goes to catlett from Ubuntu forums.

If u hav a live cd ….eg Ubuntu….the following method will definitely work..

This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see “sudo” that will mean to you that the following command should be entered at a root terminal.)

Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.

When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)

Code:

sudo grub

This will get you a “grub>” prompt (i.e. the grub shell). At grub>. enter these commands

Code:

find /boot/grub/stage1

This will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)

Code:

root (hd?,?)

Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr

Code:

setup (hd0)

Finally exit the grub shell
Code:

quit

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.

For more info go to

http://ubuntuforums.org/showthread.php?t=224351

Advertisements

7 Responses to “Reinstall GRUB bootloader from LiveCD”

  1. Aditya Shevade Says:

    Do one this, use the code tag or a blockquote or just bold letters for the codes. That will make them easily visible.

    Anyways good info.

    Aditya

  2. PARIMAL Says:

    That was really nice Chinmay.It would be great if you explain the entire process in a bit more detail to me tomorrow in class.

  3. Vedang Says:

    you don’t necessarily need a live cd. any installation cd of ur particular distro will work. just insert cd and use the repair feature.

  4. meka4996 Says:

    Super Grub Disk rocks! Multi Linux Multi OS
    Super Grub Disk rocks!
    repair restore recover [reinstall] linux GRUB bootloader/menu,
    or multi OS/distro multi disks/partitions MBR!
    It works on my ubuntu 7.04 in 1 minute!
    see their wiki for
    “SGD Quick Menu”
    “Multi Distribution Boot Howto”
    “Boot Problems”
    “Howto Fix Grub”

  5. Kirill Says:

    This worked like a charm! TYVM!

  6. Anonymous Says:

    Worked flawlessly, thank you so much! x3

  7. Matthew Says:

    worked perfectly thanks your a lifesaver I was contemplating reinstalling with ubuntu.

    Works with DreamLinux!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: