Linux System Administration: Using LILO, The Linux Loader

 in
This excerpt from Essential System Administration describes useful details of booting Linux on a PC.
LILO's -r option

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

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).

Restoring the DOS Master Boot Program

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 Bootmanager

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.

Introducing Linux Loadable Modules

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:

sysviBCS
ppp

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 (aefrisch@lorentzian.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.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState