Linux
by Kamran Husain
IN THIS CHAPTER
- System Commander
- Using LILO to Boot off the Hard Disk
- BOOTLIN
This chapter covers various topics that basically could not fit in other chapters
and could not justify a chapter by themselves. We cover the following topics briefly
and provide locations where you can get more information:
- Using System Commander
- Booting off the hard drive
- Installing LILO
- Command-line options
- Configuration parameters
- The boot prompt
- LILO Uninstallation
- BOOTLIN
Before we go on talking about LILO, let's see whether we have any alternatives
to hacking text configuration files and praying for it all to work.
The System Commander product is a very solid alternative to LILO. Yes, this means
that you have to pay money to use it. If time is important to you, use the System
Commander rather than LILO. It's easier to configure and set up. Plus you have great
support from the vendors. The only drawback I see to using System Commander is its
price tag of $99. However, after using it for the first installation with Linux,
Windows NT, and Windows 95 on the same machine, I would have no hesitation in paying
the requisite fees for it.
Boot into DOS off a floppy with CD-ROM drivers on it so that you can access the
System Commander files. If you have the product, use the disk to run the program
INSTALL.EXE.
System Commander lets you boot more than one kernel--up to 255, as a matter of
fact. Who wants that many kernels on one machine? The basic idea used by System Commander
is that it takes over the boot record and saves its configuration information in
each of the systems it boots from. The MBR is then "taken over" by the
System Commander software. When you boot, you are presented with a screen of bootable
kernels. Use the arrow keys to select the kernel of choice. Press Enter and you're
done. The System Commander uses the config- uration stored for the kernel you are
booting as its base. The kernel it boots doesn't know the difference.
More information on System Commander is available from the Web site http://www.v-com.com
or via telephone at (800) 648-8266. Using System Commander is easier, much easier,
than using LILO. It works with Windows NT, Windows 95, and even OS/2. Check it out.
Now let's get on with the LILO way of booting from the hard disk.
LILO is a generic boot loader for Linux written by Werner Almesberger. LILO (Linux
Loader) is a bit tricky to get used to at first, so pay attention to this section.
The Installation program with the Slackware disk installs LILO for you. You should
let the Installation program install the LILO program, which changes the boot sector
of your hard drive to allow you to choose between a DOS or a Linux partition as the
boot originator. These programs are provided with most major releases, or you can
get them separately from one of the FTP sites.
-
NOTE: As of LILO Version
8, a quick install script is available that should make LILO installation quick and
easy. You can also see the LILO Quickstart Guide, by Matt Welsh, which should be
available at sunsite.unc.edu:/pub/Linux/docs.
-
CAUTION: Installing boot
loaders is very dangerous. Be sure to have some means of booting your system from
a different medium if you install LILO on your hard disk.
Following are some of the features and disadvantages of LILO:
- It is independent of the file system. You can use LILO with DOS, UNIX, OS/2,
and Windows NT.
- It can replace the master boot record on your hard drive.
- It can use up to 16 different boot images on several partitions on your hard
drive. Each image can be protected by a password.
- It provides support for boot sector, map file, and boot images to reside on different
disks or partitions.
- It's a bit hard to configure, but it's free!
Installing LILO seems frightening at first because it can ruin your hard drive
or leave you with a system into which you cannot boot. To prepare yourself for this
mishap, keep a boot disk handy. Also, you have to do this installation as root, so
be careful about which files you wipe away.
You can run the /sbin/liloconfig program and choose the configure option to reset
the values of LILO. The interface is something you will be familiar with after having
installed Linux. However, you will have to wade through selections for other devices
and menus to get to the LILO configuration parts. You can get to LILO configuration
directly by using the /sbin/liloconfig command. If you prefer a colorful
version of this program, you can try out /sbin/liloconfig-color.
First run /sbin/liloconfig. You are presented with the items in the menu
shown in Listing 4.1.
# /sbin/liloconfig
mpsi:/sbin# liloconfig
LILO INSTALLATION
LILO (the Linux Loader) is the program that allows booting Linux directly from
the hard drive. To install, you make a new LILO configuration file by creating
a new header and then adding at least one bootable partition to the file. Once
you've done this, you can select the install option. Alternately, if you
already have an /etc/lilo.conf, you may reinstall using that. If you make a
mistake, just select (1) to start over.
1 -- Start LILO configuration with a new LILO header
2 -- Add a Linux partition to the LILO config file
3 -- Add an OS/2 partition to the LILO config file
4 -- Add a DOS partition to the LILO config file
5 -- Install LILO
6 -- Reinstall LILO using the existing lilo.conf
7 -- Skip LILO installation and exit this menu
8 -- View your current /etc/lilo.conf
9 -- Read the Linux Loader HELP file
Which option would you like (1 - 9)?
-
CAUTION: In Chapter 3,
"Installing Linux," during the discussion on the installation process,
I recommended that you install LILO and have the setup program configure it for you.
If you have already done so, you should be running this LILO installation procedure
only if you have created a new kernel, added a new hard drive, or added another operating
system to your Linux hard drive.
If this is the first time you are installing LILO or if you are about to add a
new partition, you must start with a new header. If you already have LILO on your
machine, select Recycle (option 6) to use your old file. This program is very easy
to use and asks several questions about your system. The sheer number of possibilities
cannot be completely covered here, but following are the terms with which you must
be familiar:
- /dev/hda and /dev/hdb refer to both IDE hard drives 1 and 2
on your system. Individual partitions on each hard drive are referred to as /dev/hda1,
/dev/hda2, /dev/hda3, and so on for drive 1. Similarly, /dev/hdb1
and so on for drive 2.
- SCSI hard drives are referred to as /dev/sda and /dev/sdb for
physical drives 1 and 2, respectively.
- The Master Boot Record (MBR) is the first boot sector of your drive that contains
the partitioning information and bootstrap code. LILO changes this sector and makes
it incompatible with DOS. The DOS MBR program simply loads MS-DOS from the boot sector,
which in turn loads command.com.
- LILO can also install in the superblock for the file system with the
primary Linux partition or onto a floppy disk if you would rather use a floppy disk
to boot.
-
NOTE: LILO might not
be able to work correctly with cylinders greater than 1023 for older disk controllers.
Choose a lower number for the starting cylinder in case you have an old hard disk
controller.
-
NOTE: LILO's boot program
can be stored only on the first hard disk.
After the liloconfig program has run, it creates a file called lilo.conf
for you in the /etc directory. (See Listing 4.2.) Keep an old copy of the
original file in a safe place such as lilo.conf.safe. If you already have
this file in your /etc directory, you can edit it too. Of course, depending
on how your system is set up, the contents of your Linux installation might vary.
#
# LILO configuration file
# Start LILO global section
append="sbpcd=0x260,SoundBlaster ether=10,0x300,eth0 ether=9,0x340,eth1"
boot = /dev/hda
#compact # faster, but won't work on all systems.
delay = 50
vga = normal # force sane state
ramdisk = 0 # paranoia setting
# End LILO global section
# Linux bootable partition config begins
image = /vmlinuz
root = /dev/hda2
label = linux
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
# DOS bootable partition config begins
other = /dev/hdb1
label = dos
loader = /boot/any_d.b
table = /dev/hdb
# DOS bootable partition config ends
-
TIP: Read the file INCOMPAT
in the LILO release for compatibility notes.
In this lilo.conf file, you can see two different kernels that can be
booted from /dev/hda2. This system includes a /dev/hdb1 from which
you can boot into DOS if you have to. The first image will be the default image into
which you will boot. This image is called vmlinuz and has the label linux.
The other image is labeled DOS for the DOS partition.
If you uncomment the delay line, LILO waits five seconds for you to make a choice.
A delay of 0 causes LILO to boot immediately.
If you are really stingy about disk space, uncomment the compact button. There
is a risk, though, that the compact version will not work with your system. Normally,
this line should be commented out. Compact modes are designed for use with floppy
disks.
Exit the program to install LILO for you. After the installation is over, restart
the machine with the following command:
/sbin/shutdown -r now
-
NOTE: QuickInst
can be used only for first-time installations or to entirely replace an existing
installation, not to update or modify an existing installation of LILO. Be sure that
you've extracted LILO into a directory that doesn't contain any files of other LILO
installations.
The /sbin/lilo command installer accepts several command-line options.
Check the README file or man lilo(8) with your installation package
for more details. It's better to use configuration parameters in a file unless you
already know what you are doing.
The /etc/lilo/config or /etc/lilo.conf file can have the following
parameters. All of these can be set from the command line, but storing them in a
configuration file is more reliable. The following options are available to you:
- append=string--The string is appended to the boot prompt and is sent
to the kernel verbatim. This line is what you would normally type at the boot:
prompt from LILO when the machine boots.
- boot=boot_device--Specifies the device with the boot sector. Assumes
the current device if boot_device is omitted.
- delay=tsecs--Specifies in tenths of a second how long LILO should wait
before booting the first image. Omitting the delay value is like setting it to 0,
which tells the boot loader not to wait.
- message=message_file--Specifies a file containing a message that is
displayed before the boot prompt. No message is displayed when LILO is waiting for
a Shift key and after printing "LILO". By default, messages are
stored in the /etc/boot.message file.
- password=password--Sets a password for all images. You can set different
passwords for different images. If you forget your password, boot off of a floppy
and reconfigure LILO.
- prompt--Forces a user to enter a boot prompt and prevents unattended
reboots if timeout isn't set.
- timeout=tsecs--Sets a timer (in tenths of a second) for keyboard input.
If no timeout is specified, or set to 0, LILO waits forever. If no key is
pressed for the specified time, LILO uses the first image in the lilo.conf
file.
- verbose=level--Turns on lots of progress reporting. The higher the number,
the more output you are likely to get.
- vga=mode--Tells LILO which VGA mode to use in place of the default VGA
mode. The mode values for the vga option are NORMAL, EXTENDED,
ASK, or a decimal (not hex) number for the BIOS video mode command. (You
can get a list of available modes by typing vga=ASK.)
The kernel configuration parameters append, root, and vga
can be set in the options section. They are used as defaults if they aren't specified
in the configuration sections of the respective kernel images.
-
NOTE: You can use different
settings for the same image because LILO stores them in the image descriptors and
not in the images themselves.
When the system boots up, after the keyboard test, press and hold down one of
these keys: Alt, Shift, or Ctrl (or you can use the Caps Lock or Scroll Lock keys).
If one (or more) of these keys is pressed, LILO displays the boot: prompt
and waits for the name of a boot image. So if you want to boot into MS-DOS, you can
type DOS here and press Enter. The names you type here are the labels you
assign in the lilo.conf file. Pressing the Tab key or typing ?
presents you with a list of names recognized by LILO.
If you do not press any of the keys listed in the preceding paragraph, LILO boots
up the first kernel (in this case, vmlinuz) it finds in the lilo.conf
file.
LILO can also pass command-line options to the kernel. Command-line options are
words that follow the name of the boot image and are separated by spaces. The Linux
kernel recognizes the options root=device, ro, and rw
for the device to use, whether the device is read-only or can be written to. The
read-only option is useful if the image is on a CD-ROM or a "safe" disk.
The device is the name of the device you want to boot (/dev/hda1, /dev/hda2,
and so on). This allows you to change the root device from that in the lilo.conf
file.
The option single boots the system in single-user mode. This bypasses
all system- initialization procedures and directly starts a root shell on the console.
Reboot later to enter multiuser mode.
The option vga is processed by the boot loader itself and not the Linux
kernel. You can specify the vga option in the append line.
The information you type at the boot prompt is sent to the Linux kernel. For multiple
devices, use commas to separate each parameter. Avoid the use of spaces between parameters.
Following are some examples of these boot prompts:
- For reserving ports from being auto-probed by device drivers in special hardware
device conflict situations, you can use reserve=port,size. For
example, reserve=0x200,8 will reserve 8 ports starting at 0x200 from being
probed by device drivers.
- For a Panasonic CD-ROM with SoundBlaster support, use sbpcd=0x340, SoundBlaster.
This prevents the module from auto-probing IO ports for locations for the CD-ROM
drive. The result is a much faster boot time for the machine.
- For a bus mouse, use bmouse=irq, which is used for testing the mouse.
It's better to set this in the lilo.conf after you have debugged the mouse.
- Ethernet cards usually take parameters from the ether=x,x,x
command. The actual parameters sent depend on the type of card.
- For Mitsumi CD-ROM, use mcd=port,irq. For example, you might
use mcd=0x340,11. (Note how the interrupt number here is given after the
port number.)
- If your Ethernet card is not recognized, try ether=10,0x340 to probe
for it at port 0x340 using interrupt 10. (Note how the interrupt number here is given
before the port number.)
The parameters for each type of device will come with their documentation, so
do not assume anything. Check the man pages in man lilo for more information.
Use only specified values. If you do not follow instructions, you might wind up causing
irrecoverable errors, which might lead to a corrupt file system.
Here is an example. For my system I have a SoundBlaster card at 0x260, an Ethernet
card using interrupt 10, and another using interrupt 9. The append line for this
setup looks like this:
append="sbpcd=0x260,SoundBlaster ether=10,0x300,eth0 ether=9,0x340,eth1"
At the boot prompt, if I want to override any of these values, I can type a new
line like the following one to swap the interrupts on the hardware (but don't do
this unless it really applies to your hardware!):
linux sbpcd=0x260,SoundBlaster ether=9,0x300,eth0 ether=10,0x340,eth1
Basically, what the preceding line is saying is that my SoundBlaster card sits
on port 0x260 for the sbpcd device driver. The values specified for the Ethernet
cards are in the form
ether=interrupt,port,deviceName
The deviceName will show up in the device list as /dev/eth0 and /dev/eth1
for each Ethernet card. The interrupts and ports are specified in hex; they must
match up or your device will not work.
-
TIP: Remember that all
hex numbers to the boot prompt must be entered with 0x in front of them.
The default interpretation is that of decimal digits and decimal numbers.
Whenever any of the kernel files that are accessed by LILO are moved or overwritten,
the map has to be rebuilt. (Always keep a second, stable kernel image you can boot
if you forget to update the map after a change to your usual kernel image.)
Run /etc/lilo/lilo as root to update the MBR. When rebuilding the kernel,
you have to run the command make target zlilo, which copies the kernel to
/vmlinuz and runs /etc/lilo/install for you.
Do not remove any files related to LILO until you have removed LILO from the system
with the lilo -u command. That command is not enough either; you also must
remove the MBR from the hard disk.
If you want to restore the MBR to the original DOS MBR, you can use the following
procedure:
- 1. Boot from a DOS floppy with FDISK on it.
2. Run fdisk /MBR from the DOS prompt. (You can also use the command
SYS C:.)
3. Reboot with the same floppy or through Linux.
4. Run FDISK or fdisk.
5. Activate a partition to boot from.
6. Reboot (to test whether it all still works!).
With the BOOTLIN package, you can use DOS MBR to boot off the hard drive. To install
this package, take the following steps:
- 1. From within Linux, copy a bootable kernel to your DOS partition.
2. Edit config.sys on the DOS partition to include two files: BOOT.SYS
and BOOTLIN.SYS. The README files for these packages tell you how.
3. Reboot.
Now when you reboot, the BOOT.SYS and BOOTLIN.SYS files boot
into Linux for you.
To get back to running only DOS, remove the BOOTLIN.SYS and BOOT.SYS
files.
The primary site for the BOOTLIN package is at txs-11.mit.edu, in the
/pub/linux/INSTALL/dos directory.
In this chapter, we covered the topics of installing, configuring, and using LILO.
We also covered some of the basic errors you can face and how to set up LILO using
the liloconfig utility. The information you have learned here should get you started
in setting up LILO to boot Linux on your machine off the hard drive.
Contact
[email protected] with questions or comments.
Copyright 1998
EarthWeb Inc., All rights reserved.
PLEASE READ THE ACCEPTABLE USAGE STATEMENT.
Copyright 1998 Macmillan Computer Publishing. All rights reserved.