Tuesday, October 21, 2008

Multi-booting several Gentoo distributions

For some reasons I need to carry with me different Gentoo distributions (x86, amd64, live, minimal, etc.) on the same usb disk and to be able to boot and install from them.
You cannot boot directly from the .iso image (with some other distros you can, i.e. quantian).
You cannot put them in a single partition because they all share the same directory structure and jailing each one in a sub-directory did not work.
The easiest way is to have each distro in its own partition and a multi-boot scheme for the usb disk.
But there's still some problems: it seems that different versions (2006, 2007, 2008..) have a different "usb behaviour". Furthermore, the boot process of each distro looks for the boot files over all partitions it can see, and it cannot distinguish (until version 2008, at least) among different distros. It happens, that the amd64 distro booted from the second partition finds a set of boot files in the first partition (the x86 one) and tries to use them. It results that the boot process stops or misbehaves.
The solution is to pass to the kernel (with grub, lilo, syslinux, etc.) the option
cdroot=/dev/therightdevice
This solution is easy but unsatisfactory because the device name may change from machine to machine. Unfortunately, the obvious remedy to refer to devices by label (cdroot=LABEL=therightlabel) or by uuid (cdroot=UUID=therightuuid) didn't work.