Serving Two Masters
In spite of all the Linux zealots who infect the comp.os.linux.advocacy Usenet newsgroup with cries for the total elimination of MS-Windows—and usually Microsoft, as well—there are many people who want to be able to switch between Linux and Windows 95. Many users who were using LILO to choose easily between Windows 3.x and Linux installed Windows 95, and then found that Linux would no longer boot. Some who use LOADLIN also found that they were in trouble.
Windows 95 follows a “world domination” strategy when it is installed; it overwrites the master boot record on the hard drive with one which, by default, only boots Windows. The master boot record is essentially a very small program that is loaded from a fixed place on the hard drive as the first step of loading an operating system from the hard drive. The boot record installed by old versions of MS-DOS and by Windows 95 is very limited: it is only capable of allowing the boot process to proceed to the single partition which is marked as the “active” partition.
In contrast, the LILO loader that comes with Linux installs a boot record which allows you to choose to continue booting from any partition quite easily. In fact, LILO even allows you to boot from partitions on the second drive, something that the DOS master boot record cannot do. LILO's boot record is capable of booting Windows 95.
Notice that I didn't call LILO's boot record a “master” boot record. That's because while it can be installed as the master boot record, it doesn't have to be. On each partition on your hard drive, there is another boot record. When the DOS master boot record boots from the active partition, it does so by loading the boot record on the active partition. LILO's boot record can be installed either as the master boot records on the hard drive or as the boot record for your Linux partition.
In order to use LILO, therefore, you need to either install LILO's boot loader as the master boot loader, or install it as the boot loader on your Linux partition and make your Linux partition active. The advantage to installing it as the boot loader on your Linux partition and making your Linux partition active is that the next time you install Windows, all you will have to do to use LILO to choose your operating system is use the DOS fdisk program to make your Linux partition active.
Recovery recipe: Use an emergency boot floppy or boot from your installation boot/root floppy or floppy set. Get a shell prompt, probably either by choosing it from a menu or by pressing Alt-F2 (see the documentation for your Linux distribution if you don't know how to get a shell prompt). Then execute the following commands:
mkdir /mnt mount -t ext2 /dev/rootdevice /mnt /mnt/sbin/lilo -r /mnt umount /mnt
This assumes that /mnt does not exist; if it already exists, you don't need to create it. rootdevice is the name of the device that holds your root filesystem, such as hda2 (second partition of your first IDE hard drive) or sda1 (first partition of your first SCSI hard drive). If you don't remember which it is, you may have to use the fdisk program, which should be included with both installation programs and emergency boot disks, to find it. The -r /mnt part means to pretend that /mnt is your root directory. If your distribution didn't put lilo into the /sbin directory, you may have to look for it.
At this point, you should be able to reboot with the same options that you had before installing Windows 95.
Alternative recovery recipe: Again, boot from your emergency boot floppy or installation boot floppy, but add the command-line argument root=/dev/hda2 or root=/dev/sda1 or whatever partition is your root partition. This should eventually look as if you just booted off the hard drive normally. Now, simply log in as root and run the lilo command. You should now have the same booting options you had before you installed Windows 95.
Recipe to avoid future disaster with LILO: In your /etc/lilo.conf file, change boot=/dev/hda or boot=/dev/sda to point to the primary partition which holds your boot images. This is important on large hard drives; you may have partitions which use disk space that is not part of the first gigabyte on the disk, and that, as you probably know, is inaccessible to the BIOS which starts the bootstrap process. With your boot=/dev/hda3 or boot=/dev/sda4 statement in place in /etc/lilo.conf, run the lilo command. This will install the LILO boot sector on the partition named in the boot= statement.
Now, use the fdisk program to make the Linux partition on which you just installed the boot sector the active partition. You can do this either with the Linux fdisk program or with the DOS fdisk program.
Now, the next time you have to re-install Windows 95 because your .INI files are hopelessly messed up, or Windows 95 refuses to run for no reason, you will be able to boot Linux just by running the DOS/Windows fdisk program and making the Linux partition the active partition. Reboot, and LILO will be working again.
- Let's Go to Mars with Martian Lander
- Applied Expert Systems, Inc.'s CleverView for TCP/IP on Linux
- VMware's Clarity Design System
- My Childhood in a Cigar Box
- Papa's Got a Brand New NAS
- Rogue Wave Software's TotalView for HPC and CodeDynamics
- Panther MPC, Inc.'s Panther Alpha
- Jetico's BestCrypt Container Encryption for Linux
- GENIVI Alliance's GENIVI Vehicle Simulator
- Simplenote, Simply Awesome!