LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem Booting Multiple Linux (https://www.linuxquestions.org/questions/linux-newbie-8/problem-booting-multiple-linux-4175429965/)

cOde13 10-01-2012 05:35 PM

Problem Booting Multiple Linux
 
Hello,

I'm trying to configure multiple Linux booting in one PC.

Here's output of "fdisk -l"

Code:

Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1        2040    16386268+  c  W95 FAT32 (LBA)
/dev/hda2            2041        7361    42740932+  f  W95 Ext'd (LBA)
/dev/hda3            7362        9730    19021824  83  Linux
/dev/hda5            2041        2693    5245191  83  Linux
/dev/hda6            2694        4733    16386268+  83  Linux
/dev/hda7            4734        4929    1574338+  82  Linux swap / Solaris
/dev/hda8            4930        7361    19535008+  83  Linux

I've installed RHEL5 on /dev/hda6 & it's Grub on /dev/hda5 (/boot).
I want to add other Linuxes on other partitions & boot them using RHEL5's grub.
So, I've installed Fedora_16 on /dev/hda3, without installing it's grub.
Then added some "chainloader +1" rules in /etc/grub.conf:
Quote:

title Red Hat Enterprise Linux Server (2.6.18-8.el5)
root (hd0,4)
kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.18-8.el5.img
title Windows
rootnoverify (hd0,0)
chainloader +1
title Fedora_16 (Verne)
root (hd0,2)
chainloader +1

But grub can't boot Fedora.

How to solve this?


Thanks.

Pedroski 10-01-2012 06:11 PM

might help
 
grub can write its own grub.cfg Make sure all partitions are mounted

In a terminal do:

sudo update-grub (takes a while, especially as you have a lot of partitions)

I am no expert, but I've never seen chainloader +1 in a Linux grub.cfg entry, except for Windows.
Typical entry for Fedora, which you can find in (Fedora partition) /boot/grub2/grub.cfg

menuentry 'Fedora (3.5.2-1.fc17.x86_64)' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-710cdbf5-48ff-484d-b1f8-9a143a78dbec' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos6'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6' 710cdbf5-48ff-484d-b1f8-9a143a78dbec
else
search --no-floppy --fs-uuid --set=root 710cdbf5-48ff-484d-b1f8-9a143a78dbec
fi
echo 'Loading Fedora (3.5.2-1.fc17.x86_64)'
linux /boot/vmlinuz-3.5.2-1.fc17.x86_64 root=UUID=710cdbf5-48ff-484d-b1f8-9a143a78dbec ro rd.md=0 rd.lvm=0 rd.dm=0 SYSFONT=True KEYTABLE=us rd.luks=0 LANG=en_US.UTF-8 rhgb quiet
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-3.5.2-1.fc17.x86_64.img
}

The problem I see for you is: I have Ubuntu and Fedora. Ubuntu has 'control' of grub at boot. So if it adds a kernel, it does update-grub, which overwrites past entries. I don't usually have both partitions mounted, so it does not find Fedora. After a kernel update, I need to a) mount the Fedora partition b) run sudo update-grub

I would like to know how to automate this. For you it is even more important.

TobiSGD 10-01-2012 06:24 PM

RHEL 5 uses Grub, not Grub2, so your script won't work here, Pedroski.

@cOde13: If you want to chainload a Linux system you must install its bootloader to its root partition. Chainloading means that one bootloader starts the next one, which of course can't work if you don't have one installed.

Pedroski 10-01-2012 07:00 PM

I did mention I am no expert! It is not my script, it comes with Linux. I could not write that.

But: I could chainload Fedora from the Ubuntu boot grub.cfg??? Point it at (Fedora partition)/boot/grub2/grub.cfg or how??

Can you tell me what the entry should look like?? That would save me updating Ubuntu grub.cfg every time.

cOde13 10-01-2012 07:13 PM

Thanks for your replies.

Quote:

Originally Posted by TobiSGD (Post 4794396)
.........
@cOde13: If you want to chainload a Linux system you must install its bootloader to its root partition. Chainloading means that one bootloader starts the next one, which of course can't work if you don't have one installed.

It asked me to install Grub in /dev/hda ; can't recall if it asked for installing on particular partition. But I'll try and post here the result.
Is it possible to install Fedora's Grub to it's root partition using "linux rescue"? or, I need to reinstall Fedora?

TobiSGD 10-01-2012 07:36 PM

Quote:

Originally Posted by Pedroski (Post 4794411)
I did mention I am no expert! It is not my script, it comes with Linux. I could not write that.

But: I could chainload Fedora from the Ubuntu boot grub.cfg??? Point it at (Fedora partition)/boot/grub2/grub.cfg or how??

Can you tell me what the entry should look like?? That would save me updating Ubuntu grub.cfg every time.

To chainload Fedora you have to install the bootlaoder to fedoras root partition. You don't point it to Fedoras boot config, but to the partition, where Fedoras Grub takes over, reading the config. Since I haven't used Grub (and especially Grub2) for a long tme I can't help you with the config.

Pedroski 10-01-2012 07:44 PM

Thanks, I'll work on that.

cOde13 10-01-2012 08:27 PM

Okay I've find it. :D

Thanks everyone.

TobiSGD 10-01-2012 08:27 PM

Nice to hear that it works. Please mark this thread as solved using the thread tools at the top of the thread.

wolsonjr 10-01-2012 09:17 PM

Not necessarily applicable to this case but - I've normally run 4 to 5 different systems at a time, usually with Deb as prime and Deb grub booting all, no chain except Win. With earlier versions of update-grub, it would create an incorrect entry for Fedora because the boot img file in Fedora was a different name format and unrecognized, causing a boot entry with no img file. Had to manually add it to grub.cfg.
I suspect this would not be the case with only Red Hat and Fedora since I ASSUME they would have the same construction and a Red Hat grub should correctly handle a Fedora construct.

Pedroski 10-01-2012 09:55 PM

Then you will have the same problem as me: update the Deb kernel, and you will wipe out your grub.cfg entries, unless you have all partitions mounted at the time. Why would you do that?

Seems to me chainloading is a good idea for multiple boot systems. Just gotta figure out how to formulate the entries in grub.cfg and the problem of the bootloader. I'm sure I told Fedora not to install the boot loader, as that would wipe out my Ubuntu grub.

Hmmm, need to think about this!

wolsonjr 10-02-2012 07:06 AM

No, that is not the case. When the new Deb kernel installs and updates grub.cfg, it reads the entire disk for OS's and adds them. They don't have to be mounted. The only problem is when it doesn't properly recognize the particular set-up and this is pretty much solved now.
Also, with more current grub installs, if you need to do anything special or manual, you can sudo edit /etc/grub.d/40_custom and add any menu entry you like. When grub updates, it will add anything it finds there to grub.cfg. This could specific boot items or even just a message/reminder to yourself.

TobiSGD 10-02-2012 07:15 AM

Now I remember why I rather use Lilo instead.

Pedroski 10-02-2012 07:37 AM

You're lucky! If my Fedora partition is not mounted, Ubuntu does not see it. Actually, I've never had it mounted during a kernel update. Next time I'll try.

exsencon 10-02-2012 07:50 AM

Yes, I am with TobiSGD on this. In order to multiboot Linux you put one Linux Grub (or Lilo) in the MBR and any other Linux you want to multiboot, you'll have to put its bootloader IN HIS OWN ROOT PARTITION otherwise poor grub can't recognize the linux you want to boot when you start your system. I have a multiboot system with 12 Linux,Opensolaris, PCBSD and WINXP with that simple system and everything is working like a charm.Simple system, simple solution.


All times are GMT -5. The time now is 12:44 PM.