Step by step procedure to install windows without Grub Rescue
- Grub, or the Grand Unified Bootloader, is the most common boot loader for Linux. That’s well deserved: the thing actually boots all conceivable operating systems. All Linux distributions, all types of Windows, all types of DOS, all kinds of BSD, Apple Mac OS, you name it. It’s a small miracle of technology.On my multiple boot laptop there once were 10 different operating systems in the menu of Grub: they all lived brotherly side by side on the same hard drive ….Grub is evidence of the strength of simplicity: the program is very simple but also powerful and versatile.
Yet you can occasionally come across a problem with Grub. Here you’ll find solutions for the two most common problems: repairing and removing. Plus some tips for adapting it.
Repair Grub rescue (e.g. because the Windows DVD has overwritten Grub)
2. First the explanation, then the how-to.
Explanation
2.1. If you install Linux first and Windows afterward, then you lose Grub. So it’s better when you install Windows first and then Linux….. Have you already lost Grub? Fortunately, it’s an easy problem to solve. However, it’s very important that you follow the instructions exactly.
Grub consists of two parts.
First, the main part of the program itself, which is placed in the Master Boot Record (MBR). The Master Boot Record is the first sector of the hard disk.
Secondly, there’s the Grub boot menu with the various operating systems, plus some supporting files. These are not in the MBR, but in a folder on the active Linux partition.
Do you have two physical hard disks in your computer? Then it’s important for you to know that Grub always resides in the MBR of the first hard disk. The first hard disk is the hard disk that’s number 1 in the boot priority (boot sequence) in the BIOS of your computer.
If you restore (repair) Grub in the MBR, then you must again tell Grub where it can find the existing boot menu.
How-to
2.2. Note: this how-to is only fit for motherboards that run on a conventional BIOS. This usually means a computer that was sold with Windows Vista or Windows XP pre-installed on it.
The how-to is also fit for a motherboard that runs on an (U)EFI that has been configured to behave as if it were a conventional BIOS. This is normally the case for a computer that was sold with a pre-installed Windows 7.
But this how-to is definitely unfit for motherboards that run on UEFI in full UEFI mode. This is usually the case for computers that were sold with a pre-installed Windows 8.
Repair Grub like this, for example, when a consecutive installation of Windows has wiped Grub:
a. Boot the computer from the Ubuntu DVD.
b. Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
c. Type for example (use copy/paste in order to avoid errors):
sudo mount /dev/sda5 /mnt
Note: only if Ubuntu is on sda5! Change the number according to your situation. Don’t know which partition number is right in your case? Check it with Gparted Partition Editor, which you can start from the Dash with the query gparted.
You can also type this command line in the terminal:
sudo fdisk -l
But that gives less information than Gparted.
and press Enter. This mounts the Ubuntu partition on the hard drive.
d. Type (use copy/paste in order to avoid errors):
sudo grub-install /dev/sda –root-directory=/mnt
and press Enter. This installs Grub.
Note: definitely use copy/paste and do not type this command by hand! Many people forget to type essential spaces in this command.
Note: you might get the following harmless error report:
grub probe: error: failed to get canonical path of /cow
Installation finished. No error reported.
As said, this grub probe error is harmless, and all should be well.
Now type:
sudo reboot
and press Enter.
e. Reboot the computer normally (take out the DVD first).
Now you can only see Linux in Grub, and no Windows (when Windows has been installed after Ubuntu).
Put Windows in the Grub menu:
– Start Ubuntu normally.
Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
type (better yet: use copy/paste):
sudo update-grub
– Reboot your computer. Windows will (again) be visible in the Grub menu. If necessary, you can make the Grub menu visible when you turn on your computer,by pressing the Shift key after the BIOS screen disappears, and keeping it pressed.
This is different from the old Grub, which used the Esc key! An unfortunate decision by the Grub developers, but that’s the way it is.
Adapt Grub: make Windows the first option in the Grub boot menu
3. At the beginning of their Linux adventure, many people want to make Windows the default operating system to boot in the Grub menu (you’ll get over it!).
That’s not hard; this is how you do it.
Adapt Grub: set a nice picture as background for the menu
4. The Grub menu, from which you can choose what operating system to boot, is functional but not very nice….
That can be improved greatly, for example by using a holiday picture as background for the menu.
Want more?
5. Do you want more tips and tweaks for Ubuntu? There’s a lot more of them on this website!
Remove Grub (back to Windows only)
6. Removing Grub is actually a pity…. it’s such a beautiful tool! However, it’ll increase your confidence in Grub if you know how to remove it as well.
In short, removing Grub means the replacement of Linux bootloader Grub, by the Microsoft bootloader NTLoader, in the Master Boot Record (MBR) of the hard disk. There are a lot of ways to do that.
With the Windows XP installation CD
6.1. Boot your computer from a Windows XP installation CD and choose R for restore or repair. Then you get a terminal with a menu. Choose the number of the Windows partition, typically 1 for c:windows , and type the administrator password.
Install NTLoader with the following consecutive commands:
fixboot C:
fixmbr
Done! You should be able to reboot into Windows.
With the Windows 7 installation DVD
6.2. First of all, you need an installation DVD of Windows 7. Don’t have an install DVD of Windows 7? Then get a free copy of an evaluation disc of Windows 7, from Microsoft.
You need a free Windows Live account for that, but you can (if needed) created one on the spot. A fake name will do just as fine as your real name.
Burning the iso needs to be done in a special way: click for the how-to
This is what you do then:
a. Put the Windows 7 installation disc in the DVD drive and reboot the computer.
b. Press a key when asked to (spacebar is always safe)
c. Choose your language and keyboard, and press Next.
d. Click Repair your computer.
e. Click on the operating system that you would like to “repair” and then click Next.
f. In the System Restore Options, click Command Prompt.
g. Type:
Bootrec.exe /FixBoot
Press Enter.
(Note: there is a space between exe and / )
h. Then type:
Bootrec.exe /FixMbr
Press Enter.
(Note: there is a space between exe and / )
Done! You should be able to reboot into Windows.
With the Windows 8 installation DVD
6.3. First of all, you need an installation DVD of Windows 8. Don’t have an install DVD of Windows 8? Then get a free copy of an evaluation disc of Windows 7, from Microsoft.
You need a free Windows Live account for that, but you can (if needed) created one on the spot. A fake name will do just as fine as your real name.
Burning the iso needs to be done in a special way: click for the how-to
What you have to do with the Windows 8 DVD, is described on this page.
With the free Ultimate Boot CD
6.4. No installation CD or DVD of Windows? Then you can restore NTLoader also by using the free Ultimate Boot CD (UBCD). You can download it here.
Pick the .iso of the stable version, and burn it on a CD as a raw image.
Boot your computer from the UBCD (make sure that the CD drive is first in the boot order in the BIOS).
UBCD contains several tools to restore NT Loader in the MBR. I’ll describe the use of one of them.
Select HDD in the menu, then Boot Management, then Super Grub Disk. Then press Enter again, in order to start the Super Grub Disk. Then you choose:
Win => MBR & !WIN! :(((((((((((((((((((((((((((((((((
Press Enter.
By the way: the multitude of arches (sigh) isn’t my idea, but the idea of the maker of the Super Grub Disk…
Now you’re done! Reboot your computer normally. Your computer should boot up Windows now.
With an USB memory stick
6.5. Finally, you can also use a USB memory stick for this job. It takes three applications: Unetbootin, FreeDOS and Testdisk for DOS.
a. First download Unetbootin and use it to make a bootable USB memory stick. Choose Freedos when prompted for a distribution to install on it.
b. Download Testdisk for DOS (don’t pick the bèta, but pick the stable version).
c. Unzip the files testdisk.exe and CWSDPMI.exe, and put them on the bootable memory stick (not in a folder, just straight on it).
d. Boot your computer from the memory stick. At the Default window, simply press Enter.
e. Now FreeDOS is being launched. Choose:
FreeDOS Safe Mode (don’t load any drivers)
Press Enter.
f. Then type: C:
Press Enter.
g. Now type: testdisk
Press Enter.
h. Select [No Log]
Press Enter.
i. Select the hard drive concerned: usually the second option (the first option is the memory stick itself!).
Press Enter.
j. Select [Intel]
Press Enter
k. Select [MBR Code] and press Enter. When prompted, type y (yes) and press Enter again.
Now you’re done! Reboot your computer normally. Your computer should boot up Windows now.