What is LILO (Linux Loader)?
LILO (Linux Loader) is a boot loader for Linux and other Unix-like operating systems. It was one of the first boot loaders used for Linux, primarily during the 1990s and early 2000s, before being largely replaced by more modern alternatives like GRUB (GRand Unified Bootloader). LILO’s main function is to load the Linux kernel into memory and start the operating system when a computer boots up.
Key Features of LILO
- Boot Management: LILO allows users to manage multiple operating systems on a single computer. It can load Linux as well as other operating systems like Windows, making it possible to create a dual-boot setup.
- Configurable Boot Options: LILO’s configuration file allows users to specify various boot options, such as the default OS, kernel parameters, and timeout values before it boots into a default OS.
- MBR or Partition Boot: LILO can be installed in the Master Boot Record (MBR) or in a specific partition’s boot sector, depending on the user’s preference.
How LILO Works
When a computer is powered on, the BIOS performs the POST (Power-On Self-Test) and looks for a bootable device like a hard disk. If LILO is installed on the MBR or a partition’s boot sector, the BIOS loads LILO as the boot loader. LILO then does the following:
- Loads the Boot Menu: LILO presents a boot menu to the user, showing the available operating systems or kernels to boot.
- Loads the Kernel: Based on the user’s selection or the default choice, LILO loads the Linux kernel or the selected operating system into memory.
- Starts the Operating System: After loading the kernel, LILO passes control to the kernel, which initializes the system and completes the boot process.
LILO Configuration
LILO is configured using a plain text file typically located at /etc/lilo.conf. Here’s an example of what a lilo.conf file might look like:
boot=/dev/sda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=linux
image=/boot/vmlinuzlabel=linux
read-only
root=/dev/sda1
other=/dev/sdb1label=windows
- boot=/dev/sda: Specifies where LILO should be installed. In this example, it’s installed on the MBR of the first hard drive.
- timeout=50: Specifies the time (in tenths of a second) that LILO waits before booting the default option.
- default=linux: Sets the default OS to boot if no user input is detected.
- image=/boot/vmlinuz: Defines the location of the Linux kernel image.
- label=linux: Assigns a label to this entry in the LILO boot menu.
- other=/dev/sdb1: Points to another operating system (e.g., Windows) installed on another partition.
After making changes to lilo.conf, you must run the lilo command to apply the changes:
sudo /sbin/lilo
This command updates LILO with the new configuration.
Pros and Cons of Using LILO
Pros:
- Simplicity: LILO is relatively simple to configure and does not have a large footprint.
- No Need for Filesystem Support: LILO directly reads the kernel from a known location on the disk, so it does not require filesystem support during boot.
- Compatibility: It can boot different types of operating systems, making it useful for older dual-boot setups.
Cons:
- Manual Updates: Whenever you update the kernel or make changes to the configuration file, you must manually run lilo to update the boot loader. Failure to do so can result in boot errors.
- Limited Features: Compared to modern boot loaders like GRUB, LILO lacks some advanced features, such as the ability to edit boot parameters at boot time.
- No Built-In Recovery Mode: If LILO’s configuration is corrupted, recovering from boot issues can be more challenging than with GRUB, which has built-in recovery options.
LILO vs. GRUB
- Flexibility: GRUB is more flexible than LILO and supports more features, such as editing boot parameters directly from the boot menu, automatic detection of new kernels, and better support for various filesystems.
- Ease of Use: GRUB is generally considered easier to use because it can automatically detect new operating systems and kernels without needing to reconfigure and update manually.
- Configuration: GRUB uses a more user-friendly configuration file (grub.cfg) that does not require running additional commands to apply changes, while LILO requires updating using the lilo command.
Due to these advantages, GRUB has become the standard boot loader for most modern Linux distributions, while LILO is rarely used today.
Conclusion
LILO (Linux Loader) played a significant role in the early days of Linux as a reliable boot loader. While it has been largely replaced by more feature-rich alternatives like GRUB, LILO is still useful in certain scenarios, such as legacy systems or when a simple boot loader is preferred. Understanding how LILO works and how to configure it can be valuable for those maintaining older Linux systems or looking to explore the history of Linux boot loaders.