Linux system service 4 ---- startup process + module management and loader

Source: Internet
Author: User
I. Linux startup process analysis 1 currently, grub2 is the mainstream boot loader software for major Linux releases. The system startup process is as follows: 1. load BIOS hardware information and perform self-testing, and obtain

I. Linux startup process analysis

1. Currently, grub is the mainstream boot loader in major Linux versions.

2. the system startup process is as follows:

1. load BIOS hardware information and perform self-testing, and obtain the first device that can be started according to the settings.

2. read and execute the boot Loader of the MBR in the first startup device, that is, the general grub.

3. load the Kernel according to the boot Loader settings. The Kernel starts to detect the hardware and load the driver.

4. after the hardware driver is successful, the Kernel will take the initiative to call the init process, and the init will obtain the run-level information.

5. init prepares the software execution environment and various services, and waits for the user to log on.

3. the Boot Loader is called the Boot Loader, which is in the first sector of the Boot device, that is, the MBR we have always said.

4. Why do we recommend installing windows before Linux?

The reason is that Linux has the control transfer function, but Windows does not, because windows only loads the Boot Loader itself when loading it (Rogue, industry Cancer)

5 suppose my MBR uses grub in Linux, we have three menus.

1. the first menu is to direct to the Linux kernel file and directly load the kernel to start Linux.

2. the second menu is to hand over the boot control permission to windows. at this time, the windows kernel will be loaded to start windows.

3. use the boot loader in the boot sector of Linux to jump out of another grub menu.

6. after the kernel is loaded and the hardware detection and driver loading are completed, our kernel will actively call the first process:/sbin/init.

7. running level

0: the system shuts down directly.

1: Single-user maintenance mode, used for system maintenance when a problem occurs

2: similar to running level 3, but there is no NFS service

3: full text mode with network functions

4: System retention

5: similar to running level 3, x window is loaded.

6. restart

8. the init configuration file is/etc/inittab.

9 if you want to do the work when the system is started, you can directly write it in/etc/rc. d/rc. local, the job will be automatically loaded at startup, instead of waiting for us to log on to the system to start.

10 If you only temporarily change the system running level, use init x to switch to running level x.

Binary Boot Loader

1 boot Loader is an important tool for loading the kernel. Without boot Loader, the kernel cannot be loaded by the system.

2. Code of the hard disk and partition in grub

1. the first hard disk to be searched is coded as (hd0), and the first partition of the hard disk is (hd0, 0)

2 In grub, the start number is 0 instead of 1. the code of grub in the first partition of the first hard disk is (hd0, 0 ), the code of grub in the first logical partition of the first hard disk is (hd0, 4)

3. the BIOS cannot read the hard drive.

For example, in the past, many friends often found that linux can be successfully installed when the system is started and installed on a DVD. However, when the system is started for the first time, only one black screen appears, and grub> appears, but cannot enter the Linux system. what is the problem?

1. during the installation process, it is not a problem to load the Linux kernel because it is started on a DVD or CD, and the kernel will lose the hardware of the detection system. Therefore, it can identify hard disks that are not recognized by the BIOS.

2. However, when the hard disk is started, because the Kernel and initrd files are read through the INT3 channel of the BIOS, if your Kernel and initrd are placed in sectors that cannot be determined by the BIOS, of course, it will not be loaded, but it will only show grub> waiting for your processing

Three key content

1 Linux cannot be shut down at will, otherwise it may cause file system disorder or other problems that cannot be started

2 the startup process mainly includes BIOS, MBR, Loader, Kernel + initrd,/sbin/init, etc.

3. the init configuration file is/etc/initab. you can set the default runlevel, system initialization script, and services of different execution levels.

4. too many grub configuration files and related file system definition files are stored in the/boot/grub Directory. the configuration file name is menu. lst.

5. to enter the rescue mode, you can enter the rescue mode by adding "single" or "init =/bin/bash" after the kernel option during the startup menu.

Related Article

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.