Page 1 of 15 12311 ... LastLast
Results 1 to 10 of 253

Thread: HOWTO: Restore GRUB (if your MBR is messed up)

Hybrid View

  1. #1
    Join Date
    Apr 2005
    Beans
    54

    HOWTO: Restore GRUB (if your MBR is messed up)

    Restore GRUB quite simple in Ubuntu, instead going through all the "gain root access" and play with shell commands, you can use the Ubuntu installation CD to restore it without going through all kinds of hassles.

    Here are the steps:

    1. Boot your computer up with Ubunto CD
    2. Go through all the process until you reech "[!!!] Disk Partition"
    3. Select Manual Partition
    4. Mount your appropriate linux partions

    /
    /boot
    swap
    .....

    5. DO NOT FORMAT THEM.
    6. Finish the manual partition
    7. Say "Yes" when it asks you to save the changes
    8. It will give you errors saying that "the system couldn't install ....." after that
    9. Ignore them, keep select "continue" until you get back to the Ubuntu installation menu
    10. Jump to "Install Grub ...."
    11. Once it is finished, just restart your computer

    Good luck!.

  2. #2
    Join Date
    Jan 2005
    Beans
    65

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Isn't it easier to do this:

    1. Pop in the Live CD, boot from it until you reach the desktop.
    2. Open a terminal window or switch to a tty.
    3. Type "grub"
    4. Type "root (hd0,6)", or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda7, which translates to hd0,6 for grub).
    5. Type "setup (hd0)", ot whatever your harddisk nr is.
    6. Quit grub by typing "quit".
    7. Reboot.

    I may be missing your point though, if so, please forgive me

    Quote Originally Posted by vnbuddy2002
    Restore GRUB quite simple in Ubuntu, instead going through all the "gain root access" and play with shell commands, you can use the Ubuntu installation CD to restore it without going through all kinds of hassles.

    Here are the steps:

    1. Boot your computer up with Ubunto CD
    2. Go through all the process until you reech "[!!!] Disk Partition"
    3. Select Manual Partition
    4. Mount your appropriate linux partions

    /
    /boot
    swap
    .....

    5. DO NOT FORMAT THEM.
    6. Finish the manual partition
    7. Say "Yes" when it asks you to save the changes
    8. It will give you errors saying that "the system couldn't install ....." after that
    9. Ignore them, keep select "continue" until you get back to the Ubuntu installation menu
    10. Jump to "Install Grub ...."
    11. Once it is finished, just restart your computer

    Good luck!.

  3. #3
    Join Date
    Apr 2005
    Beans
    54

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Your way is definately faster, but for newbies, many of them try to avoid command line as much as possible. That is why I brought up an alternative.

  4. #4
    Join Date
    Oct 2004
    Location
    Alaska, USA
    Beans
    122

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Quote Originally Posted by vnbuddy2002
    Your way is definately faster, but for newbies, many of them try to avoid command line as much as possible. That is why I brought up an alternative.
    Hey thanks, I never thought of doing this. It worked great for me today.

    Last time I messed up grub I used the Live CD method but did not write anything down so today I searched for "grub" and found this post. But I couldn't find a Live CD so I used your method with the Install CD.

    Thanks
    Tomy

  5. #5
    Join Date
    Feb 2005
    Beans
    47

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Don't forget that this method, as described, puts GRUB back on the MBR (master boot record) of the hard drive instead of in the root parititon. This is fine for most people, but not if you already have an alternative boot manager.

    In other words, if you use something like Boot Magic or System Commander, the commands you've just read will overwrite what you've got.

    If you've installed GRUB into the Root Partition instead of the MBR, the commands are a little different. Here's are the instructions that I have for my system:

    How to Restore the Grub Menu after a Re-Ghosting:

    1. Boot from a Live CD, like Ubuntu Live, Knoppix, Mepis, or similar.

    2. Open a Terminal. Go SuperUser (that is, type "su"). Enter root passwords as necessary.

    3. Type "grub" which makes a GRUB prompt appear.

    4. Type "find /boot/grub/stage1". You'll get a response like "(hd0)" or in my case "(hd0,3)". Use whatever your computer spits out for the following lines.

    5. Type "root (hd0,3)".

    6. Type "setup (hd0,3)". This is key. Other instructions say to use "(hd0)", and that's fine if you want to write GRUB to the MBR. If you want to write it to your linux root partition, then you want the number after the comma, such as "(hd0,3)".

    7. Type "quit".

    8. Restart the system. Remove the bootable CD.

    Hope this helps. Since I use Norton Ghost to make regular backups and restores (I do a lot of testing), I do this all the time...

    -Warr

  6. #6
    Join Date
    Dec 2006
    Beans
    242

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    ok reinstalling ubuntu did not work. I am able to log into xp when I remove the mbr grub enteries with SGD but I can not reinstall ubuntu with the desktop cd. I get error 18. Since I am installing ubuntu on a 80 G drive I wonder, is the size of the drive really? I think the last time the two (Ubuntu and XP) were working on this pc it was the same setup. I changed the setings in bios also but did not get rid of the error.
    In previous posts there is mentione of live cd vs. Install CD. Just making sure, by live you mean the desktop cd? And install is the other one? that one should give me more options? I tried to change the /root to logical, but the desktop install did not allowe me to do this.

  7. #7
    Join Date
    May 2008
    Location
    UK
    Beans
    31

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Quote Originally Posted by wernst View Post
    Don't forget that this method, as described, puts GRUB back on the MBR (master boot record) of the hard drive instead of in the root parititon. This is fine for most people, but not if you already have an alternative boot manager.

    In other words, if you use something like Boot Magic or System Commander, the commands you've just read will overwrite what you've got.

    If you've installed GRUB into the Root Partition instead of the MBR, the commands are a little different. Here's are the instructions that I have for my system:

    How to Restore the Grub Menu after a Re-Ghosting:

    1. Boot from a Live CD, like Ubuntu Live, Knoppix, Mepis, or similar.

    2. Open a Terminal. Go SuperUser (that is, type "su"). Enter root passwords as necessary.

    3. Type "grub" which makes a GRUB prompt appear.

    4. Type "find /boot/grub/stage1". You'll get a response like "(hd0)" or in my case "(hd0,3)". Use whatever your computer spits out for the following lines.

    5. Type "root (hd0,3)".

    6. Type "setup (hd0,3)". This is key. Other instructions say to use "(hd0)", and that's fine if you want to write GRUB to the MBR. If you want to write it to your linux root partition, then you want the number after the comma, such as "(hd0,3)".

    7. Type "quit".

    8. Restart the system. Remove the bootable CD.

    Hope this helps. Since I use Norton Ghost to make regular backups and restores (I do a lot of testing), I do this all the time...

    -Warr
    Just tried this, worked fine in hardy.

  8. #8
    Join Date
    Mar 2007
    Beans
    30

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Quote Originally Posted by wernst View Post
    Don't forget that this method, as described, puts GRUB back on the MBR (master boot record) of the hard drive instead of in the root parititon. This is fine for most people, but not if you already have an alternative boot manager.

    In other words, if you use something like Boot Magic or System Commander, the commands you've just read will overwrite what you've got.

    If you've installed GRUB into the Root Partition instead of the MBR, the commands are a little different. Here's are the instructions that I have for my system:

    How to Restore the Grub Menu after a Re-Ghosting:

    1. Boot from a Live CD, like Ubuntu Live, Knoppix, Mepis, or similar.

    2. Open a Terminal. Go SuperUser (that is, type "su"). Enter root passwords as necessary.

    3. Type "grub" which makes a GRUB prompt appear.

    4. Type "find /boot/grub/stage1". You'll get a response like "(hd0)" or in my case "(hd0,3)". Use whatever your computer spits out for the following lines.

    5. Type "root (hd0,3)".

    6. Type "setup (hd0,3)". This is key. Other instructions say to use "(hd0)", and that's fine if you want to write GRUB to the MBR. If you want to write it to your linux root partition, then you want the number after the comma, such as "(hd0,3)".

    7. Type "quit".

    8. Restart the system. Remove the bootable CD.

    Hope this helps. Since I use Norton Ghost to make regular backups and restores (I do a lot of testing), I do this all the time...

    -Warr
    Hey man, I did these steps but error 2 keeps getting displayed. I installed puppy linux, lucid pup, and it does install a bootable grub. The mint installer is the one that cannot do this. Any ideas?

    Just a FYI, lucid puppy does install well and boots off ok, so I guess this is a problem with the mint installer.
    Last edited by sheds; March 27th, 2012 at 05:55 AM.
    Building for a shallow grave
    -- Jim Morrison

  9. #9
    Join Date
    May 2005
    Location
    I'm not telling
    Beans
    58

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Quote Originally Posted by Tomy
    Hey thanks, I never thought of doing this. It worked great for me today.

    Last time I messed up grub I used the Live CD method but did not write anything down so today I searched for "grub" and found this post. But I couldn't find a Live CD so I used your method with the Install CD.

    Thanks
    Tomy
    For some reason the Live CD method doesn't work for me. I boot from the Live CD and open a terminal, which tells me "command not found" when I type "grub."

    Anyone know what this is about?

  10. #10
    Join Date
    Aug 2005
    Beans
    7

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Quote Originally Posted by j.hill
    For some reason the Live CD method doesn't work for me. I boot from the Live CD and open a terminal, which tells me "command not found" when I type "grub."

    Anyone know what this is about?
    I had that as well - the Live CD doesn't seem to actually have the grub command available..
    Do you already have Ubuntu installed on a physical drive and just want to reinstall Grub? If so, you just need to mount it. My steps:
    Drop to a root terminal
    mkdir hda1
    mount /dev/hda1 hda1 (mounts that device into ./hda1)
    cd hda1/sbin
    ./grub

    Replace hda1 with whatever the physical drive that Ubuntu is installed on happens to be.
    Worked for me - I'm just stuck trying to actually install Grub on my NTFS partition somewhere.

Page 1 of 15 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •