This is what I hope to be a simple tutorial of booting 3 Linux of Ubuntu, Slackware and Mepis. The principle applies to 300 Linux if you got them.
A Linux is typically installed in a Ext2, Ext3 or Reiserfs partitions. The first track of such partitions is always reserved as the boot sector so that each partition can have a rightful residence for its boot loader.
If the partition is the first one in the hard disk its first sector of 512 bytes, commonly known as the MBR, is always read by the Bios for the booting purpose. Therefore we can have as many boot loaders as we want but only one of them get read by the Bios as the MBR. To put it in another way if I install 3 Linux I can only nominate just one Linux to control the MBR and relies on this boot loader to boot the other two.
A Linux can be installed in any primary or logical partition in a hard disk and can still control the booting process by sending its first sector of 512 byes to occupy the MBR. This is usually done automatically when you install the first Linux because it needed to be booted.
Your problem starts only when you install the second Linux.
The easiest way to install the second and more Linux is to tell each installer to keep its boot loader inside its root partition. That forces each Linux places its boot loader in the boot sector of the partition it resides. This makes the Linux immediately chainloadable by another boot loader, be it a Grub, a Lilo or even a MS boot loader.
A Linux, with a boot loader inside its root partition, cannot boot itself. It must be booted by a boot loader occupying the MBR. A Linux with access to the MBR can boot other Linux by two methods.
- Direct method by entering into the partition to load the kernel and initrd
- Indirect method by booting up another boot loader and let it do the work, a technique known as chainloading
To explain the above I use a Grub configuration file menu.lst of the first installed Ubuntu and color the additions in color. I have removed all the lines which are irrelevant to condense the print out
Code:
title Ubuntu 7.10 @ sda6 by direct booting
root (hd0,5)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=80db91a1-b3f2-42b2-b3a2-9cb6e5f71b8b ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
title Slackware 12 @ sda7 by direct booting
root (hd0,6)
kernel /boot/vmlinuz ro root=/dev/sda7
title Slackware 12 @ sda7 by chainloading
root (hd0,6)
chainloader +1
title MEPIS 6.0.4 @ sda8 by direct booting
root (hd0,7)
kernel /boot/vmlinuz root=/dev/sda8 nomce quiet vga=normal
title MEPIS 6.0.4 @ sda8 by chainloading
root (hd0,7)
chainloader +1
Any newbie wanting to multi-boot in Linux must be prepared to learn how to write the
Direct booting instructions or the
Indirect booting instructions but not both. The booting instruction for Grub is in /boot/grub/menu.lst but may be in /grub/menu.lst. grub.conf is used on Red Hat family distros. For Lilo it is always in /etc/lilo.conf.
You will see immediately that the
Indirect method is simpler requiring you to know just the partition number, in Grub's notation, in which resides the Linux you wish to boot. You should also notice that Grub counts everything from 0 so the first disk is (hd0) and its 8th partition is (hd0,7), for example.
To boot a Linux by the
Direct method requires you to know in advance the kernel name of the Linux, the kernel parameters to be passed on during boot time and the name of the ram disk file called "initrd.img". It so happens that I have picked the two easiest Linux that do not use initrd. Ubuntu, on the other hand, has a complicated kernel and initrd statement. Ubuntu is booting itself by the
Direct method. This is always the case, , if its boot loader is occupying the MBR, because the
Indirect method is just using one boot loader to boot another boot loader. The
Indirect method does not work for Ubuntu because its Grub is already in the MBR, gets read by the Bios and will boot back to itself in a continuous loop.
Therefore if you boot 100 Linux you must have the one in the MBR booting itself
directly and the rest of the 99 Linux booted
indirectly. You could of course choose to boot every system directly but that is a lot harder when the number of system increases.
The the
Indirect method does have the following advantages over the the
Direct method
- The original boot loader configuration, as created by the installer, is faithfully preserved.
- The type of boot loader in each Linux is immaterial as the scheme works equally well for a Lilo or a Grub
- It is a lot easier. The partition reference is the Linux.
- The scheme requires the least amount of work.
- It is very easy to switch boot loader in the MBR.
- One can do relays with boot loaders, like one does 10 systems and its 10th Linux has a menu for the next 10 systems and so on.
- Very complicated nested booting menu systems can be implemented.
To demonstrate I list the booting menu of Slackware which is a die-hard believer in Lilo. Its lilo.conf has been modified to boot Ubuntu and Mepis
indirectly
Code:
# LILO configuration file in Slackware of sda7
boot = /dev/sda
message = /boot/boot_message.txt
prompt
timeout = 1200
# Override dangerous defaults that rewrite the partition table:
change-rules
reset
vga = 773
other = /dev/sda6
label = Ubuntu
image = /boot/vmlinuz
root = /dev/sda7
label = Slackware12
read-only
other = /dev/sda8
label = Mepis
Conclusion
When install the first Linux let its boot loader into the MBR.
From the second Linux onward tell the installer you want each boot loader to be place inside the root partition.
Amend the MBR's boot loader configuration file to boot other by chainloading
For Grub each additional Linux by inserting
Code:
title Linux in the (j+1)th partition of the (i+1)th disk
root (i,j)
chainloader +1
To chainload a Linux in partition sda7 with Lilo insert lines
Code:
other=/dev/sda7
label=Linux_sda7
Lilo differs from Grub that each time its lilo.conf is altered then the command "lilo" must be issued to re-validate Lilo. Grub is easier as one can write all the booting choices in menu.lst even before the Linux are installed as Grub can be installed into a data-only partition without attached to a Linux.
--------------------------------------------------------
For more information see
Just booting tips