Home |
Getting the address correct |
Back |
Introduction:
I use lilo as my boot manager. It is simple and it works. I
understand that grub can do all sorts of neat things but all I want to
do is have the ability to boot into my default operating system and/or have the
ability to select which sysetm is going to boot if there is more than one on
board.
I originally compiled the info below and emailed it to a friend who was having trouble setting up lilo to boot a second linux system on a dual boot windows/linux box. I don't really consider it a How-To but I think it will help anyone trying to set up their /etc/lilo.conf for a second, or third, linux opportunity in lilo at boot. This is how I look at it, but it's probably not 100% technically correct.
Paths are relative to the system
:
The trick to multibooting with with lilo is understanding how
file systems are mounted in relation to the operating system which will be
writing lilo to the MBR of the machine you want to dual or tri boot.
In what follows "files" can mean a directory or an actual file. Remember that in the "nix" world everything is a file. If you run "cat /etc/lilo.conf" in a terminal, whatever is in /etc/lilo.conf will be printed to the screen. If you run "cat /dev/mouse" you are addressing your mouse as if it was a file and cat would print the digital output from your mouse to the screen.
Everything is addressed as a file with a path in a linux file system.
Files are mounted in relation to how the system has been instructed to recognise a given files. Look at the lines below taken from an old /etc/fstab from when I had three hardrives in one box.
/dev/hda1 /mnt/windows vfat defaults 1 0 /dev/hda5 / reiserfs defaults 1 1 /dev/hda6 swap swap defaults 0 0 /dev/hda7 /usr reiserfs defaults 1 2 /dev/hda8 /home reiserfs defaults 1 2 /dev/hda9 /mnt/hda9 ext3 defaults 1 2 /dev/hda10 /mnt/hda10 ext3 defaults 1 2 /dev/hdc1 /mnt/hdc ext3 defaults 1 2 /dev/hdd1 /mnt/hdd ext3 defaults 1 2 /dev/fd0 /mnt/floppy auto noauto,owner,users 0 0 /dev/scd0 /mnt/cdrw auto noauto,owner,users 0 0 |
The file, /etc/fstab, is a list of devices to be mounted by the system which is being booted, what devices are going to be mounted in the filesystem, what the names (read addresses) the devices are going to have, and where in the filesystem they will be located. Basically, if I were to type any of those fstab lines into a terminal with the command "mount" in front of it, I would be mounting that device.
In the above example, partition hda5 is going to be mounted as " / " (read root filesystem) everything else is part of the " / " directory tree as far as the operating system that boots up using this fstab is concerned with the one exception of swap and I won't go into that.
In the above /etc/fstab, and in addition to partitions used as / (hda5), /usr (hda7) and /home (hda8), there are listings for two other partions on hda. These were the "/" and "/usr" partitions for a second linux system installed on the first hard drive, but they are recognised only as hda9 and hda10 that are mounted in this filesystem as /mnt/hda9 and /mnt/hda10.
This system also had three more devices being mounted from this fstab in addition to my first hard drive on my first IDE cable in the master position (that is hda). You can't see it here but my cdrom was connected as the slave on my first ide cable. That would make it hdb. On my second IDE cable hdc is master and hdd is slave.
After I physically installed the second and third hard drives in this box and configured my bios correctly, the hard drives were immediately recognised by the kerenel at boot. If you run "dmesg | less" in your box you will get your boot message on the screen in less (you could also use the command "more") so you can scroll through the dmesg output with your arrow keys snd see where/when each device is recognised by the kernel on your box.
I nominated the names for the directories /mnt/hda9 and /mnt/hda10 when I installed this particular linux system and the installation program put them into my /etc/fstab.
However, I had to manually create the directories /mnt/hdc and /mnt/hdd after I installed the hard drives so that there was an actual place in the filesystem for them to be mounted. Then I had to append the lines to /etc/fstab so that they mounted at boot.
In the above /etc/fstab, /dev/scd0 is actually a virtual device create by the kernel. /dev/hdb is listed in my lilo.conf to be mounted with scsi emulation (for burning) with an append staement (see below). If my cdrom was a reader only my cdrom line could have looked like the line below.
/dev/hdb /mnt/cdrom iso9660 noauto,owner,users,ro 0 0 |
Now let's look at lilo:
Look carefully at the /etc/lilo.conf listed imediately
below. It starts out declaring that the MBR is on /dev/hda, gives the
default vga setting, nominates the default O/S to boot, declares that there will be a boot
prompt offered when lilo appears (in addition to the usual list box), and
finally it says that lilo will wait 300 tenths of a second for input (after
which it will boot the default O/S.
Note that this lilo.conf resides in the /etc directory on the root system mounted on hda5 according to the fstab above. In this case I was running slackware-8.1 on hda5 as my stable o/s and test driving an install of slackware-9.0 which was installed with its root filesystem mounted on hda9.
That is to say that the system which has its image in /boot and its lilo.conf in /etc will have to look for the other image for the other operating system (slackware-9.0) in /mnt/hda9/boot. That is the directory named "boot", located in the root filesystem on the partition /dev/hda9, which is mounted in this filesystem on /mnt/hda9.
Study and understand declarations in the two stanzas beginning with "image" and note the differences in the paths declared in each stanza.
boot=/dev/hda vga=normal default=slack-9.0 prompt timeout=300 image = /boot/vmlinuz root=/dev/hda5 label=slack append="devfs=mount hdb=ide-scsi" read-only image = /mnt/hda9/boot/vmlinuz root = /dev/hda9 label = slack-9.0 append="devfs=mount hdb=ide-scsi" read-only other = /dev/hda1 label=windows table=/dev/hda |
Note that "image=/boot/vmlinuz" tells lilo where to find the /boot directory and a kernel image named "vmlinuz" to boot. If you had two different bootable kernels in the same /boot directory you would need to have a seperate stanza for each kernel image that you will want to be able to load at boot, e.g. /boot/vmlinuz-2.4.24 and /boot/vmlinuz-2.4.26.
After changing your /etc/lilo.conf in an editor you will have to save it and then run the command "lilo" as root. The default error message level in lilo is sparse. If you get an error message but need more information to troubleshoot your lilo.conf try increasing the error message output to screen, e.g. run "lilo -v 3" (verbose level 3).
Another lilo.conf example:
In the next example, and because mandrake seems to want (or
needs) to have more stuff declared in lilo.conf, it was simpler to let mandrake
setup the lilo.conf on install and then all I had to do was copy in a tried and
true slackware-stanza from a lilo.conf in slackware-9.1. I then had to change
the image= and boot= addresses accordingly so that lilo knew where to find
slack-9.1.
It does not matter which O/S lilo.conf resides in other than that the command "lilo" has to be run from the same root filesystem. In the example below I run "/sbin/lilo" in mandrake, using the /etc/lilo.conf in mandrake, but the slackware (whose root directory is on another partition/filesystem) is the default operating system. Lilo don't care, it deals in addresses not operating systems.
boot=/dev/hda map=/boot/map vga=normal default="slack-9.1" keytable=/boot/us.klt prompt nowarn timeout=300 message=/boot/message menu-scheme=wb:bw:wb:bw image = /mnt/hda9/boot/vmlinuz-ide-2.4.22 root = /dev/hda9 label = slack-9.1 vga = 791 append ="devfs=mount hdb=ide-scsi" read-only image=/boot/vmlinuz label="mdk-9.2" root=/dev/hda5 initrd=/boot/initrd.img append="devfs=mount hdb=ide-scsi acpi=ht" read-only other=/dev/hda1 label="windows" table=/dev/hda other=/dev/fd0 label="floppy" unsafe |
One final note on lilo:
Maybe that will help you get a handle on dual booting with lilo.
I don't know anything about grub and personally I don't need too. Lilo
is stable and simple. No bells and whistles are required. All I want to do is be
able to nominate an O/S to boot. I'm just passing through and I might not be
back there for awhile. No need to spend allot of time configuring
stuff I'm not using or looking at.