How do I fix "Grub Rescue"? Uninstallation?

I am currently dual-booting windows 7 and Ubuntu. I am about to sell my computer so I was following a tutorial on how to uninstall Ubuntu. I had deleted my partitions like the tutorial said and now I get this:

error : no such partition grub rescue>_

I am now looking for help on

  1. Getting out of this "grub rescue"
  2. Uninstalling Ubuntu and/or factory reset

Notes -Newbie - No windows disks -I have spare CDs


Solution 1:

(From within rescue mode)

Command: ls

It will list all your drives and partitions, like:

(hd0) (hd0,msdos2) (hd0,msdos1)

If you don't know your Ubuntu boot partition, check them one by one:

ls (hd0,msdos2)/
ls (hd0,msdos1)/

When you hit the right one, you'll get a line mentioning "lost+found" and so on.

Assuming (hd0,msdos2) is the right partition:

set prefix=(hd0,2)/boot/grub
set root=(hd0,2)
insmod normal
normal

Now you'll be able to boot into Ubuntu. Once you do, execute the following commands:

sudo update-grub
sudo grub-install /dev/sda

Voila.

Solution 2:

You could do either of two things:

  1. Use a Windows 7 installation CD, boot it, and search for the repair option. After that you will get many options; then search for 'command prompt'. Type the following commands into a command prompt one-by-one and press Enter.

    • bootrec.exe/fixmbr
    • bootrec.exe/fixboot Thats it done. Or watch this YouTube tutorial.
  2. If you have any Linux installation CD/DVD or USB pendrive then live boot it and follow the steps shown on the page Boot-Repair. You will get the boot menu back.