Linux system startup (3) and linux system startup

Source: Internet
Author: User

Linux system startup (3) and linux system startup

In the previous section, the system initramfs has been started, and the system control is handed over to the real rootfs/sbin/init. The following figure shows the working time of/sbin/init.

4/sbin/init

Initramfs init script. After switching to the true root fs through the switch_root command, the first program to be executed is/sbin/init under root fs,

4.1 switch_root

Swith_root newroot init [arg]

Eg:

Switch to the true rootfs command in initramfs is switch_root/sysroot/sbin/init.

The root fs is mounted to the/sysroot directory.

4.2/sbin/init

/Sbin/init: it is the first program executed by the system, that is, it is viewed using pa auxf, and the program with PID 1 is it. It can be understood as the parent process of all processes of the system.

Run rpm-qf/sbin/init to check that the/sbin/init program in the system comes from upstart. For details about upstart, refer to upstart [6].

In traditional operating systems,/sbin/init is managed by System V init. upstart was originally developed for ubuntu and is now used by more and more linux systems. For the differences between System Vinit and upstart, see [7].

The main process of/sbin/init is as follows:

1. Run/etc/rc. sysinit.

2. Run the/etc/rc script. The rc Script selects to run the script in the corresponding directory based on the passed runlevel.

3. Run/etc/rc. local.

4.3 rc. sysinit.

Perform the following tasks:

1. Mount the File System (PASS Parameters and configuration files through grub, and mount/repair the file system ).

2. Module loading (using udev rules to load modules, such as NICs and user-defined rules ).

3. SELINUX problems (unknown ).

The following two links are also described:

Http://linux.chinaunix.net/techdoc/beginner/2009/01/21/1059280.shtm

Http://www.cnblogs.com/image-eye/archive/2011/10/21/2220344.html

4.4 rc *. d

For all service script directories, scripts of different levels corresponding to different directories will be executed and will not be described in detail here.

# Default runlevel. The runlevels used are:

#0-halt (Do NOT set initdefault to this)

#1-Single user mode

#2-Multiuser, without NFS (The same as 3, if you do not have networking)

#3-Full multiuser mode

#4-unused

#5-X11

#6-reboot (Do NOT set initdefault to this)

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.