LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-11-2006, 11:17 AM   #1
haiders
Member
 
Registered: Sep 2006
Posts: 62

Rep: Reputation: 15
Grub.conf / Dual boot ?!!


I'm trying to triple boot my system with CentOS, winXP and Fedora. I'm using grub as my boot loader. I am able to bring up both winxp and CentOS. I just installed Fedoracore 6 and I installed it without a boot loader. I was hoping to be able to use grub. Fedora is installed on the same disk and the vmlinuz and initrd image are under /dev/sda8. Is there a way for me to configure grub.conf in my centoOS boot loader to load my fedora?

mount /dev/sda8 /mnt/fedora :

[root@prin ~]# cd /mnt/fedora/
[root@prin fedora]# ls
bin boot dev etc home lib lost+found media misc mnt opt proc root sbin selinux srv sys tmp usr var
[root@prin fedora]# ls boot
config-2.6.18-1.2798.fc6xen initrd-2.6.18-1.2798.fc6xen.img System.map-2.6.18-1.2798.fc6xen xen.gz-2.6.18-1.2798.fc6
grub symvers-2.6.18-1.2798.fc6xen.gz vmlinuz-2.6.18-1.2798.fc6xen xen-syms-2.6.18-1.2798.fc6
[root@prin fedora]#


Thanks!
 
Old 12-11-2006, 12:10 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Absolutely---piece o'cake!!

do as follows:
go to Fedora /boot/grub directory
Code:
ln -s vmlinuz* vmlinuz
ln -s initrd* initrd       (These two simply allow you to use short names for the 2 files)
go to the CentOS /boot/grub directory
open menu.lst using favorite editor
add this entry:
Code:
title  Fedora
root (hd0,7)
kernel /boot/vmlinuz root=/dev/sda8
initrd /boot/initrd
reboot and the Fedora option should be there....

Note that grub always refers to drives as "hd" and the numbering starts from 0.
Thus:
(hd0,7) = /dev/sda8

GRUB manual here
 
Old 12-11-2006, 12:11 PM   #3
tuxrules
Senior Member
 
Registered: Jun 2004
Location: Chicago
Distribution: Slackware64 -current
Posts: 1,144

Rep: Reputation: 56
Quote:
Originally Posted by haiders
I'm trying to triple boot my system with CentOS, winXP and Fedora. I'm using grub as my boot loader. I am able to bring up both winxp and CentOS. I just installed Fedoracore 6 and I installed it without a boot loader. I was hoping to be able to use grub. Fedora is installed on the same disk and the vmlinuz and initrd image are under /dev/sda8. Is there a way for me to configure grub.conf in my centoOS boot loader to load my fedora?

mount /dev/sda8 /mnt/fedora :

[root@prin ~]# cd /mnt/fedora/
[root@prin fedora]# ls
bin boot dev etc home lib lost+found media misc mnt opt proc root sbin selinux srv sys tmp usr var
[root@prin fedora]# ls boot
config-2.6.18-1.2798.fc6xen initrd-2.6.18-1.2798.fc6xen.img System.map-2.6.18-1.2798.fc6xen xen.gz-2.6.18-1.2798.fc6
grub symvers-2.6.18-1.2798.fc6xen.gz vmlinuz-2.6.18-1.2798.fc6xen xen-syms-2.6.18-1.2798.fc6
[root@prin fedora]#


Thanks!
Add entry to your centos /boot/grub/menu.lst file
(assuming sda is your primary drive)
Code:
title Fedora Core 6
root (hd0,7)
kernel /boot/vmlinuz-2.6.18-1-2798.fc6xen
initrd /boot/initrd-2.6.18-1.2798.fc6xen.img
Edit: Too late...pixellany stole the show

Last edited by tuxrules; 12-11-2006 at 12:12 PM.
 
Old 12-11-2006, 04:47 PM   #4
haiders
Member
 
Registered: Sep 2006
Posts: 62

Original Poster
Rep: Reputation: 15
Thanks for the quick reply. I updated my menu.lst file as you suggested. Here's my grub.conf:

[root@prin ~]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,2)
# kernel /boot/vmlinuz-version ro root=/dev/sda3
# initrd /boot/initrd-version.img
#boot=/dev/sda3
default=0
timeout=10
splashimage=(hd0,2)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS-4 x86_64 (2.6.9-42.ELsmp)
root (hd0,2)
kernel /boot/vmlinuz-2.6.9-42.ELsmp ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.9-42.ELsmp.img
title CentOS-4 x86_64-up (2.6.9-42.EL)
root (hd0,2)
kernel /boot/vmlinuz-2.6.9-42.EL ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.9-42.EL.img
title WinXP_32bit
rootnoverify (hd0,1)
chainloader +1
title Fedoracore-6 x86_i386_32bit
root (hd0,7)
kernel /boot/vmlinuz-2.6.18-1.2798.fc6xen root=/dev/sda8
initrd /boot/initrd-2.6.18-1.2798.fc6xen.img


Now it seems it see's the image but doesn't recognize the format...Here's my error message:


Root (hd0,7)
Filesystem type is ext2fs, partition type 0x83
kernel /boot/vmlinuz-2.6.18-1.2798.fc6xen root=dev/sda8

Error 13: Invalid or unsupported executable format

Press any key to continue...
 
Old 12-11-2006, 04:55 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
This is a new one on me....

Just a stab in the dark--is the presence of Xen relevant? eg, what are these files (from the first post)?
xen.gz-2.6.18-1.2798.fc6
symvers-2.6.18-1.2798.fc6xen.gz
xen-syms-2.6.18-1.2798.fc6
 
Old 12-11-2006, 05:11 PM   #6
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Try this (to boot it manually)

(1) When the Grub screen appears press "c" to get a Grub prompt

(2) issue commands
Code:
root (hd0,7)
kernel /boot/vmlinuz-2.6.18-1.2798.fc6xen root=/dev/sda8 ro
initrd /boot/initrd-2.6.18-1.2798.fc6xen.img
boot
and report error if any line Grub dislikes.

If those lines work use them in menu.lst but add the "title" statement at the beginning to identify the distro.

In manual booting you can repeat the command as Grub seldom hangs.

Also to avoid typing mistakes you can let Grub help you by say in the 2nd line I would just type the first part as

Code:
kernel /boot/vm
then follow by the tap key and Grub will find a file (or files) that can match it. If there is no other choice Grub will complete the kernel name for you.

The read only parameter "ro" can prevent user from accidentally damaging the setting.
 
Old 12-11-2006, 05:24 PM   #7
haiders
Member
 
Registered: Sep 2006
Posts: 62

Original Poster
Rep: Reputation: 15
Quote:
This is a new one on me....

Just a stab in the dark--is the presence of Xen relevant? eg, what are these files (from the first post)?
xen.gz-2.6.18-1.2798.fc6
symvers-2.6.18-1.2798.fc6xen.gz
xen-syms-2.6.18-1.2798.fc6
I just installed the full distro and those files were in there already. Not sure for what reason.

Saikee,
I did as you said and it fails to recognize the kernel /boot/vmlinuz-2.6.18-1.2798.fc6xen root=/dev/sda8 ro
and gives the same error invalid executable. Is it possible I'm using the wrong vmlinuz file? I can't imagine how it can be corrupted...
 
Old 12-11-2006, 05:38 PM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Perhaps you picked up a wrong distro. With the kernel ending with xen it may be a special distro for certain class of CPUs.

I haven't got FC6 myself but when I checked the kernels in my box are

FC2 is vmlinuz-2.6.5-1.358
FC3 is vmlinuz-2.6.9-1.667
FC4 is vmlinuz-2.6.11-1.1369_FC4
FC5 is vmlinuz-2.6.14-1.1696_FC5
 
Old 12-11-2006, 05:44 PM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
What you may need to do is reinstall and let Fedora be the owner of grub. You now know the correct entries for your other systems, so this is minimum risk. (After Fedora is up and running, edit the grub config file to add others)

Here is one reason I suggest this---from my Redhat setup:
Code:
title Red Hat Enterprise Linux WS (2.6.9-42.0.3.ELsmp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-42.0.3.ELsmp ro root=LABEL=/1 rhgb quiet
        initrd /initrd-2.6.9-42.0.3.ELsmp.img
Note the use of the LABEL=/1 instead of the more usual /dev/something. I don't know how volume labels work, but I do know that Redhat has been criticized for the practice.....
 
Old 12-11-2006, 06:00 PM   #10
haiders
Member
 
Registered: Sep 2006
Posts: 62

Original Poster
Rep: Reputation: 15
I'm pretty sure your solution will work Pixellany, I was just trying to avoid reinstall . I hope the problem is not with hardware saikee because the installation went through seemlessly...I'll work on it again tomorrow and update you. Meanwhile, keep me posted as well. Thanks!
 
Old 12-11-2006, 06:36 PM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Pixellany may have found the cure.

We are doing the standard Linux stuff but the Red Hat family has a dead wish to use label for locating the partition instead of using the raw device name as every other Linux does. You can find the labels if you run cfdisk and/or fdisk as they got displayed there.

My gut feeling is that you may have allowed Fedora slip in a LVM for you in which case I don't know how to get you out as I have been trying to avoid this damn thing. A LVM is a system combining several partitions together. It may be the best thing since slice bread but Grub doesn't see it and so a separate /boot partition must be created to boot the kernel first and let the kernel deals with the LVM. A standard Fedora automatic installation will create a LVM for you and thus using labels becomes logical.

If you haven't got a LVM then amend /etc/fstab and replace the lable name there with the raw device name /dev/sda8 for the "/" could get the system booted. I have done it a few times. I wish the distros would only make life simpler for the general users and stick with the general Linux standard.

If you stick with LVM you can forget multi-booting. The two do not mix.

Last edited by saikee; 12-11-2006 at 06:38 PM.
 
Old 12-12-2006, 02:42 PM   #12
haiders
Member
 
Registered: Sep 2006
Posts: 62

Original Poster
Rep: Reputation: 15
So here's the solution that worked for me. I uninstalled Fedora and reinstalled it. This time I created a /boot (thanks Saikee/Pixellany)and I also installed a new boot loader (NOT indexed in the MBR). Fedora asked if there were other OS's I'd like visible in grub and and specified Winxp (sda1) and CentOS (sda2). So it worked. I logged in to my centOS and changed the default OS to Fedora, which I knew was properly configured to load the other OS's. Here is how my menu.lst file looks in Fedora now:

default=1
timeout=10
splashimage=(hd0,7)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.18-1.2798.fc6)
root (hd0,7)
kernel /vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.18-1.2798.fc6.img
title WinXP_Professional_32-bit
rootnoverify (hd0,1)
chainloader +1
title CentOS-4_x86_64-bit
rootnoverify (hd0,2)
chainloader +1

Notice the CentOS settings in grub.conf -- I wonder if I could've gotten away with setting just the chainloader for Fedora before I reinstalled? Anyways, thanks for all your help!
 
Old 12-12-2006, 02:54 PM   #13
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Glad to hear you finally got it even after a second installation.

Just two points for your information

(1) rootnoverify is for Grub booting a foreign system and hence no need to "verify" the partition. Modern Grub don't need to be told to do it but in general for a fellow Linux we use "root" instead of "rootnoverify".

(2) The Grub sitting in the MBR must boot one Linux directly by calling its kernel (vmlinuz...) and ramdisk file (inird...) names and can boot all other systems by chain loading. In chain loading one boot loader boots another. In your case you let Fedora's Grub to boot CentOS boot loader. You "WILL NOT" be able to ask Fedora's Grub to chain load itself. This is like a dog chasing its own tail in a never ending loop. Hope you are clear on this but you can have a go if you don't believe in what I say.

If you think of it everything in LInux is logical. If there is something it can't do it is usually for a good reason.

Last edited by saikee; 12-12-2006 at 02:55 PM.
 
Old 12-12-2006, 03:08 PM   #14
haiders
Member
 
Registered: Sep 2006
Posts: 62

Original Poster
Rep: Reputation: 15
Thanks for the clarification Saikee. I still wonder, because my centos was loading fine maybe if I set chainloading for Fedora it would load the Fedora...well I guess we won't until this issue arises for me again
 
Old 12-12-2006, 03:18 PM   #15
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Sorry if I misunderstood your intention.

Yes you can ask CentOS to chain load Fedora. The only step needed is Fedora must have it boot loader in its root partition (in additional to MBR). You can arrange it anywhere (in CentOS or Fedora) by invoking a Grub shell as follow
Code:
grub
root (hd0,7)
setup (hd0,7)
quit
The above instructs Grub to "source" the Grub boot loader in the partition (hd0,7) and set itself up at the boot sector there.

Thereafter inside the menu.lst of CentOS you can make Fedora booted by adding these lines
Code:
title My Fedora in LABEL=/1
root (hd0,7)
chainloader +1
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
grub.conf dual boot xp centos xp does not load Envision5000 Linux - Newbie 8 03-06-2006 10:04 PM
how to configur grub.conf file for dual boot? den-den Linux - General 2 08-23-2005 02:49 PM
Fedora Core 3 Dual Boot, Dual Hard drives, Grub Boot Loader Denali03 Linux - Newbie 1 03-04-2005 01:44 PM
grub.conf - Trying to dual boot XP and FC2 LogicNZ Linux - Newbie 4 07-01-2004 03:01 AM
What should my grub.conf file say for dual booting? EVO VIII Chris Red Hat 5 02-06-2004 01:16 AM


All times are GMT -5. The time now is 03:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration