PDA

View Full Version : [ubuntu] Chainloading Ubuntu



Leporello
April 26th, 2008, 10:37 PM
Hi,
I am trying to chainload Ubuntu from Fedora. My hard disk is set up like this:
sda1 Ubuntu partition
sda2 swap
sda3 /boot partition (created by Fedora, I believe)
sda4 Fedora partition
sda5 swap

When I boot the computer, Fedora's grub menu is displayed. The corresponding grub.conf (on sda3) is below:


# 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,2)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,2)/grub/splash.xpm.gz
hiddenmenu

title Fedora (2.6.24.4-64.fc8)
root (hd0,2)
kernel /vmlinuz-2.6.24.4-64.fc8 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.24.4-64.fc8.img

title Fedora (2.6.24.4)
root (hd0,2)
kernel /vmlinuz-2.6.24.4 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.24.4.img

title Fedora (2.6.24.3-50.fc8)
root (hd0,2)
kernel /vmlinuz-2.6.24.3-50.fc8 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.24.3-50.fc8.img

...more fedora kernels...

title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=ceb85098-0c06-4b1c-9bda-0b78efd50459 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet

title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=ceb85098-0c06-4b1c-9bda-0b78efd50459 ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic
quiet


title Ubuntu
rootnoverify (hd0,0)
chainloader +1
boot

So as it stands, I can boot Ubuntu by picking one of the two non-chainloading Ubuntu options, which I copied and pasted from _Ubuntu's_ grub.conf. But I would like to be able to chainload Ubuntu, since this way I won't have to manually edit Fedora's grub.conf every time there's a new kernel for Ubuntu, for instance. Unfortunately, if I try to do this by picking the last option above (the Ubuntu chainloading one), I get:

Error 13: Invalid or unsupported executable format.
My question is then simply how do I get this to work? Do I need to do something special to make the computer recognize Ubuntu's grub?

dstew
April 26th, 2008, 10:55 PM
In order to chainload a partition, it has to have a bootloader installed. You need to install grub to the Ubuntu partition. From a Live CD or other linux system boot, do sudo grub to get a grub command line. Make sure the (hd0,0) partition is not mounted. On the grub command line enter:
root (hd0,0)
setup (hd0,0)
quitThis is the one time where you tell grub to put the bootloader into a partition, rather than the MBR, with the setup (hd0,0) command. After that it should chainload.

Leporello
April 26th, 2008, 11:19 PM
Well, this is progress, at any rate. Now when I choose the Ubuntu chainload, I get a grub command line prompt. How do I tell it to use the Ubuntu menu.lst?

dstew
April 27th, 2008, 07:30 PM
How do I tell it to use the Ubuntu menu.lst?Maybe there is not menu.lst file there. Look in the /boot/grub directory of the Ubuntu partition. Do you see a menu.lst file? If not, you can create one using the update-grub (http://www.fifi.org/cgi-bin/man2html/usr/share/man/man8/update-grub.8.gz) command. Once you have the grub command prompt, you can boot the Ubuntu partition by entering the root, kernel, initrd and boot commands. Then on the Ubuntu command line, run sudo update-grub. That gets you a new menu.lst file. You must edit the new menu.lst file to set the #kopt and #groot options, then run update-grub again. Now you should have a working menu.

Leporello
April 28th, 2008, 05:39 AM
Thanks dstew for the advice. I'm sorry to say that I'm still not quite there yet. There was already a menu.lst in existence but just to be safe I ran update-grub again, with the proper groot and kopt paramters. Unfortunately, I still get the grub command prompt when I choose the Ubuntu chainload. Now if I type
configfile /boot/grub/menu.lst at the command prompt I get the Ubuntu grub menu. So again we're back to telling grub to use the menu.lst file. As things stand I can do this myself manually, but I'd rather not have to. Is there some kind of initialization script where I could put "configfile /boot/grub/menu.lst", or is there somewhere I can set it as a default option? Why doesn't grub seem to want to recognize the menu.lst? I did a little searching but didn't really find anything...

confused57
April 28th, 2008, 05:46 AM
Have you tried?:

title Ubuntu
configfile (hd0,0)/boot/grub/menu.lst

Leporello
May 1st, 2008, 07:28 PM
Yes, that did it. Thanks a lot!

ntu
July 14th, 2008, 04:41 AM
Have you tried?:

title Ubuntu
configfile (hd0,0)/boot/grub/menu.lst

I'm curious. Could someone explain what this command did please?