Find the answer to your Linux question:
Results 1 to 7 of 7
I am trying to configure a system to boot Windows XP, CentOS 4 and RHEL5. I have one hard drive that contains both Windows XP and CentOS 4, and a ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    3

    [SOLVED] GRUB configuration problem

    I am trying to configure a system to boot Windows XP, CentOS 4 and RHEL5. I have one hard drive that contains both Windows XP and CentOS 4, and a separate drive that contains RHEL5. Until recently, I only had one SATA cable, so I could only connect one drive at a time. Under this configuration, everything works fine. When the RHEL5 drive is connected, I can boot into it. When the Windows/CentOS drive is connected, I can dual-boot into either OS. (GRUB was configured on this drive automatically when I installed CentOS into a new partition.)

    Opening the box and moving the SATA cable is a lot of trouble, so I finally got a second SATA cable and enabled both SATA0 and SATA1 in the BIOS. I currently have the Windows/Centos drive as the primary, and I can still boot into both Windows/Centos. Now, I want to add RHEL5 to menu, but I can't find the file GRUB is using to present its menu at startup.

    I have configured GRUB before on other systems, but I just know the very basics, such as where the grub.conf file should be. So, I spent a whole day reading advice online and asking friends who might have experience with these issues. Here are the steps I have taken so far:

    I confirmed there is no /boot/grub directory, and /etc/grub.conf is a broken soft-link to /boot/grub/grub.conf. I did a find for grub.conf, which found nothing. I did a find for menu.lst, which found one item -- an example GRUB config file in /usr/share/doc/grub-0.95. I noticed that when CentOS boots, I see the GRUB commands printed to the screen, the first of which is:

    root (hd0,2)

    So, I did a grep -R "(hd0" * at the / directory, which also found only one item -- the example menu.lst file in /usr/share/doc/grub-0.95. I discovered that I can go to the command line grub from the grub menu and do:

    cat (hd0,2)/grub/grub.conf

    The cat command returns a printout of the grub configuration the system is obviously using. I didn't create this file, but the titles are identical to what I see in the GRUB menu, the default boot is Windows, and the timeout is very short. This must be the file. It looks like:

    default=2
    timeout=5
    splashimage=(hd0,2)/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (2.6.9-89.ELsmp)
    root (hd0,2)
    kernel /vmlinuz-2.6.9-89.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
    initrd /initrd-2.6.9-89.ELsmp.img
    title CentOS-up (2.6.9-89.EL)
    root (hd0,2)
    kernel /vmlinuz-2.6.9-89.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
    initrd /initrd-2.6.9-89.EL.img
    title Windows XP 32-bit
    rootnoverify (hd0,1)
    chainloader+1


    However, when I am booted into CentOS, which is supposedly (hd0,2), there are no /boot/grub/grub.conf or /grub/grub.conf files to edit.

    I talked with a friend who has a successful triple-boot configuration who sent me the contents of her /boot/grub directory. I tried creating the /boot/grub directory and populating it with my friend's files. Then, I modified her grub.conf to be the current grub configuration (above) with modified title names so I can tell from the GRUB menu if it is using the old or the new file. After reboot, it is still using the old title names.

    Although I don't think my GRUB is broken -- it works just fine for the two OS's it is configured for -- I tried to re-install GRUB by giving the command:

    grub-install /dev/sda

    That command gives an error that says:

    /dev/mapper/VolGroup00-LogVol00 does not have any corresponding BIOS drive.

    I'm not really sure what that means, and the Logical Volume Management utility doesn't give me any information that makes sense to me. I have seen other forum experts ask for the output of fdisk -l for problems related to grub and partitioning, so if it helps, my output is:

    Disk /dev/sda: 80.0 GB, 80000000000 bytes
    255 heads, 63 sectors/track, 9726 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 5 40131 de Dell Utility
    /dev/sda2 6 5105 40965750 7 HPFS/NTFS
    /dev/sda3 5106 5118 104422+ 83 Linux
    /dev/sda4 5119 9726 37013760 5 Extended
    /dev/sda5 5119 9726 37013728+ 8e Linux LVM

    Disk /dev/sdb: 250.0 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 13 104391 83 Linux
    /dev/sdb2 14 30401 244091610 8e Linux LVM


    I've also tried making the RHEL5 drive the primary drive. In that case, I can modify the existing /boot/grub/grub.conf file and see my changes at the GRUB boot menu. However, I can't get Windows to boot in this configuration. I've done a lot of google searching on the topic and added map commands to make Windows think it is on the primary drive. But, I'm still unsuccessful on this front as well. I think I'm closer to solving the problem with Windows/CentOS as the primary. However, if you think I will have more success with RHEL5 as the primary drive, I can provide more details as to my current grub.conf on that drive in a later post.

    Any advice you have is greatly appreciated. Thank you in advance!

  2. #2
    Just Joined!
    Join Date
    May 2010
    Posts
    3
    I finally located the grub.conf file my CentOS is using. Based on a forum post, I discovered it was stored on a different partition. After booting into CentOS, I mounted /dev/sda3. In this partition was a grub/grub.conf, which I successfully modified and saw the changes at reboot.

    Now, I have one more problem. I took the GRUB commands from my RHEL5 /boot/grub/grub.conf file, which was automatically generated by the RHEL5 installer and successfully boots RHEL5 when the RHEL5 drive is the primary drive. These commands are:

    root (hd0,0)
    kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
    initrd /initrd-2.6.18-53.el5.img

    I changed the root command to refer to hd1 and placed these commands into a new entry in my CentOS grub.conf. The new entry looks like:

    title RHEL5
    root (hd1,0)
    kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
    initrd /initrd-2.6.18-53.el5.img

    However, when I choose the RHEL5 from the menu, it acts like it is booting CentOS, but it eventually fails and lets me try to login to the shell.

    Does anyone have any advice on what I should change the root= portion of the command to, or if there is something else I am doing wrong with this configuration?

    Thanks again.

  3. #3
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Hi and Welcome !

    You are using LVM in both OSes and as GRUB doesn't support LVM, installer has created separate /boot partitions for both distros. All configuration files of grub, kernels and initrd images are located in /boot partitions only.

    Boot up CentOS and mount /dev/sdb1 partition. Its /boot partition of RHEL. Post the contents of its boot/grub/grub.conf file here.


    Post the contents of grub.conf file of CentOS too. Its /dev/sda3.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  4. #4
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    351
    Have never used LVM but something looks wrong:
    title CentOS-up (2.6.9-89.EL)
    root (hd0,2)
    kernel /vmlinuz-2.6.9-89.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
    title RHEL5
    root (hd1,0)
    kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
    both 'root=' are the same, and that might be a problem (?).

    Another problem is when the hdd is moved to a different IDE channel the /etc/fstab is likely wrong.

    Do let 'devils casper' give his option on this.

  5. #5
    Just Joined!
    Join Date
    May 2010
    Posts
    1
    Thanks you for the post.
    Hi guys, Im a newbie. Nice to join this forum.

  6. #6
    Just Joined!
    Join Date
    May 2010
    Posts
    3

    Solved!

    LostFarmer, you are exactly right. Since I had originally set up the two drives separately, both CentOS and RHEL5 had installed on as VolGroup00/LogVol00. When I put the drives in the same system, there was a conflict. The output of lvscan showed that two volumes' UUIDs were conflicting and that they system was randomly choosing one of them (in my case CentOS) to load.

    To fix it, I renamed the volume group RHEL5 was installed on using:

    vgrename <UUID shown as conflicting from lvscan> VolGroup00_rhel5

    I updated my grub.conf entry for RHEL5 to use VolGroup00_rhel5 instead of VolGroup00, and I added entries to /etc/fstab for VolGroup00_rhel5.

    Then, I had to update links within the kernel image to point to VolGroup00_rhel5. Sounds hard, but I followed the directions I found on another site "Working with Multiple LVM Hard Disks under Fedora Core Linux", and I can now boot all three systems! Here are the steps I took to update the image:

    mkdir /mnt/sdb1
    mount /dev/sdb1 /mnt/sdb1 #(the boot partition of my rhel5 drive)
    cd /mnt/sdb1
    mkdir newinit
    cd newinit
    gunzip -c ../initrd-2.6.18-53.el5.img | cpio -idmv
    # or whatever initrd version file you have

    Then, I edited the "init" file to replace all instances of VolGroup00 with VolGroup00_rhel5. Repackage a new image. (First rename the original one out of the way to save it so you can restore it later if need be.) Then, still within the "newinit" directory, do:

    find . | cpio --quiet -c -o > ../newinitrd
    cd .. # we are now in /mnt/sdb1
    gzip -9 < newinitrd > initrd-2.6.18-53.el5.img
    # or whatever it was called before...EXACTLY
    sync
    cd /
    unmount /mnt/sdb1
    unmount /mnt/VolGroup00_rhel5/LogVol00
    sync

    Thanks everyone for your help!

  7. #7
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    351
    Thanks for posting your solution, it may help others. I would have been lost, O I still am.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...