Linux has been my primary desktop OS since 1998. I use Windows less every year, but I still keep a Windows partition for the odd application, usually a game. I have the best results with Windows 2000 Pro (Win2k), but this information can be applied to any version of Windows through Windows XP.

The Windows bootloader is designed to make things tough on users like us. It insists on installing to and booting from the MBR of /dev/hda. LILO and GRUB can boot from any active primary partition on /dev/hda so I always installed Windows to /dev/hda1 and installed my Linux bootloader to boot from my /boot partition on /dev/hda2, which I created as an active primary partition. Since Windows frequently needs to be reinstalled, this helped avoid the inevitable overwriting of the MBR by Windows.

For some reason, however, Win2k and XP change their own system partition to be the active partition any time I boot them. This of course prevents my preferred bootloader from booting, but GRUB provides a way to safely contain such viral activity.

GRUB provides a way for you to trick Windows to boot from a slave drive (/dev/hdb in this example). First you have to configure a hard drive as /dev/hda (master drive on the primary IDE bus) in order to successfully complete the installation of Windows. Once that is done, configure the hard drive to be the slave drive on that IDE bus. Add your Linux hard drive as the master on the same bus. Complete the installation of Linux on the master drive. Now you have Linux on /dev/hda and Windows on /dev/hdb. We will assume that you installed the Linux /boot directory to /dev/hda1 and the Windows system partition on the C: drive (/dev/hdb1).

Here is the contents of my /boot/grub/menu.lst file with added explanatory comments. Everything after a # is my added comment, and the comments are not in my actual menu.lst file, although they should not hurt. GRUB counts everything starting from 0.

# BEGIN /boot/grub/menu.lst

default 0 # This sets the first menu entry to boot by default.
timeout 5 # There will be a 5 second delay before the default is booted
splashimage=(hd0,0)/boot/grub/splash.xpm.gz # The boot menu graphic

title=Gentoo # This is the name displayed for the first entry
root (hd0,0) # GRUB's way of pointing to /dev/hda1 (drive 0,partition 0)
kernel /boot/bzImage root=/dev/hda3 # kernel name and / location

title=Windows 2000 Pro
map (hd0) (hd1) # Tell the first hard drive to pretend to be the second
map (hd1) (hd0) # Tell the second hard drive to pretend to be the first
root (hd1,0) # Tell GRUB Windows is on /dev/hdb1 (No pretending here)
rootnoverify (hd1,0) # GRUB won't attempt to mount the Windows drive
makeactive # Sets the partition to active
chainloader +1 # Tells GRUB to load the Windows bootloader when done

# END of /boot/grub/menu.lst

The syntax of the Windows root and rootnoverify commands was a bit confusing because I originally assumed I should map to the partition after the map commands swapped drive locations, but GRUB is not fooled by that. When I saw that it was trying to mount an ext3 file system instead of FAT32, I figured out what was wrong.

I know and like LILO. GRUB has some nice features, though, and it is the future so I recommend you take the time to learn it. I hope this "How To" is helpful.

It can be frustrating when no one replies to your hard work, so I wanted to say thank you.

I knew GRUB could switch the mapping of drives, but haven't wanted to figure it out yet.

So thanks for taking the time to write that out for those of us with limited time. Now I can at least contain windows to one drive.... "Bad OS! Go sit by yourself"_________________-----
Toshiba Satellite A15-S157, 2.2 Celery, 40GB, 512MB
AMD Athlon XP 1900+, 640MB PC2100, ABIT KG-7R
IBM 120GB (Linux), WD 30GB (WinDoze), ATI All-In-Wonder 128 Pro PCI

i just installed gentoo, and i made everything work, up to grub. i had some problems before, but i did as the installation manual told me, and everything worked. but, the installation manual calls the file with all the stuff "grub.conf", not "menu.lst". when i booted up, it just went to the grub menu, and i couldn't boot (or at least i don't know the command to boot from the "grub>" prompt). does the fact that i made a "grub.conf" as opposed to "menu.lst" file matter? i'd just like to clarify that problem.

grr, i just realized i missed the tiny line in the manual that tells you to link the two files. is there a way to do this without reinstalling and recompiling everything?

Ian,
It sounds like you have identified your error, and all you really need to do is mount your file system to create a link to complete that last step. There are good instructions for "Using Gentoo CD to repair a broken system" here:

Other bootable Linux installation CDs give you the same disaster recovery capabilities, but I assume you have a Gentoo CD handy since you just completed the installation.

Whatever you do, don't panic and do something rash. Your system definitely sounds salvageable. You should not need to install your system again unless you want to. Of course, installing again is a good way to learn, but having new experiences using new tools to fix problems like this is also a good way to learn.

lol, i actually went back right after i posted this and tried doing just what you said, and amazingly, it worked. after that things went downhill though...

grub came up perfectly fine, and looked all pretty. i hit enterto boot linux, and i got a kernel panic, probably because i made another stupid mistake earlier in the install. it may be because i did a stage1 install, and i'm still not sure what the variables were supposed to be set at , so i think i'm gona go back and try a stage2 or 3 install to avoid that. also, when i tried to boot windows from grub, it didn't want to work either, but luckily they're on seperete physical drives, and my bios can boot off of drive 0 - 3, so i can choose at will which to boot from (makes it much easier if i get fustrated and want to ignore linux for a while ). i think i have to try redoing a complete install (from stage2 or 3) using the above tips, and it will hopefully work this time .

grub came up perfectly fine, and looked all pretty. i hit enterto boot linux, and i got a kernel panic, probably because i made another stupid mistake earlier in the install. it may be because i did a stage1 install, and i'm still not sure what the variables were supposed to be set at , so i think i'm gona go back and try a stage2 or 3 install to avoid that. also, when i tried to boot windows from grub, it didn't want to work either, but luckily they're on seperete physical drives, and my bios can boot off of drive 0 - 3, so i can choose at will which to boot from (makes it much easier if i get fustrated and want to ignore linux for a while ). i think i have to try redoing a complete install (from stage2 or 3) using the above tips, and it will hopefully work this time .

Usually when I get kernel panics in a newly installed system, the problem is actually with the grub.conf (or menu.lst) file. It's usually because I used the wrong hdd assignments for the root and/or kernel lines. These mistakes most likely occur when you are using 2 hard drives.

One way to make debugging this specific problem faster is to use multiple entries in the grub.conf file, using different kernel lines on each one. That way, you don't have to boot into the install CD to change the file all the time; you can simply reboot and choose a differently configured menu item.

Also, another quick way of testing the validity of an entry. If the blue graphic comes up in the grub bootloader, you know you have the right boot partition selected. Now, use the same partition combination (eg (hd0,0), hd(1,0), etc) for the "root" line._________________Get Firefox!

A slight variation which works a little better with the installation instructions. Will boot a new kernel by default but still provides the old one if this fails...saves modifying the list again after the new kernel is found to work

I currently run Debian in my home workstation, and it dual-boots with W2K. And I have a strange problem with it. Here is my setup:

Debian is in my first HD in /dev/hda (10gig HD). W2K is in my first ATA100-port (/dev/hde if I remember correctly. 30gig HD). First I had LILO installed in hda, and I had it set to boot both Debian and W2K. Debian booted like it should, but W2K wouldn't. It would start and then it would just hang (before you get the "progress-bar" in the bottom of the screen. Before the splash-screen). I never figured out how to fix that. So I started using a bit less elegant solution: My first boot-device is the floddy-drive, with second boot-device being the ATA100. When I want to run Linux, I insert my Debian boot-disk that boot up Debian. When I want to run W2K, I remove the boot-disk.

What could be causing the problem I described? How do I work around it? I would like to get rid of boot-floppies (not the most reliable thing in the world) when I migrate my workstation to gentoo.

I got help earlier with this but I must say your explanation cleared ut up greatly!

I love actually understanding why I do things and not just do them because someone told me it was the right way

Thank you!_________________72 of Pitcairn Islands 49 inhabitants use Seti@Home
"If you buy a DVD you have a copy. If you want a backup copy you buy another one."
"Anyone who is capable of getting themselves made President should on no account be allowed to do the job."

Thanks for a wonderful topic! I'll be using this soon as Windows is migrated off my box! (can't wait!)

Quick question about the rootnoverify;
I have tried to install grub several times with Win2k as hda, but when Win2k is selected from the menu, i get a blank screen then the grub menu reappears (as if it's looping). Had to reinstall Win2k after this.

Does the rootnoverify option take care of this...or am i barking up the wrong tree?

Hope i'm not too off topic...and thanks!_________________Open-mindedness is painful...

i am running gentoo 1.4 rc2, which i installed from the live cd. i tried the procedure above since i am running gentoo on my first hdd and windows xp on my second hdd but grub said that it did not recognise the map command. can some one help me out...