Daniel's mini-HOWTO
This is a homepage of sorts for a mini-HOWTO I wrote in June of 2004. It details the difficulties I had in getting two distributions working on a computer with a 1024-Cylinder BIOS imposed limit.
The raw xml encoded document is available here [LILO-Multi-Distro-mini-HOWTO]
Unfortunately, the tldp discuss mailing list seems to think that the area covered is far too small, so it seems that it shall remain a mini-HOWTO on this site alone.
Daniel, bongley cabalist.
Revision History | ||
---|---|---|
Revision v0.8 | 2004-06-30 | dg |
Conversion to xml-docbook | ||
Revision v0.7 | 2004-06-22 | dg |
Conversion to HTML | ||
Revision v0.5 | 2004-05-20 | dg |
First Coherent version. |
Abstract
This document describes HOWTO use LILO to boot two different Linux distributions, using the author's experience on an older machine as a reference.
Table of Contents
Linux is a freely-distributable implementation of Unix for inexpensive personal machines (it was developed on 386s, and now supports 486, 586, Pentium, PowerPC, Sun Sparc, ARM and DEC Alpha hardware, and even the IBM System 390 mainframe!). It supports a wide range of software, including X Windows, Emacs, TCP/IP networking (including SLIP), and many applications.
This guide attempts to show how the writer used LILO to successfully launch two different Linux distributions on one computer, which itself is crippled by the 1024 cylinder limit
Before going any further into this guide, I suggest you read the Lilo manual pages until you at least understand the jargon. The LILO mini-HOWTO by Miroslav "Misko" Skori is a fairly comprehensive guide to the LILO system and should be read through.
You should also read and understand the Large Disk HOWTO by Andries Brouwe, which explains all about Disk Geometry and the 1024 cylinder problem.
Other suggested reading would include the Power Up to Bash Prompt HOWTO by Greg O'Keefe and, for the basics, Unix and Internet Fundamentals HOWTO by Eric S. Raymond.
If you are new to Linux, there are several sources of basic information about the system. The largest such is the Linux Documentation Project. The Linux Installation HOWTO is a good reference before you begin, but there is a large amount of information particular to LILO also available there.
The first port of call for any Linux user should always be their own computer. On any terminal/console, do
[user@machine ~/dir]$ man lilo [user@machine ~/dir]$ man lilo.conf
If you have any comments on this document, or questions about it, please feel free to mail me at <daniel.goldsmith@gmail.com>. All suggestions/criticism are welcome, particularly those pointing out mistakes or downright inaccuracies. Thank you.
This document is not meant to be a comprehensive guide to solving hardware difficulties or Installation quirks of various systems - it is just a mini-guide to a difficulty experienced by the Author and a description of the solution deployed.
This document came into being because I had the proverbial itch which I needed to scratch. I had a perfectly good computer which has an outdated BIOS. My SCSI disks had given up the ghost, and I acquired a new 40GB IDE Maxtor Drive to replace them. Needless to say, the BIOS ignored the existence of this disk almost completely. I also had two distributions of Linux which I wanted to use - Slackware 9.1 and Debian 3.1 "Sarge".
How I got these to co-exist peacefully is the remit of the remainder of this document. If it helps one other person, I'll be happy.
YMMV (Your Mileage May Vary) for the choice of distributions. There are plenty to choose from, and mostly people just want to use one. I wanted to use the unstable version of Debian, so I needed the stability offered by a distro like Slackware just in case.
Briefly, the procedure is as follows:
-
Install First Distribution
-
Install Second Distribution
-
Boot First Distribution
-
Adjust /etc/lilo.conf
-
ReInstall LILO
-
Sacrifice Small Animal
-
Rejoice!
The importance of this step cannot be understated. In accordance with the ideas related in the Large Disk HOWTO I partitioned my disk with three 125mb primary partitions, with the entirety of the rest of the disk in variously sized logical partitions.
/dev/hda1 125mb primary /dev/hda2 125mb primary /dev/hda3 125mb primary /dev/hda4 - extended /dev/hda5 2096mb logical /dev/hda6 2096mb logical ...
This ensures that the three smallest partitions will always be visible to the BIOS, as they are all within the 1024 cylinder limit. I would strongly suggest that these small partitions be utilised for /boot partitions for each of your chose Linux distros.
The next stage is to decide what use to put the various partitions to. I decided to use the following partition scheme for my system, YMMV.
/dev/hda1 125mb primary Debian /boot /dev/hda2 125mb primary Slack /boot /dev/hda3 125mb primary - (for future use) /dev/hda4 - extended /dev/hda5 2096mb logical Debian / /dev/hda6 4192mb logical Debian /usr /dev/hda7 2096mb logical Debian /home /dev/hda8 10GB logical - for open use /dev/hda9 256mb logical swap - to be shared /dev/hda10 2096mb logical Slack /home /dev/hda11 4192mb logical Slack / /dev/hda12 10GB logical Open
With this table to hand, proceed and install your chosen First Linux Distribution
Install your chosen distribution. I would suggest keeping the installation small at first, particularly if you are confident on the command line. Don't worry at this stage with X, KDE and Gnome, just get the basic Linux architecture in place.
The three most important steps, however, are to
-
Make a boot floppy
-
Install LILO
-
Use a separate /boot partition
The boot floppy will be needed to get back here later. The LILO installation is needed to get everything working nicely later on. You should ensure that LILO installs to the MBR - Master Boot Record - of your Hard Disk. If your chosen installation doesn't offer LILO, but instead talks about grub or something similar, then I'm afraid I can't help you. This HOWTO is about LILO, not grub. Please access the GNU project's grub homepage and proceed from there.
The separate /boot partition is a personal preference, needed for the 1024 cylinder limit on my machine, and for the sake of tidiness in any event. In my case also, the /boot partition needs to be one of those small partitions at the start of the disk structure. If you don't have the 1024-cylinder problem, then I would still recommend the use of a separate /boot partition. It doesn't need to be huge, it is just a safe place to keep the boot-ware and kernels.
Other than that, just proceed as normal, making sure to keep to your pre-designed partition structure. Don't select the future home of your second distribution as any part of the Linux Filesystem hierarchy - that comes later! Once the installation has been completed, boot into it just once, to make sure that it works properly. Enter the command df -h to make certain you have your First Distro in the correct place. Mine gives:
[user@machine ~/dir]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/hda11 2.8G 1.8G 1.1G 61% / /dev/hda2 93M 3.3M 85M 4% /boot /dev/hda10 1.9G 37M 1.9G 2% /home [user@machine ~/dir]$
Once you are happy, proceed to the next stage.
Using whatever method applies in your case, start your second installation. You shouldn't need to do any hard-disk repartitioning at this stage, but keep your table to hand.
Keep especial note of the filesystem your second distribution will be using, be it ext2, ext3, resierfs or some other system. The filesystem must be usable by your First Distribution. This shouldn't cause any problems with different flavors of Linux, but may be an issue for some users with special requirements. Make certain to note the filesystems on your table.
If the distribution offers it, choose LILO as your boot-loader. This makes things easier later on. If LILO isn't offered, then proceed, ensuring that the bootloader is installed on the MBR. Again, I would recommend that a minimalist distribution should be used, I just installed Debian's base-system components, nothing else. Other than those points, just proceed normally - have coffee, cake, whatever. Once it is complete, remove all installation media from your computer, and proceed to the next phase. I'd recommend completing the project before loading the Second Distro - the first boot is often used by distributions for a lot of configuration stuff, and that can wait.
Insert your First Distribution boot disk - in my case, Slackware, and get the system back up and running. All should work well if you've come this far. Time for the hard part.
This is something that once terrified me, but I now know that it isn't too bad. Log in to your First Distro as root. Take a moment before all the editing and do
[root@machine ~/dir]# mkdir /mnt/other_root [root@machine ~/dir]# mkdir /mnt/other_boot [root@machine ~/dir]#
Then fire up an editor. I would recommend pico or nano, but feel free to use whatever is available and you are comfortable with. vi or emacs are the popular editors, but a little too dramatic for our purposes.
In any event, load the file /etc/fstab into the editor and have a good look. The format of the file is somewhat similar to the output from df
/dev/hda9 swap swap defaults 0 0 /dev/hda11 / reiserfs defaults 1 1 /dev/hda2 /boot ext2 defaults 1 2 /dev/hda10 /home reiserfs defaults 1 2 /dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner 0 0 /dev/sr0 /mnt/scd auto noauto,owner,ro 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 proc /proc proc defaults 0 0
Time to get your all important table back out. Create some extra lines in /etc/fstab
/dev/hda1 /mnt/other_boot ext3 defaults 1 2 /dev/hda5 /mnt/other_root ext3 defaults 1 2
Ensure that the entries under type reflect the decisions you made about filesystem when you were installing your second distribution - ext2 or resiserfs or, gods forbid, minix.
When done, exit your editor in the usual manner and issue the Command
[root@machine ~/dir]# mount /mnt/other_boot [root@machine ~/dir]# mount /mnt/other_root [root@machine ~/dir]#
With any luck at all it'll work swimmingly and you will be able to poke around in the other distribution to your curiosities' pleasure. Please make sure not to break anything - look, don't touch!
Back to business - what you are looking for is the contents of the /mnt/other_root/etc/lilo.conf file. I would suggest that you
[root@machine ~/dir]# cat /mnt/other_root/etc/lilo.conf | less
on a virtual console (or xterm) other than your main console. [Note: Normally, to use a different virtual console, press Alt-2 and login as normal.] This allows you to inspect it separately to the /etc/lilo.conf of your first distribution. Find the point in the output where the Linux stanza is present, often it looks as follows
image=/boot/vmlinuz label=Linux root=/dev/hda5
There may be some other information there, read man lilo or man lilo.conf to get the specific details. The information you need is (for example):
- image= /vmlinuz
-
This is the location of your Linux Kernel, the basis of any Linux system. Often this will be of the form /vmlinuz-2.4.20 or similar. You will need to note this information in full.
- initrd= /initrd.img
-
This is your INITial RamDisk, if used. Not every distribution will use one, but many, such as Debian, make use of one. Again, it is likely to have the kernel details appended, as in /initrd.img-2.4.20 or similar. Again, the full title is required.
- root= /dev/hdaN
-
This is the location of the /root partition for the Second Distribution. It shoudl be as per your table.
- label= Linux
-
This is the label given to your distribution on installation. You might be lucky and the Label might actually describe the type of Linux and version.
Keep this information close at hand before venturing to the next step.
While logged in as root, do
[root@machine ~/dir]# cp /etc/lilo.conf ~/oldlilo.conf [root@machine ~/dir]# pico /etc/lilo.conf [root@machine ~/dir]#
The first step copies your lilo.conf to your root home directory. The second opens your favourite editor to do the actual work. Always back-up, even in this most rudimentary fashion, when making changes as root
In your /etc/lilo.conf insert the relevant lines from the other distro's lilo.conf taking care to make adjustments to reflect the fact that their locations are now dependent on the First Distribution, not their own! Where the line used to read image=/vmlinuz, it should now read image=/mnt/other-boot/vmlinuz. Also adjust the label to something more intelligent. Your /etc/lilo.conf should be something like:
# Start LILO global section boot = /dev/hda # or your root partition message = /boot/boot_message.txt prompt timeout = 1200 # delay, in tenth of a second (so you can interact) #linear # try "linear" in case of geometry problems. image = /boot/vmlinuz # your First Distro Kernel file root = /dev/hda11 # your First Distro root partition label = Slackware 9.1 # or whatever name you want for First Distro read-only # mount root read-only - safer! image = /mnt/other-boot/vmlinuz # adjusted kernel line from /mnt/other-boot/etc/lilo.conf root = /dev/hda5 # as per /mnt/other-boot/etc/lilo.conf label = Debian 'Sarge' # whatever name for your Second Distro read-only # mount root read-only - safer!
This action may seem unusual to some people, given that the mount-point /mnt/other-root is only useful within the First Distro - Slackware in my case. This, however, is the darkest of secrets about LILO - it only reads the file /etc/lilo.conf once, and once only. That time is when you run /sbin/lilo.
The file /etc/lilo.conf is a set of instructions to LILO to aid it in creating a boot-structure for your disk. It has no other purpose in life. Once you have run /sbin/lilo you can delete the file for all that the system cares. You shouldn't, of course, because you may wnat to make adjustments later, like varying the vga codes or some other topic outside the scope of this document. But, you could!
Nearly there now. Save and exit in the usual fashion. Then take a deep breath, then issue
[root@machine ~/dir]# /sbin/lilo Wrote Slackware 9.1* Wrote Debian 'Sarge' [root@machine ~/dir]#
The asterisk * is just telling you that Slackware is the default option. That should all have worked nicely.
Whatever. Remove all floppies, CD-ROMs and so forth. Shut down your First Distribution in the proper manner. Light some candles, pray, do whatever calms those nerves and calls upon your own $DEITY for assistance.
Turn on your computer. Rejoice as the LILO menu comes up on screen, offerring you the choice of booting into either of your favoured distributions. You may now look forward to a happy and restful time using your computer.
Put your boot disk for your distributions someplace safe. You never know when you may need them again.
No animals were harmed in the making of this HOWTO
- Q. Help! My Second Distro uses grub!! Why won't you help me?
- Q. Why don't you just use grub in the first place?
- Q. What if I do not use separate /boot partitions?
- Q. Wait a second - My Second Distribution Installer recognises the First and offers to make it bootable. What are you playing at?
- Q. Help! My Second Distro uses grub!! Why won't you help me?
Okay, relax. Have a banana. Now then, lets look at this logically.
grub is a completely different kettle of fish to LILO, not a kettle at all in fact, nor containing fish. The solution, as I used it, is as follows:
Follow the instructions above until the point where you have mounted the /mnt/other_root and /mnt/other_boot Go into the /mnt/other_root folder and look around. Do the following:
[root@machine ~/dir]# ls -la /mnt/other_boot vmlinuz vmlinuz-2.4.23-Debian [root@machine ~/dir]# ls -la /mnt/other_boot/boot/grub/ stage_2 [root@machine ~/dir]# cat /mnt/other_boot/boot/grub/menu.lst | less
and write down all the information you are given. Everything. Note the contents of the menu.lst in particular. This file contains similar information to the information in lilo.conf. For example, a Linux Stanza might appear as follows:
title Debian GNU/Linux, kernel 2.4.26-1-586tsc root (hd0,0) kernel /vmlinuz-2.4.26-1-586tsc root=/dev/hda7 ro initrd /initrd.img-2.4.26-1-586tsc boot
By reading it intelligently, with the assistance of the grub homepages information and documentation, you should be able to acquire the information you are looking for - image file-name, existence of ramdisk, etc. Don't be daunted by the root (hd0,0) notation, it is just a different way of doing things. If you have read the grub documentation, you will know that, for many users, the root (hd0,0) means that the kernel images and so forth are to be found on /dev/hda1 and that other partitions are described acordingly.
In lilo.conf the above menu.lst would berepresented as follows:
image = [*]/vmlinuz-2.4.26-1-586tsc # adjust the [*] depending # on the mount point of that partition root = /dev/hda7 # Straight conversion label =Debian GNU/Linux, kernel 2.4.26-1-586tsc read-only # that is the 'ro' instruction in the root= line from menu.lst
Take all of your information and put it into LILO notation. It isn't very hard, really. The example I have used is a good starting place. Do /sbin/lilo and see what happens - you can only get it wrong, and you do have the boot-disks, don't you?
Why don't you just use grub in the first place?
Without wanting to get into a flame-war, the reasons are, in no particular order
-
grub is not finished
-
grub is broken
-
the grub dev-team have all wandered off to make a new grub2 before actually fixing grub-legacy
-
grub2 does not work at all - yet
None of this is a direct criticism of the grub dev-team, they do stuff I could not. I just do not agree with their methodology in this case. I tried to use grub, it did not work. Sorry.
I went and found out how to make LILO do what I want, when I want. You can too, if you want to. Don't fear the command line. Respect the man-pages.
What if I do not use separate /boot partitions?
Couldn't be simpler - in fact, it is less complicated that the procedure I have outlined above. Essentially, the changes are as follows:
- General
-
Just use less partitions. You could just use two, in fact, if your BIOS permits and you really want huge contigious partitions. Linux is about freedom, after all.
Let's assume two monolithic partitions here - /dev/hda1will be the home of our first distro, /dev/hda2 will be the second.
- First Installation
-
Proceed as outlined - make a boot floppy, install LILO, don't bother with a separate /boot partition. Don't use /dev/hda2 for anything.
- Second Installation
-
Again, just do it. You should, of course, note the filesystem type of your huge partition as before, and not use /dev/hda1 as part of your installation.
- Getting it to Work
-
Just make one drawer instead of two - /mnt/other
Proceed as before, just changing the kernel line in /etc/lilo.conf to image = /mnt/other/boot/vmlinuz
That should do it.
Wait a second - My Second Distribution Installer recognises the First and offers to make it bootable. What are you playing at?
Nothing. This document came about because that's the message I got when installing Debian 'Sarge'. I opted for it, wrote the new bootloader, rebooted and found I couldn't get into either of my dstributions. grub and the BIOS failed to have their little conversation and I had a hulking great piece of electricity-consuming junk. I didn't have the Slackware boot disk, I had to start all over again. This document is to try to help others to avoid the difficulties I had getting it all to work again. If the offered Boot Loader works for you then congratulations, you have chosen a wonderful computer and Linux Distribution. I hope you both are very happy. This document is for those who don't have that luxury.