Page 2 of 26 FirstFirst 123412 ... LastLast
Results 11 to 20 of 255

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

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

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

    Quote Originally Posted by Rikko
    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.
    From the grub prompt trying using the <tab> key to see what choices you have.

    grub> root (<tab>

    Tomy

  2. #12
    Join Date
    Aug 2005
    Beans
    7

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

    Quote Originally Posted by Tomy
    From the grub prompt trying using the <tab> key to see what choices you have.

    grub> root (<tab>

    Tomy
    Thanks Tomy, that got me a little farther.. Now I'm getting a "Partition type is 0x7" (or something very similar - I've since booted back into Windows)... Maybe I'm misunderstanding Grub but I thought it could just be placed into the MBR without needing any partition space.
    Or can I mix up the setup() and root() commands to install Grub into sda1's MBR but store the actual files needed on /hdb1?

    Geez, just when you thought you know something about computers...

  3. #13
    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?

  4. #14
    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.

  5. #15
    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 Rikko
    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.
    So if my computer is using the notation "hd0" for this sort of thing, I would type
    Code:
    mkdir hd0
    ?

    Seems almost too easy.

    Will this conflict in any way with the current location of Grub? And, if this works, will I still edit the Grub menu in /boot/grub/menu.lst?

    And is there any danger of seriously screwing up my computer with this method? I'm still an abject n00b, so I'm sort of reluctant to try anything risky.

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

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

    Can't I just reinstall Grub through Synaptic?

  7. #17
    Join Date
    Jul 2005
    Location
    Aurora, ON, Canada
    Beans
    174
    Distro
    Ubuntu Breezy 5.10

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

    Quote Originally Posted by Rikko
    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.
    at the cd hda5/sbin step I'm getting this error:

    bash: cd: hda5/sbin: No such file or directory

  8. #18
    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 rpakdel
    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).
    I'm stuck on steps 3 and 4. For step 3, the computer gives me the following ambiguous message: does this mean that I've successfully mounted what needed mounting?

    Code:
    root@ubuntu:/home/ubuntu # mount -t ext3 /dev/hda/ubuntu
    Usage: mount -V                 : print version
           mount -h                 : print this help
           mount                    : list mounted filesystems
           mount -l                 : idem, including volume labels
    So far the informational part. Next the mounting.
    The command is `mount [-t fstype] something somewhere'.
    Details found in /etc/fstab may be omitted.
           mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
           mount device             : mount device at the known place
           mount directory          : mount known device here
           mount -t type dev dir    : ordinary mount command
    Note that one does not really mount a device, one mounts
    a filesystem (of the given type) found on the device.
    One can also mount an already visible directory tree elsewhere:
           mount --bind olddir newdir
    or move a subtree:
           mount --move olddir newdir
    A device can be given by name, say /dev/hda1 or /dev/cdrom,
    or by label, using  -L label  or by uuid, using  -U uuid .
    Other options: [-nfFrsvw] [-o options] [-p passwdfd].
    For many more details, say  man 8 mount .
    Then, when I try to chroot, I get this:

    Code:
    chroot: cannot run command `/bin/bash': No such file or directory
    This last bit really confuses me. Obviously /bin/bash exists; I'm using a bash shell to give the chroot command.

    What does it all mean?

  9. #19
    Join Date
    Sep 2005
    Beans
    3

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

    you can use use ultimate boot cd to rewrite the mbr it's very easy.
    download and burn as an iso at http://ubcd.sourceforge.net/download.html .
    I wanted to get rid of lilo after I tried xandros. Xandros leaves lilo on your mbr, it worked great, it has a lot of tools to

  10. #20
    Join Date
    Apr 2005
    Beans
    54

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

    You had specified the wrong mount syntax. It should be

    sudo mkdir /mnt/ubuntu
    sudo mount -t ext3 /dev/hda[0 .. whatever here ] /mnt/ubuntu

    Make sure you know which partition you are trying to mount

    sudo fdisk -l

    -----


    Quote Originally Posted by j.hill
    I'm stuck on steps 3 and 4. For step 3, the computer gives me the following ambiguous message: does this mean that I've successfully mounted what needed mounting?

    Code:
    root@ubuntu:/home/ubuntu # mount -t ext3 /dev/hda/ubuntu
    Usage: mount -V                 : print version
           mount -h                 : print this help
           mount                    : list mounted filesystems
           mount -l                 : idem, including volume labels
    So far the informational part. Next the mounting.
    The command is `mount [-t fstype] something somewhere'.
    Details found in /etc/fstab may be omitted.
           mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
           mount device             : mount device at the known place
           mount directory          : mount known device here
           mount -t type dev dir    : ordinary mount command
    Note that one does not really mount a device, one mounts
    a filesystem (of the given type) found on the device.
    One can also mount an already visible directory tree elsewhere:
           mount --bind olddir newdir
    or move a subtree:
           mount --move olddir newdir
    A device can be given by name, say /dev/hda1 or /dev/cdrom,
    or by label, using  -L label  or by uuid, using  -U uuid .
    Other options: [-nfFrsvw] [-o options] [-p passwdfd].
    For many more details, say  man 8 mount .
    Then, when I try to chroot, I get this:

    Code:
    chroot: cannot run command `/bin/bash': No such file or directory
    This last bit really confuses me. Obviously /bin/bash exists; I'm using a bash shell to give the chroot command.

    What does it all mean?

Page 2 of 26 FirstFirst 123412 ... 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
  •