Jump to content

triple boot with one boot menu (lilo)

9 posts in this topic

Recommended Posts

Boot Camp? VMWare? Modifying C:\WINDOWS\boot.ini?

Modifying the Windows MBR? Creating a Windows XP

driver CD? Booting to one menu then to a second?

Swap files instead of partitions? What is all this

silliness? Here's how I built a triple-boot machine

with ONE boot menu, using the linux loader LILO.


DISCLAIMER: This is a description of my experience.

Yours may not be so successful. I disavow any liability;

you assume it all. If following my instructions causes

your data to vaporize, your hardware to melt, a chain

reaction to occur that causes the sun to explode, well,

don't blame me.


WARNING: Following these instructions will completely

destroy your existing data and operating system. If I

were you, I would back up all my important stuff onto

DVD-ROMs, CD-ROMS, zip disks, floppies, magnetic tape,

or punch cards. I would also swap in a different hard

drive for this procedure, until I was sure everything

was OK.


NOTE: I successfully did this on a rather generic PC

with Intel chipsets and a Pentium 4 processor (SSE2

but not SSE3). I dunno if it will work for the authentic

Macs with Core Duo processors.


What you need:


- an OSX installation DVD that you know will work

for your hardware


- a Windows XP installation CD


- a Linux installation CD/DVD that can also go "live,"

or at least has a rescue mode that can do things

like repartition disks. I made my own. How?

That's a whole 'nother story. You might try

Knoppix, which you can get from knoppix.com.


You might also want to get the latest version of LILO from

http://lilo.go.dyndns.org/ in case your linux disk uses

GRUB only. Download the .tar.gz file and put it somewhere

that you can find it, like on a floppy or USB stick or CD.


Step 1: Repartition the hard drive


Boot from the linux CD/DVD into "live" or "rescue" mode, and

log in as root if necessary. If you are not at a terminal

console, but in a GUI instead, open a terminal window. Run

fdisk on your hard drive with the command


fdisk /dev/hda


I use "hda" because I am using the master drive on the primary

IDE port. You may be doing something else.


Use the command "m" to get a list of other commands. Use "p"

to make a list of all existing partitions, and repeatedly use

"d" to delete them all. If you have something like a Dell or

Compaq, and have a diagnostic partition and want to keep it,

then do not delete that one.


Create new partitions with "n". The command "t" will let you

change the two-digit hex code for the partition types.

Here's what you want:


/dev/hda1 type=af for OSX, at least 4GB

/dev/hda2 type=83 for Linux, at least 4 GB

/dev/hda3 type=82 for Linux swap space, 1 or 2 GB

/dev/hda4 type=0c for Windows with FAT32 filesystem, at least 2GB


I recommend making each larger than the minimum, just in case

I'm wrong.


If you have that pesky diagnostic partition that you want to keep,

either use a swap file instead of a swap partition for linux, or

make hda2 an extended partition with two logical partitions in it.

Linux is happy to live on an extended partition, unlike the others.


Notice that I put the Windows partition last. Why? Well,

Windows on FAT32 filesystems tends to write past the end of

its partition. Don't believe me? I've seen it. I had a

Windows 98 system that would routinely write files into my

linux swap space. Those files were destroyed every time I

booted linux. Maybe Windows XP fixes the problem, maybe not.

Putting it at the end of the disk will let the BIOS deal

with whatever it tries to do past the end of its partition

(like turn your computer off immediately; good luck).

If you want the Windows before another, take my advice and

leave some empty space between it and the next partition.


Make the OSX partition bootable with the command "a".


Save the partition table to disk with "w".


Zero-out the beginning of the XP partition, so that the

Windows XP installation disk does not think that there is

already an operating system on it. Use the command


dd if=/dev/zero of=/dev/hda4 bs=512 count=4


or substitue something else for "hda4" if you did not partition

the way I did.


Step 2: Install OSX


When you get to the step in the installation where it wants

you to choose a destination disk, but there are none, that

is a reminder that your new partition has to be formatted.

Open the DiskUtility from somewhere in the menu at the top

of the screen. Select the first partition on the hard drive.

Formatting is under the "Erase" tab. Go and take care of it.


Installation will reboot your machine and start OSX in order

to finish configuring everything. Fine. Just be sure to

get your installation DVD out of the drive before it restarts.


When done, go to the apple icon in the top left corner of the

screen and restart.


Step 3: Install Windows XP


While the machine is restarting, get your Windows XP installation

CD into the drive and boot from it. Choose its destination to

be the fourth partition (if you partitioned the drive like I did).

It will complain that it has to set its own partition as bootable,

thus making all others unbootable. We don't care, and we will

get our revenge later.


Step 4: Install Linux


After Windows is done installing, and you have rebooted Windows

to make sure, restart and put in the Linux installation CD/DVD.

Install it. The procedure depends on which distribution you

have, but just be sure not to repartition the drive again.

Have it prepare the swap partition, etc. Choose LILO as your

bootloader if you have a choice. If not, take whatever it

gives you. Write down the administrator (root) password.


Step 5: Making it triple-bootable


Reboot. You should be looking at a "boot:" prompt or a short

list (maybe only one item) of boot choices. Just hitting return

should boot you into linux. Log in as root. If you are not at

a console, open a terminal window.


Type the command


lilo -V


to see if LILO is installed. Commands in Linux are case-sensitive,

so make sure it's a capital "V".


If you do not have LILO installed, copy the .tar.gz file that you

put somewhere handy onto your home folder, and install it thus:


tar -zxf lilo-XX.Y.src.tar.gz

cd lilo-XX.Y

sed -i -e 's@BUILTIN=1@BUILTIN=0@' Makefile


make boot-text.b

make boot-menu.b

make boot-bmp.b

make install


Substitue the version number that you downloaded for "XX.Y".


Find out what's in your /boot folder with the command


ls -l /boot


and write down the name of any file that has a size of more

than 1000000. The size is listed after the words "root root"

and before the date of last modification. We are looking for

for the name of your kernel, which might be "vmlinuz" or

"linux" or may have some stuff added to it, like vmlinuz-012345-mkd02.

Write it down, exactly as it appears, keeping in mind that upper

and lower case letters are different.


Use your favorite editor to edit /etc/lilo.conf. If you don't

know what I mean, use the command


emacs /etc/lilo.conf


When done editing, "ctl-x ctl-c" tells emacs to save and exit.


If lilo.conf does not already exist, put this in it:










menu-title="Awesome Triple-Boot Machine"







Substitute the name of your kernel for "vmlinuz" and the

name of your linux partition for "hda2" (if you partitioned

differently than I did).


If lilo.conf already exists, there is no need to add those

things, and no need to change the part about your kernel.


Add these things to the end of /etc/lilo.conf:







Notice that spaces cannot appear in labels. Sorry.

Save and exit (ctl-x ctl-c if using emacs).


Linux know-it-alls might notice that I did not include

"table=/dev/hda" lines in lilo.conf. That's 'cuz if I

did, those choices would look to the partition table to

decide which partition to boot, but none of ours will

be marked in the table as bootable.


Now for the revenge part: Run fdisk again with


fdisk /dev/hda


Use "a" to remove the bootable flag from the Windows XP

partition. Use "p" to see that now no partitions are

bootable. But so what? LILO takes care of it for us.

Save and exit ("w").


Install the linux loader with the "lilo" commmand:




You should see something like


Adding Linux *

Adding MacOSX

Adding WindowsXP


If not, you will need to seek professional help. Find

a linux guru near you in your local yellow pages.


Great. Done! Reboot with the command


shutdown -r now


and test each operating system to see that everything

is working.


-- The Mad Doctor, 2007 jun 04

Link to comment
Share on other sites


i just use GRUB with linux and windows XP in the menu and when i select windows XP it gives me a choice of os x or windows


Exactly my point. Everything should be in one menu.


By the way, can GRUB use a background image in the

boot menu? I ask because I do not know. I've been using

LILO because it does. The disadvantage is that any time

I change it, the bootloader has to be reinstalled to the MBR

(unlike GRUB).


Phew, that is a lot of work. Why not use something simpler like Acronis OS Selector? It is easy to install and will detect the three systems perfectly? And it has a cool GUI to boot. (No pun intended)


Never heard of it, but I find their website easily enough.


A cool GUI, you say. How resolute? LILO will allow a graphical boot

menu with resolution 640x480 and 256 colors. I hear rumors that this

can be increased to 800x600, but I haven't gotten that to work.


Why do I use LILO?

1. I understand it well enough.

2. It's open-source software. (Acronis is not.)

3. It does everything I need it to do.

4. I can build it into DVDs and make them run linux live

(without the hard drive) or as rescue/installation disks.

5. I like having a photo in the background of my boot menu.

6. I don't need to run Windows to install it.

Link to comment
Share on other sites

  • 2 weeks later...

I'm wondering why people are complaining that my recipe

is too much work, or that it's so great that they can go from

the apple boot menu to the windows boot menu and only

then can boot linux. So here are some clarifications.


Most of the work you have to do anyway, and the other stuff

doesn't take any more time than setting up the apple boot menu,

the windows boot.ini, or GRUB. The main steps are

1. partition the drive

2. install OSX

3. install Windows

4. install Linux and boot into it

5. remove the bootable flag from the Windows partition

6. make a small configuration file (most of which you can

cut and paste from my recipe)

7. type 'lilo' and hit return


IF YOU ALREADY HAVE a triple-boot machine, you can convert

to a single boot menu by skipping to step 5. Total time: 10 minutes,

if you work slowly.


Of course, if you prefer to go through two menus to get to some

of your operating systems, then don't bother converting. Keep things

the way you like it. It's your computer, after all.


And if you have and prefer a proprietary, closed-source, for-pay

bootloader, then stick with the one you use. It is your computer, not mine.


And by the way, I have patched LILO to use 800x600 bitmap background

images for your boot menu. If anyone is interested, try contacting me.

If enough people want it, I will post it to the forum as well.

Link to comment
Share on other sites

Exactly my point. Everything should be in one menu.


By the way, can GRUB use a background image in the

boot menu? I ask because I do not know. I've been using

LILO because it does. The disadvantage is that any time

I change it, the bootloader has to be reinstalled to the MBR

(unlike GRUB).








^^ random screenshot from web

Link to comment
Share on other sites

See if you can get all three operating systems in your GRUB boot menu.

Maybe by putting something like this in /boot/grub/menu.lst:


title Linux

kernel ...... [put the location of your kernel and root here, or, better yet,

just leave it the way it already is]


title Microsoft Windows XP

rootnoverify (hd0,0)

chainloader = (hd0,0)+1 [if XP is on the first partition]


title Mac OS X

rootnoverify (hd0,1)

chainloader = (hd0,1)+1 [if OSX is on the second partition]


Let me know if it works.

Link to comment
Share on other sites


  • Create New...