Ubuntu – How to create or recover Windows Bootloader after deleting Ubuntu boot drive

bootloaderdual-bootwindows 7

I have a computer that dual-boots (or tri-boots) Windows 8 Release Preview, Windows 7, and Ubuntu 12.04. Grub boots between Windows 8 and Ubuntu; for which I use primarily. Recently, I decided to remove Ubuntu, as I hardly used it. I deleted the Ubuntu partition accidentally before replacing the Grub bootloader. Now, whenever I want to boot the machine, it gives me the "grub-rescue" prompt — I am unable to boot into either Windows (8 nor 7), nor Ubuntu (except via USB, of course). I do not have any Windows 7/8 recovery media, so that isn't an option. Please note that after I deleted the Ubuntu partition, I put the PC into hibernate, and then turned it on. This means the C:\ [Windows 8] drive cannot be mounted. I don't know if that is bad, but it definitely doesn't make things better.

I am currently booting Ubuntu via USB, in an effort to restore the Windows bootloader. I have looked into using boot-repair to solve the problem using the instructions here, although after attempting to apply the changes, it gave the error: "Please install the [mbr] packages. Then try again." I don't know why I'm getting this error; is there a way to install the 'mbr packages?' I honestly don't know what exactly they are, nor how to install them. Are there any other options I have not yet exhausted to be able to boot back into Windows, in the case that there is a better way? I want to set the bootloader to boot into Windows 8, but booting into either Windows 7 or 8 is fine (I can use EasyBCD from there). Is there a simple solution to this? I've checked BIOS, and I haven't been able to find a way to boot into Windows.

Best Answer

You can install a Microsoft style MBR from an Ubuntu LiveCD/USB. To do so, run

sudo software-properties-gtk -e universe && sudo apt-get update 
sudo apt-get install mbr
sudo install-mbr /dev/sdX

where "sdX" is the device node for your hard drive, like "sda", not a partition like "sda1".

If you really want to use boot-repair to do this then simply run everything except the last command

sudo install-mbr /dev/sdX

The commands before that one will just install the mbr package. Then try boot-repair again.