TechSpot

Rescue MBR in Ubuntu?

By jip8888
Oct 30, 2009
  1. I made a stupid mistake and can't seem to rectify it. I have a dual-boot Win XP/Ubuntu 9.04 system. This morning I tried to upgrade the Ubuntu partition to 9.10 UNR, but the installation instead created a new partition for 9.10 alongside the existing ones. Here is where I did something dumb and things went badly wrong. Seeing no easy way to undo the installation, I deleted the 9.10 partition. When I rebooted, I got the message

    GRUB loading
    error: no such partition
    grub rescue>

    The grub rescue> prompt does not seem to recognize any commands. Using a live installation USB stick, I can get to a regular Ubuntu command prompt and can also load a desktop using the startx command. 'boot.ini' looks fine, as does menu.lst. The Windows partition is is sda1 and is flagged as bootable. The Linux partition is extended partition sda2 with sda5 as the subpartition where the file system sits and sda6 as the swap file.

    I assume there is a straightforward way to recreate the MBR, and need someone to point me to it.
     
  2. WinXPert

    WinXPert TS Booster Posts: 527

  3. jip8888

    jip8888 TS Rookie Topic Starter

    Thanks WinXPert, but I found the solution, which turns out as I thought it might be to be very simple. I post it here for others who might find themselves in this situation.

    Boot a live CD to a command line or open a terminal.

    Start grub with:

    sudo grub

    to get the grub prompt grub>

    Type:

    find /boot/grub/stage1

    Using the informaton reported, type:

    root (hd0,n)

    to set the root device. Then type:

    setup (hd0)

    When it finishes installing, exit:

    quit

    and reboot. That's it.
     
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.