Page 1 of 26 12311 ... LastLast
Results 1 to 10 of 255

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

  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
    May 2005
    Beans
    2

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

    Here is another way:

    1. Boot with any live CD (I've done it with Knoppix 3.x and Ubuntu)
    2. Get a root shell and make a folder (mkdir ubuntu)
    3. mount the root (/) partition of ubuntu (e.g. mount /dev/hdb ubuntu if you have two disks)
    4. chroot the mounted partition (chroot ubuntu)
    5. grub-install /dev/hda [1]
    5. Exit the shell
    6. Reboot

    [1] Important: If you are multi-booting with Windows, make sure you do NOT install the MBR on the active partition (say /dev/hda1) but on the drive (/dev/hda). At least with Windows XP, you will have to re-install it (FIXMBR/FIXBOOT won't work).

  7. #7
    Join Date
    Mar 2005
    Beans
    115

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

    Since all you need for these fixes is a command prompt, you don't need to load the GUI. For Knoppix I believe you type something like 'knoppix 3'. For the Ubuntu Live-cd I don't know. I'll edit this post when I figure it out.
    "Windows is something to overcome"

    Howto's by me:
    Tweak firefox! (URL now works..)
    Backup/Restore your system!
    Avoid having to reboot


    Compentux.org
    , the Linux Tip & Howto gathering initiative!

  8. #8
    Join Date
    Apr 2005
    Beans
    3

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

    at step 10, I encountered a problem: it asks you if you want to proceed when you click the Install Grub, and in all the previous steps, "yes" or "continue" was the correct response, at step 10, if you select "yes" the ubuntu disk will proceed and attempt to install ubuntu.... which will ruined my current install... ah well....

    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!.

  9. #9
    Join Date
    Jun 2005
    Location
    Texas
    Beans
    82

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

    I currently have a mobile rack so that I can have Ubuntu on one drive, and Windows on another. When I need to change OS's, I turn off the system, swap drives, and turn it back on again. I've decided this is too much of a hassle (and not necessarily easy on the electronics).

    I am going to install another SATA drive and I want to move my current Ubuntu install over to that drive (without having to reinstall Ubuntu), and then setup GRUB on my Windows drive so I can dual boot.

    Will I experience any problems doing this? The reason I ask is because I'll be moving Ubuntu from /dev/hda to /dev/sdb, and I'm wondering if any OS-specific stuff cares about that kind of thing.


    Should I just throw in the towel and reinstall Ubuntu from scratch on the new drive, or is what I want to do doable?

  10. #10
    Join Date
    Aug 2005
    Beans
    7

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

    Hi guys,
    The problem I'm having is that Ubuntu installed GRUB onto /hdb1, but my primary partition (as far as my BIOS is concerned) is /sda1
    I can run 'grub' and reinstall grub like described by remmelt, but I don't know what the ID of /sda1 is. (hd1,0)? (hd2,1)? What command can I use to get the mapping?
    I'm able to boot off the Live CD only at the moment.

Page 1 of 26 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
  •