ubuntu dual boot illustrated site ubuntu dual boot windows 7 maverick meerkat
WinGrub
Edited Saturday, August 04 2007

This web-page is part of a larger site giving examples of how to install Windows+Ubuntu Linux operating systems 'dual boot' in a computer.  Illustrated Dual Boot HomePage  

A few people are superstitious about their MBRs and are frightened to let any program write to their hard disk's MBR, but they still want to install Linux, which means using the GRUB boot loader. If you feel that way then this page may help you.

This webpage is to explain how I set up boot.ini in Windows and installed WinGrub to boot either Windows via its own bootloader NTLDR or Linux via WinGrub, without touching the MBR.
This should work for most other computers approximately as shown in this example but details may vary between different computers.

Note: Before you can boot Linux with WinGrub you will need to have a Linux installation to boot and it will need to have the Grub bootloader already installed in it. However, it doesn't matter where you install the IPL for Grub, you can use the option of installing Grub to the Linux partition's bootsector, or to a floppy disk or somewhere else of your choice.
It doesn't matter if this is done before or after you install WinGrub in Windows.

You also need to hash out your 'savedefault' commands in /boot/grub/menu.lst in order to use WinGrub to boot Linux.

Part 1
Edit Boot.ini

Windows NTLDR boot loader can be used for loading Windows, but it can't load any Linux Operating system's kernels.
The Windows bootloader's configuration file, 'boot.ini', can be configured to provide a boot menu to allow us a choice of operating systems when we boot up.
Before we can edit the boot.ini file, which is normally a hidden, system, 'read only' file, first we have to  relax the security permissions for the file.

To relax the security attributes for the boot.ini file:
1) Click Start
2) Click Run
3) Type CMD in the run box  
 Open:       CMD                            
4) Click the 'OK' button

Next. you can expect to see a black terminal with prompt like illustrated below:

Microsoft Windows XP [Version 5.1.2600]
<C> Copywrite 1985-2001 Microsoft Corp.

C:\Documents and settings\Herman X>_
C:\Documents and Settings\Herman X>_

5) type cd\ after this prompt.

C:\Documents and settings\Herman X>cd\

C:\>_
C:\_                                           (New prompt looks like this)


C:\> attrib -s -h -r boot.ini
6) Type the following command,     C:\>attrib -s -h -r boot.ini     and press 'Enter'.


C:\>_
                 
The above commands relax the System, Read-only, and Hidden file attributes for the boot.ini file.
You can just leave the dos terminal open there for now, because we'll come back to it later on.
Or you can close it if you want, but you'll need to re-open it again later if you do.

Now we can go and open our boot.ini files and edit them by adding line to point to our WinGrub files, which we will soon install.

You can find boot.ini at My Computer/Local Disk (C:)
When you open disk C:/ you'll see a blue Window that tells you the contents of this folder are normally hidden. You will have to click 'Show the contents of this folder' to see inside.

When you have done that you'll see some folders and files in the '/' (root) of the Windows filesystem tree. One of them is called boot.

Open the file called boot

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect /NoExecute=OptIn
The boot file (boot.ini) should look something similar to mine, shown above.

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect /NoExecute=OptIn
C:\GRLDR="Start Grub"

8) Edit your boot.ini file by adding the following line
C:\GRLDR="Start Grub"
Please be very careful to type exactly what is shown here and only what is shown here as a seemingly insignificant error in boot.ini can make it hard for you to boot Windows again.

If that happens you'll need to make yourself one of these great Windows XP boot floppy disks, Click Here. These are not just your ordinary boot disks, there have a separate copy of NTLDR, NTdetect.com and boot.ini on the floppy disk. They bypass most problems you are likely to have booting Windows XP. You can edit the boot.ini if needs be from Linux as the floppy disk is FAT32.
Be sure to follow the link's instructions about how to format the floppy exactly the way they say or it won't work.

Now back to what we were doing,
9) Remember to click 'file', and 'save' (the changes), as you normally would before closing any file,     and close the file.

To re-assert the security attributes for Windows boot.ini file for security, go back to the dos terminal window we left open, or open it again if you closed yours and,
C:\>attrib +s +h +r boot.ini
11) Type the following command,     C:\>attrib +s +h +r boot.ini        and press 'Enter'.

C:\>exit

C:\>exit

That's it!


10) When you reboot, you should see the Windows NTLDR boot menu, as shown below,
Please select the operating system to start:


      Microsoft Windows XP Home Edition
      Start Grub
     


Use the up and down arrow keys to move the highlight to your choice.
Press ENTER to choose.
Seconds until highlighted choice will be started automatically: 30











For troubleshooting and advanced startup options for Windows, press F8.

10) Now when we reboot, we will see the Windows boot menu appear to give us a choice between Windows and WinGRUB. At this stage your computer will boot Windows okay, but since WinGrub is not installed yet, nothing happens if you select 'Start Grub', the computer will just reboot. (Well, that's all mine does, anyway).


Part 2
Download and Install WinGrub

To install WinGrub, first download a copy of WinGrub, WINGRB0206.EXE from http://sourceforge.net/projects/grub4dos

WinGrub web forums, http://sourceforge.net/forum/?group_id=104188

News:
GRUB4DOS bug fix Here is a thread  in Ubuntu Web Forums in which you may be able to get the most up to date grldr.


In my computer, I downloaded the WinGrub installer, named WINGRB0206, to my 'My Downloads' folder.
If you don't have a 'My Downloads' folder yet inside 'My Documents', you don't need one, but it's a good idea. That's a good handy location to store all your downloaded software 'installers', so when you need to make a backup, you can include those in your backup easily. That way you can restore the same added software after a re-install without too much fuss. 

I double-clicked on the installer's icon and received a window titled 'WinGrub 0.02 Build 6 Setup: Installation Options'.

The options are, 'Type of install:'   ('Full', 'Normal', 'Minimum', or 'Custom').
I left the spinbox set to 'Full' for mine.

Right under that spinbox are: 'WinGrub GUI', 'Stage Files', Create shortcut', and Create Desktop Icon'.
The first three checkboxes were already checked, and I also added a tick mark to the fourth checkbox, to have the installer create a desktop icon for me.
I guess that makes it a 'custom' install. The spinbox resets to 'custom'. Okay.
Next>

The next Window is to tell me where WinGrub wants to be installed, or allow me to browse for an alternative location if the default location isn't suitable for me. I just clicked 'Install'.
Install

As quick as a flash, a new Windows appeared and a blue progress bar zipped across it, a new icon appeared on my desktop, and WinGrub was installed.

That was simple wasn't it? :)

Now I see a nice new icon has been added to my Desktop.

Now I double-click the WinGrub icon on my Desktop, and a Window titled 'Base Setup' opens.

The 'Base Setup' Window has a field with a big empty space in the middle titled 'Choose Drive'.

In my computer there is one line in the top of that space. It says, 'C-Free:7300M,  Total: 13548M'
I selected that line with my mouse.
I imagine in some computers there might be a list of partitions you could install WinGrub in, but I only have one.
I clicked 'Ok'.

The next Windows opens, it's called 'WinGrub -C:\Grub\
The big square in this one is titled 'General Options'.
I clicked the 'Profiles' spinbox and down came a list of options, 'sample', 'default', 'netboot', and 'dskboot'.
I selected the last one, 'dskboot'.

Below the 'General Options' rectangle in the same Window there is a box called 'Menu table', in which the lower left field has just changed to show some terms I'm familiar with.

I clicked on the top line, '<load /boot/grub/menu.lst>', and this caused some output to appear in the right-hand side fields.
The top field, called 'title', now has 'load /boot/grub/menu.lst' printed in it.
Right under that in the next field, I see' find --set-root /boot/grub/menu.lst
                                                               configfile /boot/grub/menu.lst

Finally, back up in the  upper rectangle, just to the right of the 'Profiles' spinbox, which is set to 'dskboot', there's a 'save' button. It doesn't have 'save' written on it anywhere, but I can tell what it's for by the icon. I clicked that.
 
In the 'Base Setup' window again I clicked 'tools'-->'install Grub',
and in the 'Install Grub' Window I saw system drive 'C' was pre-selected.
I clicked on the radio button for BOOT.INI
and hit the 'Install' button at the bottom middle of that window.

Then, I closed the WinGrub Setup and rebooted my computer.

Please select the operating system to start:


      Microsoft Windows XP Home Edition
      Start Grub                                          
     


Use the up and down arrow keys to move the highlight to your choice.
Press ENTER to choose.
Seconds until highlighted choice will be started automatically: 30











For troubleshooting and advanced startup options for Windows, press F8.

 I selected 'Start Grub', and WinGrub will automatically scan my hard disk and load the /boot/grub/menu.lst of the first Gnu/Linux installation it finds that has that file installed in it.

That brings up my Gnu/Grub menu as shown here below,

 



Ubuntu, kernel 2.6.17-10-generic                                          
Ubuntu, kernel 2.6.17-10-generic (recovery mode)
Ubuntu, memtest86+
Other operating systems:
Microsoft Windows XP Home Edition


   Use the up or down arrow keys to select which entry is highlighted.
Press enter to boot the selected OS, 'e' to edit the
commands before booting, or 'c' for a command-line.


The highlighted entry will be booted in 10 seconds.


If it boots to grub error 26: Disk read error, that means you forgot to edit your menu.lst file first and 'hash out' the savedefault command. WinGrub can't handle Ubuntu's Grub version's 'savedefault' commands.
Press any key to continue...  (this brings you back to your grub menu again),
press 'e' to edit the menu entry, select the 'savedefault' command, press 'd' to delete that, and 'b' for boot.

Ubuntu will boot!

To get WinGrub to boot Ubuntu up without having to press 'e' for edit at the grub menu each time, it is a good idea to edit
/boot/grub/menu.lst in Ubuntu, and 'comment out' the savedefault commands. (See example below),

  title        Ubuntu, kernel 2.6.15-25-386
root        (hd0,1)
kernel        /boot/vmlinuz-2.6.15-25-386 root=/dev/hda2 ro quiet splash
initrd        /boot/initrd.img-2.6.15-25-386
# savedefault
boot

Now WinGrub should be installed and set up and working properly in your dual or multiple boot PC.

.............................................................................................................................................................................................

Please select the operating system to start:


      Microsoft Windows XP Home Edition
      Start Grub                                          
     


Use the up and down arrow keys to move the highlight to your choice.
Press ENTER to choose.
Seconds until highlighted choice will be started automatically: 30











For troubleshooting and advanced startup options for Windows, press F8.