Link to home
Start Free TrialLog in
Avatar of helpmealot
helpmealot

asked on

grub.conf / dual boot redhat 9 and WinXP

Hello,

My guess is that this question has been asked hundreds of times and will thus be an easy 250 points for someone :)  Enjoy.

Here is my hard drive configuration (view in monotype font for better readability)

===========================================================================================================
Partition Information for Disk 1:    28,623.6 Megabytes
Volume         PartType    Status    Size MB    PartSect  #   StartSect  TotalSects
===========================================================================================================
               Linux Ext3  Pri,Boot    101.9           0  1          63     208,782
               Linux Ext3  Pri      20,528.4           0  2     208,845  42,042,105
*:SWAPSPACE2   Linux Swap  Pri       1,992.4           0  3  42,250,950   4,080,510
               ExtendedX   Pri       6,000.8           0  0  46,331,460  12,289,725
Info: MBR Partition Table not in sequential order.
               EPBR        Log       6,000.8        None --  46,331,460  12,289,725
E:LINUX CDS    FAT32       Log       6,000.8  46,331,460  0  46,331,523  12,289,662


===========================================================================================================
Partition Information for Disk 2:    43,974.8 Megabytes
Volume         PartType    Status    Size MB    PartSect  #   StartSect  TotalSects
===========================================================================================================
               Unallocated Pri           7.8        None --          63      16,002
               ExtendedX   Pri,Boot 43,967.0           0  0      16,065  90,044,325
               EPBR        Log       8,001.1        None --      16,065  16,386,300
F:             NTFS        Log       8,001.1      16,065  0      16,128  16,386,237
               Unallocated Log      35,965.8        None --  16,402,365  73,658,025


===========================================================================================================
Partition Information for Disk 3:    190,779.7 Megabytes
Volume         PartType    Status    Size MB    PartSect  #   StartSect  TotalSects
===========================================================================================================
C:             NTFS        Pri,Boot 49,999.1           0  0          63 102,398,247
               ExtendedX   Pri      140,780.5           0  1 102,398,310 288,318,555
               EPBR        Log      140,780.5        None -- 102,398,310 288,318,555
D:             NTFS        Log      140,780.5 102,398,310  0 102,398,373 288,318,492

Additional information:
Disk 1 (30gb) is connected to the Primary IDE controller and set to Master
Disk 2 (45gb) is connected to the Primary IDE controller and set to Slave
Disk 3 (200gb) is connected to a separate PCI controller (Promise Ultra100 TX2).  Disk3 is the only device on this controller and is configured as "Single"

Windows XP is installed on Disk3.
Disk 1 has a FAT32 partition for holding Linux setup CD images, and Disk1 holds the Linux installation itself.

When I setup Linux, I had it install GRUB to the MBR of disk1.  I reconfigured the system BIOS to boot from disk1 instead of disk3.  Thus, when the computer boots, I'm presented with the GRUB menu from which I can choose which OS to boot.  Unfortunately, if I choose "Windows" it does not boot.  It spits out:

"Booting Windows
rootnoverify (hd0, 4)
chainloader +1"

and then sits there.

Linux boots fine from this menu.

I am still able to get into Windows by changing the BIOS setting to boot from disk3 instead of disk1.  This is cumbersome, and is what this question is about:
How do I reconfigure GRUB so that it boots windows properly on this system?

Here is the /boot/grub/grub.conf file:

==============
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=2
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Linux (2.4.20-8smp)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8smp ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8smp.img
title Linux-up (2.4.20-8)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8.img
title Windows
      rootnoverify (hd0,4)
      chainloader +1
==============

I am confident the problem lies with the line: "rootnoverify (hd0,4)" but I am unsure what values to put in there.  So, how do I tweak the above grub.conf file so that I can boot Windows XP and Linux?

Thanks!
Avatar of b_vishwajit
b_vishwajit

(hd0, 4) >>(hd0, 2)
Avatar of helpmealot

ASKER

Hello,

Thanks for your concise response.  I'm not at the computer at the moment, but could you at least briefly explain the logic you used to arrive at this answer?  hd0 seems to be the drive on which linux is installed, and as you can see from the disk layout, windows is not on that same disk.  How could your answer possibily be right?
I _think_ your XP disk is /dev/hdc.  HOWEVER, please don't take this as gospel, since you have not posted an fdisk partition table.  I would boot to Linux, then try fdisk -l /dev/hdc .  Here's my /dev/hda for comparison:

Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1         7     56196   83  Linux
/dev/hda2   *         8      4085  32756503+   7  HPFS/NTFS
/dev/hda3          4086     14593  84405510    f  Win95 Ext'd (LBA)
/dev/hda5          4086      4149    514048+  82  Linux swap
/dev/hda6          4150     14593  83891398+  83  Linux

You're looking for something akin to that HPFS/NTFS, which BTW is my XP Professional partition.

Now, _IF_ your disk 3 is /dev/hdc (and I can't think of any reason why it shouldn't be) then you should try adding the following entry to your grub.conf:

title=XP Pro
root (hd2,0)
chainloader (hd2,0)+1

Remember, Grub counts from 0, so (hd2,0) equates to /dev/hdc1.  Note that I use 'root' instead of 'rootnoverify' here, as the former should work just fine.

It won't hurt to try this, and I suspect it will boot XP for you.  Do check with fdisk -l first, however.
Hello,

Here are the complete results from fdisk -l:

==============================
Disk /dev/hde: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot    Start       End    Blocks   Id  System
/dev/hde1   *         1      6374  51199123+   7  HPFS/NTFS
/dev/hde2          6375     24321 144159277+   f  Win95 Ext'd (LBA)
/dev/hde5          6375     24321 144159246    7  HPFS/NTFS
 
Disk /dev/hda: 30.0 GB, 30020272128 bytes
255 heads, 63 sectors/track, 3649 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot    Start       End    Blocks   Id  System
/dev/hda1          2885      3649   6144862+   f  Win95 Ext'd (LBA)
/dev/hda2   *         1        13    104391   83  Linux
/dev/hda3            14      2630  21021052+  83  Linux
/dev/hda4          2631      2884   2040255   82  Linux swap
/dev/hda5          2885      3649   6144831    b  Win95 FAT32
 
Partition table entries are not in disk order
 
Disk /dev/hdb: 46.1 GB, 46115758080 bytes
255 heads, 63 sectors/track, 5606 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *         2      5606  45022162+   f  Win95 Ext'd (LBA)
/dev/hdb5             2      1021   8193118+   7  HPFS/NTFS
==============================

As you can see, the 200gb hard disk is actually /dev/hde.  I neglected to mention earlier that I have two optical drives on the secondary IDE channel, which is why I needed a separate PCI IDE controller for the 200gb hard disk.  /dev/hda is the drive on which Linux is installed, and the one which is chosen to be booted from in the BIOS.

In any case, I tried tweaking the grub.conf file as you suggested, and upon trying to boot windows from it, was greeted with the following:
"root(hd2,0)
Filesystem type unknown, partition type 0xf
chainloader (hd2,0)+1"

Since the 200gb disk is actually /dev/hde, not /dev/hdc, how should I modify the grub.conf file?  Thanks for your help.
Aha!  Now we're talking.  Ok, you're blessed with a lot of storage.  I tend to just buy more computers!  Anyway...

/dev/hde is (hd4) in grub-ese.  The first partition on that disk appears to be XP, and is marked with the boot flag.  Therefore, my suggestion for your grub.conf would be:

title=XP Pro
root (hd4,0)
chainloader (hd4,0)+1

This is taken directly from my grub.conf (with drive numbers changed, of course), which boots my XP partition flawlessly.  It Should Work (TM).  If it doesn't, I'll check back with this topic in a short while so let me know.
I tried changing the /boot/grub/grub.conf file as you suggested.  Upon rebooting, and selecting windows from the list, it spat:

"Error 21: Selected disk does not exist"

I can confirm that the first partition on the 200gb drive is the one on which windows XP is installed.  Could it be confused because of the separate PCI IDE controller?

Here is the complete, modified, grub.conf file, as found in /boot/grub

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=2
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Linux (2.4.20-8smp)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8smp ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8smp.img
title Linux-up (2.4.20-8)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8.img
title Windows
      root (hd4,0)
      chainloader (hd4,0)+1
I looked in /boot/grub/device.map, and that file contained:

================
# this device map was generated by anaconda
(fd0)     /dev/fd0
(hd0)     /dev/hda
================

I tried changing it to this:
================
# this device map was generated by anaconda
(fd0)     /dev/fd0
(hd0)     /dev/hda
(hd4)     /dev/hde
================

but that had no effect--I was presented with the same error upon rebooting.  Perhaps this provides a clue as to what else I need to change.  I'm pretty new to Linux :)
Hrm.  Life's never that simple, is it?  Ok, I think I steered you wrong because GRUB's manual has the following reference regarding Windows on a non-first drive:

----
GRUB cannot boot DOS or Windows directly, so you must chain-load them (see Chain-loading). However, their boot loaders have some critical deficiencies, so it may not work to just chain-load them. To overcome the problems, GRUB provides you with two helper functions.

If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one. The workaround used in GRUB is the command map (see map), like this:

grub> map (hd0) (hd1)
grub> map (hd1) (hd0)

This performs a virtual swap between your first and second hard drive.
----

Let's try the following grub.conf entry:

title=Windows XP
map (hd0) (hd4)
map (hd4) (hd0)
rootnoverify (hd0,0)
chainloader +1
makeactive

I should stress that at this point I'm experimenting, since none of my additional hard drives have XP installations on 'em!  I usually keep XP to a bare minimum around here, if in fact it is present at all.

If this doesn't work you may need to hide the other NTFS partition on the disk during boot, but I hope not.  Waiting with interest for your results.
Another thought occurs: if you still have no luck, try moving the device.map file away and see if GRUB will detect your drive properly.  IOW, something like "mv /boot/grub/device.map /boot/grub/device.map_old".  My GRUB was installed without one.  The "Selected disk does not exist" is usually GRUB's way of saying a drive isn't recognised by the BIOS (or isn't present at all, obviously).

BEFORE you do this, make sure you have a boot disk for your Linux, as I don't want you to render your system completely unbootable!  In fact, I probably should have told you to do this earlier ;o)
It didn't work, but it's no worse than before :)  I hadn't seen your second comment when I tried it though.

Here's the new grub.conf:

===============
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=2
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Linux (2.4.20-8smp)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8smp ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8smp.img
title Linux-up (2.4.20-8)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8.img
title Windows
      map (hd0) (hd4)
      map (hd4) (hd0)
      rootnoverify (hd0,0)
      chainloader +1
      makeactive
===============

When I selected windows from the grub menu, it gave me this error "Error 12: Invalid device requested"

As far as ruining Linux, it's no problem since it's a fresh install.  I do have a boot disk for it though.  Ruining windows would be a somewhat greater bother, but I have lots of windows boot disks with various utilities (in particular, Partition Magic) so that shouldn't be a problem.

I'll await your response before getting rid of device.map
Right, one more tweak.  Although we've swapped the drives for booting, the rootnoverify line needs to refer to the actual drive.  So your entry looks like this:

title Windows
    map (hd0) (hd4)
    map (hd4) (hd0)
    rootnoverify (hd4,0)
    chainloader +1
    makeactive

Once again I stress, I'm experimenting and you should take all available precautions.  I wouldn't blame you a bit if you decided to wait for someone who's actually done this before.  I'll hold comment on the device.map business until after I hear how this latest trial goes.  I would leave the (hd4) line that you added in the file, though.
Alright, I made that change, but upon selecting "Windows" GRUB returned the error "Error 21: Selected disk does not exist"

I probably won't be at my computer for at least the next 12 hours, so feel free to take your time :)
Well, dang.  I have to go to work now, will consider it subconsciously for the next few hours.  This may all be a BIOS thing, in which case changing GRUB configuration may not be very much help.
Hi.  I don't know if it's ethical to have my problem be addressed in this thread but my problem is related.

I have three OSs installed on two disks.  I installed Windows XP Pro on disk 1, Windows Server 2003 Web on disk 2, and Red Hat Linux 9 on an extended logical partition on disk 1.  I installed them in that order.  Before installing RHL9, I was dual-booting with the two Windows OSs.  After I installed RHL9, using grub as my boot loader, I now have 3 entries in my boot menu.  Here's the contents of the grub.conf file:

--------
default=0
timeout=10
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
title Windows XP Pro
      rootnoverify (hd0,0)
      chainloader +1
title Windows Server 2003, Web
      rootnoverify (hd1,0)
      chainloader +1
title Red Hat Linux (2.4.20-8)
      root (hd0,4)
      kernel /boot/vmlinuz-2.4.20-8 ro root=LABEL=/ hdd=ide-scsi
      initrd /boot/initrd-2.4.20-8.img
--------

When I boot Linux, it's fine, but when i boot any of the two Windows OSs, it takes me to the boot.ini menu that I originally had before I installed Linux.  Is there a way of bypassing boot.ini?  Advanced thanks for your future help.
Hmm, since your question is not really the same as mine, you would probably be served best by posting it as a separate question in this topic area.  Simply copy and paste what you wrote here into a new question.  Then other folks visiting experts-exchange will be able to address your question and my question separately.  Having two parallel discussions progressing in this thread would no doubt make for confusing reading.
>> This may all be a BIOS thing
For what it's worth, this computer is essentially brand new.  The motherboard is an ASUS P4P800, based on the i865PE chipset.  The BIOS it has now was last updated in the middle of July, and the motherboard was released in late May or so.
ASKER CERTIFIED SOLUTION
Avatar of churcher
churcher

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The other thing you can try is autocompletion.  Go to command line mode, either at boot time or from a linux console (become root, then 'grub').  Type 'root (hd' and then hit TAB; GRUB should give you a list of drives it knows about.  You can then enter a drive number and hit TAB again, and it should show you a list of partitions for that drive.  The output from these may be enlightening, or it may not ;o)
Got it! :)

I went into the GRUB command line mode by pressing 'c'.  I tried entering the commands one by one, and it returned the error 21 on the "chainloader +1" line.  Since this didn't help me at all, I next tried the "root (hd" followed by a tab trick, to see the list of drives.  It returned hd0, hd1, hd2 which is rather odd given the names hda hdb and hde given in Linux itself.

After poking around in the console a bit more, I typed "help" which was, luckily, a supported command.  One of the commands listed was "geometry".  I then issued "geometry (hd0)" "geometry (hd1)" and "geometry (hd2)" to see if I could figure out which drive was which.

LUCKILY, all three drives are of different make and size, so it was easy to tell which was which based on the total number of sectors present on each drive.  The 30gb drive was hd0, and, get this, the 200gb drive with XP was hd1, followed by the 45gb drive which was hd2.  This numbering scheme makes no sense at all to me, since the 30 and 45 are both hooked up to the primary IDE controller, and the 200gb is hooked up to a separate PCI controller.  The numbers assigned may as well be random.  I wonder what logic they apply in numbering the drives?  And is there a better way to find out within the GRUB command line mode which drive is which?  Perhaps by giving the serial number of each drive?

So, I tried typing the following:
   map (hd0) (hd1)
   map (hd1) (hd0)
   rootnoverify (hd1,0)
   chainloader +1
   makeactive
   boot

and lo-and-behold, windows booted.  So I tweaked the grub.conf file to be:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=2
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Linux (2.4.20-8smp)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8smp ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8smp.img
title Linux-up (2.4.20-8)
      root (hd0,1)
      kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ hdd=ide-scsi
      initrd /initrd-2.4.20-8.img
title Windows
      map (hd0) (hd1)
      map (hd1) (hd0)
      rootnoverify (hd1,0)
      chainloader +1
      makeactive

and indeed, this one works.

Thanks for your help!
Wierd.  Maybe GRUB doesn't count the CD-ROM drives?  I should have told you about autocompletion sooner :o)  I guess the moral of the story is, when in doubt go to the command line.

Anyway, glad it worked out ok.
Aha.  It seems that GRUB does not consider CD drives to be boot-capable (even if they are).  I suspect GRUB's numbering has to do with master/slave order.  I think the separate PCI card must have bumped /dev/hde up in GRUB's priorities, counting it before /dev/hdb which is the primary slave drive.  A search on "grub master slave" turned up this potentially enlightening page: http://www.picknowl.com.au/homepages/Tim_Seifert/Linux/restoring_grub.html .  However, you've arrived at the to-be-envied place in troubleshooting parlance, which is: At Least It Works.
I am having a bit problem, please help.

I did a fdisk -l and got the following

Disk /dev/hda: 40.0 GB, 40017485312 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1      4864  39070048+  44  Unknown
 
Disk /dev/hdb: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *         1        13    104391   83  Linux
/dev/hdb2            14      4868  38997787+  83  Linux
/dev/hdb3          4869      4998   1044225   82  Linux swap

My system is actually loaded with XP Pro, I guess from the list it should be /dev/hda1
I am trying Linux and thus got another harddisk. Installation works fine.
However, I am not able to load back my XP Pro.
the error message is File sytem type unknown.
Reading through all the mail, I realise my column under system is unknown. How to make it recognise as XP Pro?
Please help.

My grub.conf is as follows:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd1,0)
#          kernel /vmlinuz-version ro root=/dev/hdb2
#          initrd /initrd-version.img
#boot=/dev/hda
default=1
timeout=10
splashimage=(hd1,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-30.9)
      root (hd1,0)
      kernel /vmlinuz-2.4.20-30.9 ro root=LABEL=/ hdc=ide-scsi hdd=ide-scsi
      initrd /initrd-2.4.20-30.9.img
title Red Hat Linux (2.4.20-30.9smp)
      root (hd1,0)
      kernel /vmlinuz-2.4.20-30.9smp ro root=LABEL=/ hdc=ide-scsi hdd=ide-scsi
      initrd /initrd-2.4.20-30.9smp.img
title Red Hat Linux (2.4.20-8smp)
      root (hd1,0)
      kernel /vmlinuz-2.4.20-8smp ro root=LABEL=/ hdc=ide-scsi hdd=ide-scsi
      initrd /initrd-2.4.20-8smp.img
title Red Hat Linux-up (2.4.20-8)
      root (hd1,0)
      kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ hdc=ide-scsi hdd=ide-scsi
      initrd /initrd-2.4.20-8.img
title Windows XP
      rootnoverify (hd0,0)
      chainloader +1
      makeactive
go to l
www.linuxjalali.com

every thing best in it for linux

and make registration on forum
its forum is best couse admin reply you themself in minuts