Linux System Administration: Using LILO, The Linux Loader
Sometimes it is useful to be able to run LILO for a disk partition mounted somewhere other than /. For example, if you have another Linux root filesystem mounted at /mnt, you might want to run LILO to install the kernel (currently) at /mnt/vmlinuz using the configuration file /mnt/etc/lilo.conf. LILO's -r option is designed for such a purpose. It sets the root directory location for the LILO operation to the directory specified as its argument and looks for all files relative to that point. Thus, for the scenario we've been discussing, the correct command is:
# lilo -r /mnt
The boot.message file is displayed before the boot prompt is issued. Here is an example boot.message file:
Welcome to JAG Property of the Linux Guerrilla Hackers AssociationComputational science is not for the fainthearted! Our current boot offerings include: * linux (smaller test kernel--1.3.10 currently) * safe (Yggdrasil distribution) * hacked (do you feel lucky?) * ddog - guess what ... (on D:)
An effective file will list all the defined labels (but it needn't be this eccentric).
Should you ever need to, here is the procedure for restoring the DOS master boot program:
Boot from a bootable DOS floppy.
Run the command fdisk /MBR
The Linux-FT distribution replaces the entire LILO apparatus with its Bootmanager facility, a graphical menu-based, user-configurable utility by which you can select which kernel to boot. Its display looks something like this:
Bootmanager Name Location MULTIUSER :3/vmlinuz ro root=/dev/sda3 2 SINGLE :3/vmlinuz ro root=/dev/sda3 single FLOPPY A: INSTALL :3/vmlinuz root=/dev/sr0 ramdisk=300 5 DOS C:1 LUCKY :4/test_kern ro root=/dev/sda4
The Location field indicates the kernel to boot. For example, the MULTIUSER item will boot the file /vmlinuz on the third disk partition of the current disk, using the indicated device as the root filesystem, booting to run level 2. The DOS item will boot partition 1 on the first hard disk (C:). The final item is one added for this system.
Customizing the Bootmanager is easy. Press ESC to override the automatic boot timeout, and then use the cursor and function keys listed at the bottom of the screen to edit the relevant fields. Hardware options applicable to all boot sequences may be entered into the designated field below the boot choices menu.
Very recently (since version 1.2), the Linux kernel has supported loadable modules. As of this writing, the Debian and Linux-FT distributions use this functionality by default.
In this scheme, you build a minimal kernel and dynamically load modules providing additional functionality as required. Such an approach has the advantage that many types of system changes will no longer require a kernel rebuild; it also has the potential to significantly decrease the size of the kernel executable.
The modules package provides utilities for building, installing and loading kernel modules (including ones needed to build a kernel with module support). Running make modules after building a kernel will create the loadable modules files, and make modules_install will install them into the /lib/modules/1.2.6 directory tree (where the final component denotes the kernel release level). The configuration file /etc/MODULES (or /etc/modules) lists modules to be loaded automatically at boot time:
This file says to load the modules supporting the System V filesystem type, the Intel Binary Compatability facility, and the PPP facility.
The following utilities are used to manipulate modules:
depmod: Determines dependencies among modules. For example, the ppp module I selected earlier requires the slhc module to function. depmod creates the file modules.dep in the relevant subdirectory of /lib/modules. This utility may be run automatically at boot time or you may need to execute it manually after building modules.
modprobe: Loads a module as well as all of those that it depends on (usually used to load modules on boots).
insmod: Loads a module interactively.
rmmod: Unloads a loaded module from the kernel (provided it is not in use).
lsmod: Lists currently-loaded modules:
Module: # pages: Used by:iBCS 19 ppp 5 slhc 2 [ppp] sysv 7
At this point, the loadable modules facility is in its infancy, and only a few modules are available, but this will undoubtedly be the way Linux kernels generally operate in the not-too-distant future (and it is the way many other Unix versions already work).
Reprinted with minor alterations by permission from Essential System Administration—Edition 2, copyright © 1995, O'Reilly and Associates, Inc. For orders and information call 800-998-9938 or 707-829-0515.
Æleen Frisch (email@example.com) manages a very heterogeneous network of Linux and other Unix systems and PCs. After finally finishing the second edition of Essential System Administration, she has gone back to her true calling in life, pulling the string for her cats, Daphne and Sarah.
- Real-Time Rogue Wireless Access Point Detection with the Raspberry Pi
- Localhost DNS Cache
- DNSMasq, the Pint-Sized Super Dæmon!
- High-Availability Storage with HA-LVM
- Interview with Linus, the Author of Linux
- Dolphins in the NSA Dragnet
- Days Between Dates: the Counting
- Resurrecting the Armadillo
- Best of Technical Support
- Multitenant Sites