PDA

View Full Version : Simple but interesting grub.conf question



Badut
3rd June 2006, 12:31 AM
Hi all,

If I have FC5 installed on /dev/hda2 and Ubuntu Dapper installed on /dev/hda11 each would have its own /boot/grub directory right? Which means there are two grub.conf files: one for FC5 and one for Dapper.
So my question is:
How does grub know which grub.conf file to use?
And how do I change its behaviour to read the grub.conf I want it to?

I know they are not somehow synchronised cause I'm in FC5 right now and my grub.conf looks like this:



# 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,1)
# kernel /boot/vmlinuz-version ro root=/dev/hda2
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
#hiddenmenu
title Fedora Core (2.6.16-1.2122_FC5)
root (hd0,1)
kernel /boot/vmlinuz-2.6.16-1.2122_FC5 ro root=LABEL=/1
initrd /boot/initrd-2.6.16-1.2122_FC5.img
title Fedora Core (2.6.16-1.2111_FC5)
root (hd0,1)
kernel /boot/vmlinuz-2.6.16-1.2111_FC5 ro root=LABEL=/1
initrd /boot/initrd-2.6.16-1.2111_FC5.img
title Windows XP SP2
rootnoverify (hd0,0)
chainloader +1


But when I booted the computer just now, the grub menu had Ubuntu items in it.
Reason I ask is because I just installed Dapper and it wrongly assumed that it should be the default in the grub menu.

brandor
3rd June 2006, 12:44 AM
Whichever grub-install was preformed last will point to its appropriate grub.conf.

You installed ubuntu last, so the grub thats in your MBR is pointing to the ubuntu grub.conf.

Badut
3rd June 2006, 12:47 AM
Whichever grub-install was preformed last will point to its appropriate grub.conf.

You installed ubuntu last, so the grub thats in your MBR is pointing to the ubuntu grub.conf.


Thanks that makes sense. How would I go about getting grub to look at my FC5 grub.conf again?

jim
3rd June 2006, 01:55 AM
add a line to tthe grub.conf pointing to the FC5 install

like so...
just a example

title Fedora Core (2.6.16-1.2122_FC5)
root (hd0,5)
kernel /vmlinuz-2.6.16-1.2122_FC5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.16-1.2122_FC5.img

bob
3rd June 2006, 02:06 AM
Simply go into Ubuntu's grub.conf and copy in the Fedora boot information (the lines from title thru initrd). Look at how your Ubuntu is booted. Since they're on different drives, Ubuntu may be shown as (hd0,x) in it's grub.conf . Well, if that's the case, change the references on Fedora to (hd1,1) since if Ubuntu thinks it's on hd0, then it's going to think Fedora's on hd1. Of course, if Ubuntu recognizes it's (hd1,x), then your Fedora is fine to copy/paste as is.

Boy, THAT's clear as mud! - Sorry, but I'm having trouble with words tonight. Anyway, one distro's on hd1 and the other is on hd0. Just make sure they aren't both looking at the same hard drive.

Final thought before I kill my last brain cell with this Saranac Mountain Ale... after you type in the information at the bottom of the grub.conf, hit 'enter' to add a blank line. If not, there can be problems with all the info being read properly.

Badut
3rd June 2006, 02:06 AM
add a line to tthe grub.conf pointing to the FC5 install

like so...
just a example

Thank you Jim, but you might have misunderstood my question.
I was asking how to get grub to look at the grub.conf in /dev/hda2 instead of /dev/hda11

My guess is that I need to reinstall grub somehow.

bob
3rd June 2006, 02:07 AM
Jim beat me by 11 minutes??? Wow, back to typing class for Bob!

jim
3rd June 2006, 02:19 AM
ok um back up the copy you have and copy the old grub (the one you want ) and move it to whre Ubuntu is reading grub from

Badut
4th June 2006, 06:20 AM
Thanks that makes sense. How would I go about getting grub to look at my FC5 grub.conf again?

Ok, for future reference, here is how I did it.
Boot into FC5
Log in as root
go to /sbin
Type:

grub-install /dev/<xxx>

Where <xxx> is the device you boot from. In my case it was /dev/hda

Once that's done, I followed what Jim and Bob said to get the grub.conf the way I like it. :D

PS: Thanks to Brandor, Jim and Bob.