Boot Loader Questions

Error When Installing LILO to the Master Boot Record (MBR)

Question:

The installation went fine, but when I tried to write the LILO information to the MBR, I got a vague error that said the installation program could not write this info to the MBR. What should I do?

Answer:

The MBR may be locked. You need to access your system's BIOS and verify that the MBR is not write-protected. Also, double-check that you do not have a virus scan enabled in the BIOS that may interfere with writing to the MBR. Depending on the system, you may already have another boot loader in the MBR that conflicts with LILO.

Once you have enabled the ability to write to your MBR, follow these steps to install LILO there:

  1. Boot your system into Linux. (If your system cannot boot into Linux from the hard drive, boot using your boot floppy. Then, at the boot prompt, type vmlinuz root=/dev/hda5 at the LILO: prompt or the location of your Linux root partition.)

  2. Once your system is finished booting, login as root and check your /etc/lilo.conf file to make sure everything is correct. Here is an example lilo.conf file:

     
    boot=/dev/hda
    map=/boot/map
    install=/boot/boot.b
    prompt
    timeout=50
    message=/boot/message
    linear
    default=linux
    
    image=/boot/vmlinuz-2.2.17-14
    	label=linux
    	initrd=/boot/initrd-2.2.17-14.img
    	read-only
    	root=/dev/hda5
    
    image=/boot/vmlinuz-2.2.16-22enterprise
    	label=linux-2.2.16-22
    	initrd=/boot/initrd-2.2.16-22.img
    	read-only
    	root=/dev/hda5

    Type man lilo.conf for more information about configuring /etc/lilo.conf.

  3. Once you are sure that /etc/lilo.conf is properly configured, run /sbin/lilo -v -v. If you receive any errors, stop and verify that your lilo.conf file is correctly configured. If the lilo command works correctly, type shutdown -r now to reboot your system.

These steps should install LILO to your MBR properly and allow you to boot without using a boot disk.

___________________________________________________________

Problems Booting to Windows After the Installation of Red Hat Linux

Question:

I have installed Linux to dual boot with Windows. My first drive, /dev/hda is Linux, and my second drive is my Windows drive. Windows worked fine until after I installed Linux. Now, when I select "dos" from the LILO: prompt to boot to Windows, all I get is "Starting...." and then my machine locks, up. My entry for Windows in my /etc/lilo.conf file looks like this:

other=/dev/hdb1
        label=dos
        table=/dev/hdb

Why is this happening and how can I work around it?

Answer:

Windows is expecting to be the first disk in your computer and does not know what to do when you try to boot it as the second drive. In order to work around this, you must modify your /etc/lilo.conf file so that the entry for Windows looks like this:

other=/dev/hdb1
        label=dos
        table=/dev/hdb
        map-drive = 0x80
        to = 0x81
        map-drive = 0x81
        to = 0x80

Once you have done this, you must re-run LILO so that your changes take effect. To do this, type /sbin/lilo -v -v.

What this does is fool DOS/Windows into believing that it is the first drive in your system.

___________________________________________________________

What to Do When You Get 'LI' on Boot

Question:

When my machine boots, all it says is 'LI' and then it freezes. What is the problem?

Answer:

This means that LILO (the Linux bootloader) is having problems bootstrapping itself to the system. There are a couple of possible situations that may be causing this:

___________________________________________________________

When to Use Loadlin

Question:

When do I need to use loadlin?

Answer:

You will need an alternative to LILO if you can not install the Linux kernel to where the BIOS can reach it or you do not wish to use it. The BIOS may not be able to reach it for one of the following reasons:

You will probably need to use the Loadlin boot loader that is provided on the CD-ROM in \dosutils. You will need to copy this directory over to your DOS hard drive partition and edit the autoboot.bat file to point to its new position and removing the initrd= line. If your system is a SCSI system, you will need to go into rescue mode and copy the /mnt/boot/initrd.img from the hard drive over to the DOS partition, and use it for booting.

___________________________________________________________

Changing the Default OS That Boots with LILO

Question:

I installed LILO fine and can boot to either OS. How can I change the default OS that it boots to?

Answer:

For newer versions of Red Hat Linux, /etc/lilo.conf accepts a default= line that specifies the label of the image section that will be used to boot the machine by default. So, for example, a /etc/lilo.conf file may look like this:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
message=/boot/message
linear
default=linux

image=/boot/vmlinuz-2.2.17-14
	label=linux
	initrd=/boot/initrd-2.2.17-14.img
	read-only
	root=/dev/hda5

image=/boot/vmlinuz-2.2.16-22
	label=linux-old
	initrd=/boot/initrd-2.2.16-22.img
	read-only
	root=/dev/hda5

The default= line points to the label=linux as the default image to use when booting the system.

To change the default image to use when booting, simply change the default= line to point to the correct label value (in this example, linux-old). Save /etc/lilo.conf and run the lilo -v -v command to save the change.

For older Red Hat Linux systems, you will also need to edit the /etc/lilo.conf file. However, since these versions cannot specify a default= line, you will need to change the order of the operating systems that LILO sees in its configuration file. In other words, you will need to place the lines that point to the operating system you would like to boot by default ahead of the others.

In the following example we change the order of booting so that DOS gets booted by default instead of Linux:

pico /etc/lilo.conf

Here is the old version:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50

	image=/boot/vmlinux-2.2.12-20
	label=linux
	root=/dev/hda2
	read-only

	other = /dev/hda1
	label = dos
	table = /dev/hda

You would then change it to the following:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50

	other = /dev/hda1
	label = dos
	table = /dev/hda

	image=/boot/vmlinux-2.2.12-20
	label=linux
	root=/dev/hda2
	read-only

Save your changes to the file. At the shell prompt, run the command /sbin/lilo -v and the updated LILO will be written to the boot device. On reboot, the machine will now boot into DOS by default instead of Linux.

___________________________________________________________

Removing LILO Information from the Master Boot Record (MBR)

Question:

How can I remove the LILO information from my Master Boot Record (MBR)?

Answer:

There are several methods to removing LILO from the Master Boot Record of the machine. Inside of Linux, you can replace the MBR with an earlier saved version of the MBR using the /sbin/lilo command:

/sbin/lilo -u

In DOS, NT, and Windows 95 you can use the fdisk command to create a new MBR with the "undocumented" flag /mbr. This will rewrite the MBR to only boot the primary DOS partition:
fdisk /mbr