Overview
In this article, learn to select, install, and configure the boot manager for a Linux system. You will learn:
Configuring multiple boot locations and backup boot options
Install and configure a boot loader, such as grub, Grub 2, or LILO
To add a boot parameter or run the start loader command at startup
Recovering common boot problems
Booting the Grub 2 system with the Grub Legacy
This article discusses the PC startup process and the 3 main boot loaders that are used in Linux: Grub, Grub 2, and LILO, which can help you prepare the Linux Professional Institute ' s Junior level Administra tion (LPIC-1) exam 101, under Theme 102, Goal 102.2. The target has a weighted value of 2. Please note that LPIC-1 no longer requests to master LILO. This article contains the LILO content to make it easier for you to understand.
Prerequisite
To make the most effective use of the articles in this series, you should have basic Linux knowledge and prepare a Linux system for the commands described in the exercise book. You should also be familiar with the hard drive layout discussed in the article "Learning Linux 101: Hard disk layout." Sometimes different versions of the program have different output formats, so the results you get are not always the same as the listings and graphs shown here.
Note: The image in this article is a screenshot taken from the beginning of the startup process. If you are using a screen reader to read this article, you may find the benefits of having the corresponding configuration file for reference, and download them from the downloads section later in this article.
Startup process Overview
Before you dive into the specific boot loader, review how to start or boot your PC. The code named BIOS (representing the Basic Input Output Service) is stored in a temporary memory, such as ROM, EEPROM, or Flash. This code is executed when the PC is turned on or restarted. Typically, it performs a boot self-test (POST) to check the machine. Finally, it loads the first sector from the Master boot Record (MBR) on the boot drive.
As described in the article "Learning Linux 101: Hard disk layout," The MBR also contains partitioned tables, so the executable code in the MBR is less than 512 bytes, and this code is not much. Note that each disk (or even floppy) contains executable code in its MBR, even if the code is only sufficient to output a message, such as "non-bootable disk in drive A: (There is no bootable diskette in drive A:)". This code, which is loaded by the BIOS from the first sector, is called the first stage boot loader or phase 1 boot loader.
MS dos, PC dos, and Windows? The standard hard disk drive MBR used by the operating system checks the partition table to find the primary partition on the boot drive marked as active, loads the first sector from the partition, and then hands control to the loaded code. This new code fragment is also known as a partition boot record. The partition boot record is actually another boot loader for phase 1, but it can only load a set of blocks from the partition. The code in the new group block is called the Phase 2 boot loader. The Phase 2 loader used by MS-DOS and Pc-dos continues to load the rest of the operating system directly. These are the boot processes that the operating system starts and runs.
This boot process works well for single operating systems. But what happens if you want to use multiple operating systems, such as OS/2, Windows XP, and 3 different Linux distributions? You can use a program, such as a DOS FDISK program, to change the active partition and restart it, but this approach is awkward. In addition, a disk can have only 4 primary partitions, whereas a standard MBR can only have one primary partition; The system cannot boot from a logical partition. But our hypothetical example mentions 5 operating systems, each of which requires a partition.
The solution to this problem is to use some special code that allows the user to choose which operating system to boot. Such procedures include:
Loadlin
A DOS executable that can be invoked in a running DOS system to boot a Linux partition. If the setup process for a multiple-boot system is complex and risky, the code can be useful.
OS/2 Boot Manager
This program is installed on a dedicated small partition, the partition is marked active, and the standard MBR boot process starts OS/2 boot Manager, which displays a menu that allows you to select the operating system to start.
Smart boot Loader
The program can reside on an operating system partition, and is invoked through a partition boot record or master boot record for an active partition. Such procedures include:
Part of the Bootmagic,norton PartitionMagic
LILO, LInux LOader
Grub, the Grand Unified Boot Loader (now known as Grub Legacy)
GRUB 2, a new boot loader that only recently appeared in a common release