Rescue MBR in Ubuntu?

Status
Not open for further replies.
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.
 
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.
 
Status
Not open for further replies.
Back