[lug] Booting Multiple Linuxes

Dave Anselmi anselmi at americanisp.net
Mon Jan 7 17:26:48 MST 2002


Elyse Grasso wrote:

> I now have a machine with KRUD 7.2 installed on hda and KRUD/RedHat 7.1
> installed on kdc.
>
> Both installations use /boot partitions on their own hard drives.
> Anyone have a sample lilo.conf for this situation? lilo seems unhappy about
> the things I've tried, possibly due the the /boot ambiguity.

Well, let me take a try at this.

When you run the lilo program, it sets up stuff on your hard drive to boot the
machine.  One thing it has to do is map the sectors of the kernel file into the
boot loader (most likely the master boot record, but I don't want to get too
specific - there are howtos for that stuff).

So, you run lilo and it has to be able to see all the kernels you want to
boot.  That means if the kernels are on different partitions, they have to be
mounted when running lilo.  That's why a shared partition each OS mounts a
/boot is handy - everything lilo needs is in the same place regardless of OS.
It's a good way to go, but not necessary.

Now, let's assume some things.  First, you don't want a shared boot partition.
KRUD 7.2 is on hda1 (mounted as / and including /boot), KRUD 7.1 is on hdc1
(also mounted as / and containing /boot).  Second, you want to be able to run
lilo from either OS (this can be tricky if you change lilo.conf, for example if
you add a third OS to the mix).  Third, you're bios is set up to boot from hda
and you only boot from hda.  I think these assumptions should be pretty close
to what you have.

So, here's your lilo.conf.  Note that since each OS has its own /etc, each will
have its own lilo.conf and they have to accomplish the same thing (unless you
specify config files by hand and make the appropriate arrangements).  *DO NOT
use the below as is.*  I'm going from memory and leaving out the uninteresting
stuff.

Set up your fstab so that from either OS, the other is mounted to
/mnt/other_os.  That means that in the fstab on hda1 you'll have "/dev/hdc1
/mnt/other_os" and on hdc1 it will be "/dev/hda1 /mnt/other_os".  There are
other ways to do this.

On hda1, /etc/lilo.conf looks like:

boot=/dev/hda

label=KRUD 7.2
image=/boot/linux
root=/dev/hda1

label=KRUD 7.1
image=/mnt/other_os/boot/linux
root=/dev/hdc1

Got that?  I'll use the same order on hdc1:

boot=/dev/hda # lilo writes to the same place for both configs - the place the
bios goes to find boot code

label=KRUD 7.2
image=/mnt/other_os/boot/linux
root=/dev/hda1

label=KRUD 7.1
image=/boot/linux
root=/dev/hdc1

There you go.  The only difference is that the path to the kernel changes
depending which OS you're running.  Adding a third OS is tricky, but only
because you have to change both these files to add it, and then put a lilo.conf
in the new OS /etc, too.  If you do that often enough, you'll wind up making a
mistake eventually.

Note that when you run lilo, it tells you what labels it's adding.  If you get
an error or the labels are wrong, you can fix it, but *do not reboot* until it
works correctly.  As long as it's right before you reboot, you won't need a
rescue disk (but should have one anyway ;-)

If you change things frequently, I'd recommend putting all your kernels in a
separate, shared /boot partition, and put the lilo.conf there too (remove the
ones in /etc, and you'll have to tell lilo on the command line what conf to
use).  The only difficulty is that your distros don't expect that and will bear
watching so they don't mess things up.

Sorry this is so long, but hopefully it answers your questions adequately.

Dave





More information about the LUG mailing list