Overcoming LILO dual-boot problems

Written By: 'Stone Cold' Rich Steward

Introduction:

This document was written because I spent almost a week getting my system to dual boot both linux and win98. There were so many people out there with the same problem, and so many half-answers to the questions, that I decided to try to fill the void. I am a newbie of about two weeks, so I definitely don't know everything about linux. I say that because MANY newbies seem to be faced with this problem, and to have a definitive source for fixing it is just what newbies need. But on the other hand fixing the problem can be very complex and it was hard to write a guide that would be comprehensible and yet still get you the info you need. The bottom line is that fixing this problem can be a pretty serious thing, and performing any of the operations I suggest require some knowlege about the operations themselves. I could not include everything in a guide of this size. Therefore I say this: Use this guide at your own risk, be aware that my suggestions can lead to a complete loss of data on all hard drives if not done right. You should have backed up everything you could not afford to lose before trying to install linux, and that still applies. I suggest using this document as a guide to get you started. Once you decide what your problem is and how you should solve it you should read everything else you can to be sure you know what you are doing before you try anything. I am in no way responsible for loss of data....but if you can take responsibility yourself and are determined to try it, then read on!

Part I: The Problem.

Many users have tried to set up a dual boot, linux and whatever system, only to be greeted by a strange L 10 10 10 10 10 10 (it just keeps going) after their first reboot. In this situation it can be easy to panic, especially since you probably can't boot to your old OS from here. I will try to outline what I think are good steps to solving these problems.

LILO:

Lilo is a kernel boot loader. It can be used as your main boot manager for a system, because it is able to load linux, OS/2, win98, NT, and many other poplular OSes. However, it does have one limitation that can be particularly aggravating: It can't boot an OS from a partition that is located beyond the 1024th cylinder of the drive. For people with large drives this can be a problem. The most likely cause of this problem is trying to install linux on the same HD as another OS. If you created your linux partition towards the end of a large drive, linux won't boot.

BIOS:

There is a fundamental limitation of many motherboard bioses that can also be a factor here. For some reason it is not possible to boot from a secondary drive. Not every bios has this limitation, but currently it seems fairly common. If you have installed linux on a second drive, it is likely that this is the cause of your error. Again, the situation is LILO can't access the info it needs to continue booting, but this time it's not LILO's fault.

Hard Drives:

There are two common ways (that I know of) of addressing data on a hard drive. The old way, called CHS (for cylinder, head, sector), limits the size of the drive in some ways, so a new way was invented called LBA. (this stands for linear block addressing). Most newer drives of any reasonable size can be set up to use LBA. In most bioses this is the first option presented when the drive is autodetected. So the chances are your newer drive is set up to use LBA, but may still accept queries in the old CHS format. The reason I bring this up is that when you install LILO you have the option to check "linear". It wasn't clear to me what that meant and it probably isn't clear to most newbies. Basically you can check linear if your HD is set up in LBA mode in your bios. For some drives it will work either way, for some you need to have linear checked, or unchecked, but it won't work either way. You should decide what way works for you based on what I have said.

So now you understand what can cause the problems...you want to fix it right!!??

PART II. The Solution.

Well the first thing to do is decide which exact problem you are trying to fix. Because there are several things that can cause LILO to fail you should have read the above section. Assuming you did, go on the the section that applies to you.

I should tell you how to uninstall LILO, so that if none of this works you should at least be able to boot to your old OS again. Use a boot floppy to get LILO: prompt. press tab (to give you a couple more
seconds) and then type "linux 3" This will get you to the linux console. You should login as root. At any time to remove LILO just use "lilo -u". You'll have to find lilo on your system, for me it's in /sbin. (I
think). Use "man lilo" for more info on the LILO bootloader.

Part IIa.
You have installed linux on the same HD as another OS and you get a bunch of 1's and 0's at boot time.

Now for this problem, There may be a NEW version of LILO that will solve everything. As I write this I think the new release is only a few hourse old, so it may be hearsay, or it may be true. In any case I haven't used it. But if it's true then this is what you will want, it's the simplest choice. Go get it and install it.

If it's not true, the you have two options: you could use nuni or something else instead of LILO. Nuni is a linux bootloader that doesn't have the 1024 cylinder limitation. You have to compile it (and assemble it strangely enough) yourself, but if you follow the directions to the letter it's not that hard. To get nuni go to freshmeat.net and type "nuni" in the search box. (This is all over usenet right now) Lastly, you could move your linux partition to a better location.

The first two options just involve downloading and following the setup instructions. The third option requires using Partition Magic or some other "on-the-fly" partition tool. I have only used Partition Magic. I think MAYBE disk drake, that comes with linux-mandrake 7.0, may perhaps also let you re-size on the fly. There are undoubtedly others.

To create a new partition you must first re-sizing the FAT32 partition, leaving empty space at the beginning of the disk, and then creating a new partition (linux) in the space. Now you can reinstall Linux in this new space. Most distributions I think have you do this first, so you will probably have done it before, you just didn't put the linux partition before the 1024th cylinder. Try again!

Part II b.
You have installed linux on a second HD, and you get a bunch of 1's and 0's at boot time. To solve this problem you have two options: You can always use a linux boot floppy to get you into linux, or you can boot from HD, but you have to make a few changes, outlined below. If you use a boot floppy, you should uninstall lilo from your MBR (if you installed it there in the first place) and install it in your linux partition instead.

If you want to be able to boot from the hard drive without needing an annoying floppy, you can do that too, but it's a little trickier. You need to create a new partition on your primary drive to hold the contents of your /boot directory in linux. You will have to use Partition Magic or some other "on-the-fly" partition tool. I have only used Partition Magic. I think MAYBE disk drake, that comes with linux-mandrake 7.0, may perhaps also let you re-size on the fly. There are undoubtedly others. I created the partition at the beginning of my FAT32 partition for win98 using Partition Magic. This involved first re-sizing the FAT32 partition, leaving empty space at the beginning of the disk, and then creating a new partition (linux) in the space. I made mine ~30 MB, but I think that's a little bigger than needed. You make your own decision. I left room for expansion.

After creating the new partition, you go into linux using your boot floppy, in console mode (type "linux 3" at the LILO: prompt). You need to set it up so that your current /boot directory will be moved to the other drive. The steps I took to do this are as follows:

I used fdisk to print the details of hda. Then I used mke2fs to create an ext2 file system on hda2 (which fdisk said was the linux partition). Next I copied everything in /boot into a new directory /boottmp. Then I deleted /boot. Now I ran fsconf to create a new mount point for /boot only it was located on hda (in my case hda2). Finally I copied everything in /boottmp to /boot and removed /boottmp. Now all the boot stuff is on the primary hd. I had to run linuxconf once more to re-install lilo (I had messed with lilo alot you may not have to I couldn't say...you'll have to decide).

At this point you can re-install lilo in the MBR, or if you are using some other boot manager (I'm using ICEPACK) then you can install lilo in your linux partition. It should work at this point.

Part IV:
The above suggestions didn't help Be sure you tried lilo with both linear checked and unchecked. I'm pretty sure you can't hurt anything by trying it, and you can get back into linux using your boot floppy to change it back if it doesn't work. If you are getting the 1's and 0's then don't change it, that's not the problem. Also make sure you actually installed lilo. Getting a blank screen pretty much means nothing is installed.