You installed Windows 95, and now you can’t boot Linux. Don’t panic. The fix is simple, and doesn’t require removing Windows or Linux.
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.
LILO
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.
LOADLIN
If you are willing to boot DOS in order to boot Linux, you can use the LOADLIN program. In some cases, this is actually the best way to boot Linux. In particular, some sound cards will work under Linux only if they are first initialized under DOS.
Some people who were using LOADLIN to start up Linux from the DOS prompt have discovered that after installing Windows 95, they can’t bring up a DOS command prompt window and boot Linux from there—and it is no fun to reboot into DOS in order to finally get into Linux. Perhaps you are one of those people.
As you have discovered, LOADLIN has some limitations. For example, you can’t use it to boot Linux while you are running Windows. Even if you aren’t running Windows, if you are using an extended memory manager, it must support VCPI in order for LOADLIN to work. However, these constraints don’t cause problems if you run it from a CONFIG.SYS menu item. If menu support hasn’t been added, your entire CONFIG.SYS file might look something like this:
DEVICE=C:\DOS\HIMEM.SYS DEVICE=C:\DOS\EMM386.EXE FILES=40 DOS=HIGH,UMB
Let’s call that your DOS section. You will also need a LINUX section, and you will need to be able to choose between them. In order to cause DOS to allow you to choose between them while booting, you will need a MENU section. The result looks like this:
[MENU] MENUITEM=DOS, Boot DOS MENUITEM=LINUX, Boot Linux [DOS] DEVICE=C:\DOS\HIMEM.SYS DEVICE=C:\DOS\EMM386.EXE FILES=40 DOS=HIGH,UMB [LINUX] REM Here is where you would load a driver for REM a sound card that is not completely REM supported by Linux. SHELL=c:\LOADLIN\LOADLIN.exe @c:\LOADLIN\params
The @c:\LOADLIN\params means that the boot arguments for the kernel are kept in the file c:\LOADLIN\params. This file might look like:
root=/dev/hda2 ro
The documentation that accompanies LOADLIN explains this in much more detail, but you are likely to find this explanation sufficient to start using LOADLIN under most circumstances.
Many distributions include a copy of LOADLIN. You can also ftp a copy of LOADLIN from tsx-11.mit.edu in the directory /pub/linux/dos_utils/ in the file LOADLIN15.tar.gz.