Linux LILO - What is Linux Loader?

Topics Covered

Overview

LILO in Linux (Linux Loader) is an old bootloader used in Linux systems to load the operating system into memory during the boot process. It allows users to choose and load different operating systems installed on a computer using the "lilo.conf" configuration file. However, due to limitations like a lack of support for modern file systems and configuration flexibility, LILO has been largely replaced by more advanced bootloaders like GRUB.

Introduction

LILO in Linux is an early bootloader for loading the Linux OS during boot. It resides in the MBR and loads the kernel into memory. LILO handles multiple OSs on one computer and offers a menu for selection. Its configuration is in lilo.conf, allowing customization. While its relevance has diminished, LILO played a crucial role in Linux's early development. It enabled users to explore Linux alongside other OSs and contributed to its growth.

Boot process

  1. Power-On:

    The boot process starts when the computer is powered on. During this stage, the BIOS (Basic Input/Output System) performs a Power-On Self-Test (POST) to check if all hardware components are functioning correctly.

  2. LILO Activation:

    If LILO (Linux Loader) is installed in the Master Boot Record (MBR) of the bootable device, the BIOS hands over control to LILO. The MBR is the first sector of the storage device and contains the boot loader code.

  3. Boot Menu:

    Once activated, LILO loads its configuration file, "lilo.conf," which contains information about available operating systems and their locations on the hard drive. It presents a boot menu to the user, displaying a list of OS options to choose from.

  4. Kernel Loading:

    After the user selects an operating system or kernel from the boot menu, LILO proceeds to load the corresponding Linux kernel into memory. The kernel is the core of the operating system responsible for managing system resources.

  5. Kernel Initialization:

    Once the kernel is loaded, it takes control of the boot process. The kernel initializes hardware devices, sets up memory management, and configures essential system components to prepare the system for operation.

  6. Init Process:

    Following the kernel's initialization, the init process is started as the first user-space process. Init takes on the PID (Process ID) of 1 and is responsible for launching system services, daemons, and essential processes required for the system to function properly.

  7. User Interaction:

    After the init process finishes its tasks, the system is ready for user interaction. If the system is configured with a graphical user interface (GUI), the user is presented with a login screen to enter their credentials. Successful authentication leads to loading the desktop environment. Alternatively, in a command-line interface (CLI), the user is directly presented with a command prompt to enter commands.

  8. User Operation:

    With the system fully booted and the user logged in, the user can now interact with the operating system. They can launch applications, perform tasks, and utilize the available resources to carry out their computing needs.

Configuring LILO

  • Locate the lilo.conf file:

    The lilo.conf file is usually located in the /etc directory. Use a text editor with administrative privileges to open the file (e.g., sudo nano /etc/lilo.conf).

  • Global Options:

    The lilo.conf file starts with global options that apply to the entire configuration. These options include settings such as the boot delay (timeout before automatic boot), default boot entry, and the path to the map file that LILO generates.

  • Define Operating Systems:

    Each operating system entry is defined in a separate section. Start by specifying a descriptive label for the operating system.

  • Specify Kernel Location:

    Provide the path to the kernel image file for the operating system. This typically includes the partition and directory where the kernel is located. For example, /dev/sda1/vmlinuz specifies the kernel image on the first partition of the primary hard drive.

  • Configure Boot Options:

    LILO supports various boot options that can be appended to the kernel line. These options can be used to modify the boot behavior, enable or disable features, set parameters, or pass arguments to the kernel. Examples include root= to specify the root partition, "vga=" to set the screen resolution, or initrd= to specify an initial ramdisk.

  • Add Additional Options:

    Additional options can be added to the operating system section, such as label= to specify an alternative label for the menu entry or "read-only" to mount the root partition as read-only.

  • Set the Default Operating System:

    In the global options section, specify the default operating system that will be booted if no user input is received within the specified timeout period. Use the default= option and provide the label of the desired default operating system entry.

  • Save and Exit:

    After making the necessary changes in the lilo.conf file, save the file, and exit the text editor.

  • Run "lilo" Command:

    To apply the changes and update the boot configuration, run the "lilo" command as root or with sudo privileges.

  • Reboot:

    Once the lilo command completes successfully, reboot the system to test the new LILO configuration. During startup, LILO will present the boot menu with the defined operating systems and options.

LILO Command Options

CommandDescription
liloInstall the LILO bootloader
lilo -vVerbose mode - show more details during install
lilo -uUninstall LILO
lilo -RRe-read configuration file
lilo -tTest configuration file without installing
lilo -qQuick mode - suppress some warning messages
lilo -MInstall Master Boot Record (MBR) only
lilo -LList installed bootloaders
lilo -b <bootsector>Specify the boot sector file
lilo -CSpecify an alternate configuration file
lilo -rRestrict LILO to specified root partition
lilo -SSkip the second stage loader installation
lilo -PDon't update partition table

GRUB VS LILO

AspectGRUB (GRand Unified Bootloader)LILO (LInux LOader)
Boot StagesMultistage bootloaderTwo-stage bootloader
ConfigurationConfigurable via text filesConfiguration in a file
User InterfaceSupports graphical interfaceText-based user interface
FlexibilityMore flexible and versatileLess flexible
DetectionCan detect wide range of OSesLimited OS detection
InstallationCan be installed anywhereMust be installed in MBR
UpdatesEasily updated without reinstallingNeeds reinstallation

Conclusion

  • LILO (Linux Loader) is a bootloader used in Linux syLILO (Linux Loader) is a bootloader responsible for loading the operating system during Linux startup. It operates in two stages: primary and secondary.
  • During the boot process, the BIOS performs a power-on self-test (POST) and then looks for the LILO bootloader to execute. LILO's main configuration file, "lilo.conf," is located in "/etc," and any changes to the system's boot configuration require manual updates to this file.
  • LILO has a simpler menu interface but has limitations in file system support, disk partitioning, and kernel location requirements (within the first 1024 cylinders).
  • In recent years, GRUB (GRand Unified Bootloader) has become more popular due to its flexibility, advanced features, compatibility with modern systems, support for various file systems, and automatic updates.