Analysis of Linux boot process _unix Linux

Source: Internet
Author: User
Tags ide hard drive

After installing Linux, have you ever paid attention to the Linux boot process? This article tries to describe this process and the related situation in the popular language, understand the Linux boot process, you in the face of the problems of the Linux boot process will be able to do well.


One of the compelling features of Linux is that users can customize the entire system, but you run a "mini" Linux with only 1 m, or you can run a few g of Linux. And no matter what linux you run, you start from the boot program first. For ordinary users, most of them are running Linux on PCs. PCs, also known as PCs, are our common computers that use Intel or AMD chips. When we connect the PC to the power, the CPU will execute the first instruction, the first instruction is usually to enable the CPU to jump to the bios of the entry address, and then the BIOS began to post, including memory and other hardware to detect, if there are other devices also from the BIOS ( such as SCSI or RAID settings, etc.), they are also executed. The BIOS that completes the self-test starts the real operating system based on the set boot device and boot sequence, such as Linux (this article takes Linux for example).

For PCs, there are several devices that can be used as startup devices:

1) Hard Drive
This is the most commonly used boot device, the hard disk has IDE interface and SCSI interface, because the IDE hard disk price than the SCSI hard drive is much cheaper, so most PCs are using the IDE hard disk. A PC may have more than one hard disk, the user can set up in the PC CMOS which hard drive first boot.

2) Floppy disk
Floppy disk is one of the necessary devices for PC. Commonly used as installation system or as a system emergency disk. There are also a number of Linux systems on a floppy disk.


3) Optical Drive
CD-ROM drive is also one of the necessary equipment for PC, including CDROM, Dvdrom, and a variety of recorders. Most users now install Linux through the optical drive.

4) USB Disk
With the advent of USB disks, many motherboards are also starting to support booting the system from USB devices. USB disk capacity is much larger than floppy disk, there is a trend to replace the floppy disk.

5) The boot ROM of the network card
There are some network cards with the boot ROM chip, the boot ROM can be written to boot, many motherboards support boot ROM boot. Often used in diskless working-disk environments.

Whichever boot device the system chooses, it reads the contents of the device's starting address into memory, if your boot device is an IDE hard drive, the system goes to read the first sector of the hard drive (this sector is often called the boot sector, or MBR) and reads the contents of the sector into memory and then runs it. At this point, the key to booting the Linux operating system will be to try to start the Linux boot program, which will not boot Linux if the bootstrapper is not found. Many people are unable to start Linux, in fact, most of the boot program is corrupted or improperly configured caused by.

So what is a boot program? In fact, you open the computer every day, the first access to the program is the boot program. It is responsible for loading the operating system kernel software and handing over control to it. For Linux, the bootstrapper is responsible for booting the computer into Linux kernel and handing control of the computer to kernel, then kernel further initializing the remaining operating system until Linux displays the user login screen. This shows that the boot program is important for an operating system. There are many kinds of Linux boot programs, most commonly of which are LILO and grub.

1) Lilo
Lilo is a flexible, versatile bootstrapper for Linux. It does not rely on a particular file system to boot a Linux kernel image from floppy disks and hard disks, but it can also boot other operating systems. Before Grub appears, Lilo is the best choice for the Linux boot program. And there are still a lot of people using it.

2) Grub
Grub is a new, powerful boot program than Lilo. specialize in dealing with Linux's coexistence with other operating systems. The operating systems It can boot are Linux, OS/2, Windows series, BeOS, Solaris, FreeBSD, NetBSD, and so on. Its advantage is to support the large hard drive, support the splash screen (can support to 1024x768 screen), support menu-type selection, and the partition location changes do not have to reconfigure, the use is very convenient. Most newer versions of Linux use GRUB as the default bootstrapper.

3) Other boot programs
If you do not have LILO or grub installed, or if your lilo or grub is damaged (such as accidentally overwriting the MBR), you will not be able to directly boot Linux. Fortunately, at this time you can also be guided by other means, such as: Linux boot disk, or the use of Loadin, syslinux and other programs to load Linux from MS-DOS.


If the boot program succeeds, the Linux kernel takes over the system and starts the Linux startup process (the Linux startup process will be introduced in another article). But what happens if the boot process goes wrong?


1. First analyze the error message displayed on the screen

The error message displayed by the bootstrapper itself is meaningful and needs to be read carefully. Like what:

The error message for Lilo

When the Lilo boot is complete, the string "Lilo" is displayed on the screen, in which each letter has a specific action behind it. If Lilo makes a mistake in some part, we can infer the cause of the failure based on the letters currently appearing on the screen. For example, when nothing appears on the screen, it may indicate that Lilo has not been installed or that the partition where Lilo resides is not set to active. The display of "Li" on the screen indicates that the first part of the Lilo Bootstrapper is able to load the second part of the Lilo boot loader, but it cannot be performed. This may be because the hard drive parameter is improperly set or because the map installer is not running when/BOOT/BOOT.B is moved. If the screen displays "Lil", it may be a media failure or hard drive parameter settings, unable to load the descriptor table from the map file ..., detailed error message interpretation can also be found on the relevant website.

GRUB Error Message:

The GRUB information is better understood than Lilo, as it is expressed directly in English, not by symbols. For example: "Hard Disk Error", "Read
Error "," Selected disk doesn ' t exist "," Disk geometry error "," Device
String unrecognizable "," attempt to access block outside
Partition "," Partition table invalid or corrupt "and so on. Detailed error message explanations can also be found on the relevant website.

2. Through the CD-ROM or floppy boot into the system, repair the original boot program

By analyzing the error message displayed on the screen, you should be able to roughly find the cause of the original boot program error. This is the time to boot into the system via a CD or floppy disk. Many Linux distributions can be started, such as: Slackware is a good bootable CD. After you enter the system, you can reload the bootstrapper or reset the boot program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.