Linux Loader LILO

Print E-mail
Article Index
Linux Loader LILO
Page 2
Page 3
Page 4
All Pages


Linux Loader LILO



Booting Linux requires you to install a program to load the kernel into your computer. Which program you use depends on the computer you’re using: You’ll use LILO for Intel-compatible PCs, MILO for Digital Equipment Corp. Alpha PCs, or SILO for SPARC-compatible work- stations. Because the CD-ROM included with this book contains Red Hat Intel/Linux, this chapter will focus on LILO, which, according to its author, Werner Almesberger, stands for Linux Loader.


This chapter will help you if you chose not to install LILO when you first installed Red Hat Linux or if you need help in properly starting Linux with certain kernel options. You’ve probably already decided how you want to start Linux on your computer, but you should know that there are other ways to fire up your system. Instead of using LILO, you can start Linux from DOS with LOADLIN.EXE, which is included on your CD-ROM under the Dosutils directory. I’ll discuss LOADLIN.EXE later in this chapter in the section “Using LOADLIN.EXE to Boot Linux.”

You can also use your computer as a diskless workstation by booting Linux over a network. A discussion on this subject is beyond the scope of this chapter, but you’ll find the details on how to do this in Robert Nemkin’s Diskless-HOWTO, under the /usr/doc/HOWTO/mini directory after you install Linux.

Yet another approach is to use a commercial boot loader, such as V Communications, Inc.’s System Commander, which can come in handy if you need to run other operating systems such as OS/2, Solaris, or Windows NT on your computer. LILO has capabilities similar to commercial solutions, but it’s free. For now, I’ll assume that you’re going to use LILO to boot in one of three traditional ways. You can use LILO to start Linux

s From the Master Boot Record (MBR) of your hard drive

s From the superblock of your root Linux partition on your hard drive

s From a floppy disk

In the following section, I’ll show you a list of LILO’s configuration parameters and its command-line arguments, and I’ll point out some special features.

Installing and Configuring LILO Although LILO is easy to install by using the lilo command (located under the /sbin directory), you should first take the time to read its documentation, which you’ll find under /usr/doc. Along with the documentation, you’ll also find a shell script called QuickInst, which can be used to replace an existing LILO installation or for a first-time install. LILO’s documentation contains details of its features and provides important tips and workarounds for special

problems, such as installing boot loaders on very large capacity hard drives or booting from other operating systems.

WARNING

Before trying anything with LILO, you should have an emergency boot disk. Having a system that won’t boot is not much fun, and if you don’t have a boot disk, you might think that there is no possible way to get back in and change things. Spending a few minutes to make yourself a boot disk can save you a big headache down the road. Whatever happens, don’t panic! If you need to rescue your system, see Chapter 4, “System Startup and Shutdown,” for details.

If you don’t install LILO during your Red Hat install or decide not to use the QuickInst script, there are two basic steps to install LILO:

1. Configure /etc/lilo.conf.

2. Run /sbin/lilo to install LILO and make it active.

This discussion describes modifying an existing lilo.conf file. Before making any changes, do yourself a favor and create a backup of the file either in the same directory or on a separate disk. Several files are important to LILO and are created during an initial install:

3

s map installer; see man lilo for more information

/sbin/lilo—A

s /boot/boot.b—A boot loader

LILO

s /boot/map—A boot map, which contains the location of the kernel

s /etc/lilo.conf—LILO’s configuration file


Configuring LILO




Under Linux, your hard drives are abstracted to device files under the /dev directory. If you have one or more IDE drives, your first hard drive is referred to as /dev/hda, and your second hard drive is /dev/hdb. SCSI drives are referred to as /dev/sda and /dev/sdb. When you installed Linux, you most likely partitioned your hard drive. The first partition on your first drive would be /dev/hda1 or /dev/sda1. Consequently, your second partition would be /dev/hda2

or /dev/sda2, and so on.

Before configuring LILO, you should know which partitions have what operating system on them. You should also know where you want to install LILO. In almost all cases, you will want to put LILO on the MBR. You shouldn’t do this, however, if you run OS/2. OS/2’s boot loader should go on the MBR, and LILO should then be installed on the superblock of the root partition.

Before installing LILO, you should know where your Linux partition is, and if you have other operating systems, you must know where they are located. For example, your Linux partition might be at /dev/hda1, and your Windows 95 partition might be at /dev/hda2. If Linux is the only operating system on your computer or if you have Windows 95 or Windows NT, you will want to install LILO as the MBR of the drive. If you have OS/2 also, you will want to install LILO on the root partition of your hard drive and use OS/2’s boot loader on the MBR.

LILO is normally installed after you have partitioned your hard drives and after you have installed either Linux or other operating systems. Armed with your information, you are now ready to edit LILO’s configuration file, /etc/lilo.conf.

Editing lilo.conf

Editing lilo.conf is easy. Make sure that you’re logged in as root, and load the file into your favorite editor, making sure to save your changes and to save the file as ASCII text. You’ll edit lilo.conf for a number of reasons:

s You are testing a new kernel and want to be able to boot the same Linux partition with more than one kernel.

s You want to add password protection to a partition.

s You have a hardware setup that requires you to specify special options, such as booting a remote filesystem.

s Your kernel is called something other than /vmlinuz or is in a nonstandard place, such as /etc.

Listing 3.1 shows a sample lilo.conf file.

Listing 3.1. A sample lilo.conf.

# Start LILO global section

Boot = /dev/hda

Prompt

Vga = normal

Ramdisk = 0

# End LILO global section

image = /vmlinuz

root = /dev/hda3

label = linux

read-only # Non-UMSDOS filesystems should be mounted read-only for checking

other = /dev/hda1

label = dos

table = /dev/hda

You can add the parameters listed in Table 3.1 to your /etc/lilo.conf file. They could also be given at the boot prompt, but it is much simpler for them to reside in your /etc/lilo.conf file. Note that only 13 of LILO’s 23 different options are listed here. See LILO’s documentation for details.

Table 3.1. /etc/lilo.conf configuration parameters.

Parameter Description

Tells the kernel the name of the device that contains the

boot=<boot_device>

boot sector. If boot is omitted, the boot sector is read

from the device that is currently mounted as root.

Generates linear sector addresses instead of sector/head/

linear

cylinder addresses, which can be troublesome, especially

when used with the compact option. See LILO’s

documentation for details.

Installs the specified file as the new boot sector. If

install=<boot_sector>

install is omitted, /etc/lilo/boot.b is used as the

default.

You can use this to display the file’s text and customize

message=<message_file>

the boot prompt, with a maximum message of up to

65,535 bytes. Rerun /sbin/lilo if you change this file.

Turns on progress reporting. Higher numbers give more

verbose=<level>

3

verbose output, and the numbers can range from 1 to 5.

This also has a -v and -q option; see LILO’s documenta-

tion for details.

LILO

Copies the original boot sector to <backup_file> (which backup=<backup_file>

can also be a device, such as /dev/null) instead of to

/etc/lilo/boot.<number>.

Similar to backup, this option will overwrite the current

force-backup<backup_file>

backup copy, but backup is ignored if force-backup is

used.

Requires you to type a boot prompt entry.

prompt

Sets a time-out (in tenths of a second) for keyboard

timeout=<tsecs>

input, which is handy if you want to boot right away or

wait for longer than the default five seconds. Tip: To

make LILO wait indefinitely for your keystrokes, use a

value of 0.

Allows input from the designated serial line and the PC’s

serial=<parameters>

keyboard to LILO. A break on the serial line mimics a

Shift key press from the console. For security, password-

protect all your boot images when using this option. The

parameter string has the syntax <port>,<bps><parity>

<bits>, as in /dev/ttyS1,8N1. The components <bps>,

Table 3.1. continued

Parameter Description

and <bits> can be omitted. If one of these

<parity>,

components is omitted, all the following components

have to be omitted as well. Additionally, the comma has

to be omitted if only the port number is specified. See

LILO’s documentation for details.

Ignore corrupt partition tables.

ignore-table

Use this to password protect your boot images.

password=<password>

This keyword is placed after a definition for a partition.

unsafe

The keyword tells LILO not to attempt to read the

MBR or that disk’s partition table entry. You can declare

all the partitions in your system as a log of all existing

partitions and then place the unsafe keyword entry to

prevent LILO from reading it.

After making your changes to lilo.conf, make sure to run /sbin/lilo. You should also always run /sbin/lilo after installing a new kernel.

LILO Boot Prompt Options



The following sample list of options can be passed to LILO at the boot prompt to enable special features of your system or to pass options to the Linux kernel to enable a proper boot. Knowing any needed options for your system is especially handy during the Red Hat Linux installation process because you’ll be asked for any special options if you choose to install LILO then.

Although you’ll normally type linux or dos at the LILO: prompt, you can also try one or two of the following. For a more up-to-date list of kernel messages or options, read Paul Gortmaker’s BootPrompt-HOWTO under the /usr/doc/HOWTO directory.

s Linux into single-user mode to allow system fixes (see Chapter 4 for rescue—Boots details).

s to rescue, but attempts to boot from your hard drive.

single—Similar

s root=<device>—Similar to the /etc/lilo.conf entry, this option allows you to boot from a CD-ROM or other storage device.

s vga=<mode>—Enables you to change the resolution of your console; try the ask mode.

Using LOADLIN.EXE to Boot Linux



is a program that uses the DOS MBR to boot Linux. This handy program, by LOADLIN.EXE Hans Lermen, will also pass along kernel options. LOADLIN.EXE is very helpful when you must boot from DOS in order to properly initialize modems or sound cards to make them work under Linux.

You need to do two things before using LOADLIN.EXE:

1. Copy LOADLIN.EXE to a DOS partition (for example, C:LOADLIN).

2. Put a copy of your kernel image (/vmlinuz) on your DOS partition.

For example, to boot Linux, type the following from the DOS command line:

loadlin c:vmlinuz root=/dev/hda3 ro

Make sure that you insert your root partition in the command line. The ro is for read-only. When you are first booting a Linux partition, it should be mounted as read-only or data loss could occur.

If you have a UMSDOS filesystem, you can type

loadlin c:vmlinuz root=/dev/hda1 rw

The rw is for read/write. It is safe to start a UMSDOS filesystem this way. Again, make sure

LILO

that you substitute your own partition in. LOADLIN.EXE accepts a number of options. See its documentation in the LOADLIN.TGZ file under the Dosutils directory on the book’s CD-ROM.

How to Uninstall LILO



LILO can be uninstalled using the lilo -u command, or it can be disabled by making another partition active using fdisk under either Linux or MS-DOS.

If LILO has been installed as the MBR, you can restore the original MBR by booting under MS-DOS and using the commands SYS c: or FDISK /MBR.

Summary

This chapter covers the basics of configuring, installing, and using LILO, and introduces you to the LOADLIN.EXE boot utility. Hopefully, you’ve seen that using LILO can give you additional flexibility in the number of operating systems installed on your PC and that Linux can be used along with these other systems. Don’t forget to read LILO’s documentation, as you’ll not only learn about how operating systems boot from your hard drive, but also how you can customize the Linux boot prompt.

 

Subscribe By Email

Enter your email address:

Delivered by FeedBurner

Donate

Development & maintainance needs time & money.
With your donation you can help us to keep this project alive
Donate:
  Monthly Monthly
Currency
Amount

Translate

Earn For Skills

Copyright @ 2010 | Tutorialsforu.info | Developed by Open Source Coders | Add your link.