Linux system Boot Process

Source: Internet
Author: User

The Linux system startup process can be divided into 5 steps:

1, first load the Linux system kernel files, that is, boot first read the boot directory kernel files;

2, the second step is to run the INIT process under Linux, this process is the starting point of all processes, this process is/etc/inittab this file;


The Linux system has 7 runlevel (runlevel):

    • RunLevel 0: System down state, system default RunLevel cannot be set to 0, otherwise it will not start normally
    • RunLevel 1: Single User working status, root privilege, for system maintenance, remote login Forbidden
    • RunLevel 2: Multi-User State (no NFS)
    • RunLevel 3: Full multiuser State (with NFS), enter console command line mode after login
    • Run Level 4: System not used, reserved
    • Run level 5:x11 console, login to GUI mode
    • RunLevel 6: The system shuts down gracefully and restarts, the default runlevel cannot be set to 6, otherwise it will not start normally
in general, the default is run level 3, such as the last Id:3:initdefault3, the next third step is the initialization of the system operationThis time we will analyze the system-related configuration files shown/etc/init/rcs.conf

And Rc.sysinit is a bash shell script that is primarily about doing some system initialization, and Rc.sysinit is an important script to run first at every runlevel.

Its main tasks are: Activating the swap partition, checking the disk, loading the hardware modules, and some other priorities that need to be performed.

Let's take a look at/etc/init/rc.conf, the file that executes the system's self-initiated script

For example/ETC/RC.D/RC 5

This line indicates that running with the 5 parameter/ETC/RC.D/RC,/ETC/RC.D/RC is a shell script that accepts 5 as a parameter to execute all RC startup scripts under the/etc/rc.d/rc5.d/directory,/etc/rc.d/rc5.d/ These startup scripts in the directory are actually some connection files, not the actual RC startup scripts, and the actual RC startup scripts are actually placed in the/etc/rc.d/init.d/directory.

These RC startup scripts have a similar usage, and they generally accept start, stop, restart, status, and so on.

The RC startup script in/etc/rc.d/rc5.d/is usually a connection file that starts with K or S, and will run with the start parameter for startup scripts starting with S.

If you find that the corresponding script also has a K-link, and is already in the running state (the file under/var/lock/subsys/as the flag), the stop will be the first parameter to stop these started daemons, and then rerun.

This is done to ensure that when Init changes the RunLevel, all associated daemons are restarted.

As to which Daemons will be run at each run level, the user can be set from the row by using "System Services" in Chkconfig or Setup.

4, the fourth step, the establishment of the terminal

After the RC finishes executing, return to init. At this point the basic system environment has been set up, various daemons have been started.

This is the need to set up a user terminal, convenient for users to login, this need to look at the first picture above the/etc/init/tty.conf file


For example:

1:2345:respawn:/sbin/mingetty tty1

It will display a text login interface, which we often see the login interface, in this login screen will prompt the user to enter a user name, and the user input user will be passed as a parameter to the login program to verify the identity of the user.

5. last step, user login

In general, there are three ways users sign in:

    • (1) Command line login
    • (2) SSH login
    • (3) Graphical interface login

For graphical users with a run level of 5, their login is via a graphical login interface. After successful login, you can go directly to KDE, GNOME and other window manager.

This article is mainly about the text mode of login: When we see the Mingetty login interface, we can enter the user name and password to log into the system.

Linux Account Verification Program is Login,login will receive mingetty from the user name parameters.

Login then parses the username: If the user name is not root and there is a/etc/nologin file, login will output the contents of the Nologin file and then exit.

This is typically used for system maintenance to prevent non-root users from logging on. Only the terminal registered in/etc/securetty allows the root user to log on, and if the file does not exist, root can log on at any terminal.

The/etc/usertty file is used to make additional access restrictions to the user, and there are no additional restrictions if the file does not exist.


Linux system Boot Process

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.