Linux system Boot Process

Source: Internet
Author: User

First, the boot of the kernel

When the computer is powered on, it starts with the BIOS post, starting with the boot device set up in the BIOS.

After the operating system takes over the hardware, read the kernel file in the/boot directory first

Second, run Init

The init process is the starting point for all processes in the system, and you can compare it to the ancestor of all processes in the system, without which any process in the system will not start.

The INIT program first needs to read the configuration file/etc/inittab

Third, the operating level

Many programs need to boot up. They are called "services" in Windows, and in Linux they are called "daemons" (daemon)

One of the major tasks of the Init process is to run these boot-up programs.

However, different applications need to start different programs, such as when serving as a server, the need to start Apache, as a desktop is not required.

Linux allows different start-up programs to be assigned for different occasions, which is called "RunLevel". That is, at startup, depending on the runlevel, determine which programs to run.

The LINX system has 7 operating levels:

Run Level 0: System down state, the 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

Third, System initialization

There is a line in the init configuration file: Si::sysinit:/etc/rc.d/rc.sysinit It calls execution/etc/rc.d/rc.sysinit, and Rc.sysinit is a bash shell script, It is mainly to do some system initialization work, Rc.sysinit is each run level must first run the important script.

Its main work is to activate swap partitions, check disks, load hardware modules, and perform tasks that require priority.

  

L5:55

This line indicates that running with the 5 parameter/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 begins with K or S, and for a startup script that starts with S, it runs with the start parameter.

If it is found that the corresponding script also has a K-link, and is already in the running state, then the stop is 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.

    

Iv. Establishment of Terminal

After the RC finishes executing, return to init. At this point the basic system environment variables have been set up, the various daemons have been started. Init will then open 6 terminals for the user to log into the system. The following 6 lines in the Zaiinittab define 6 terminals:

1:2345:respawn:/sbin/mingetty tty1

2:2345:respawn:/sbin/mingetty Tty2

3:2345:respawn:/sbin/mingetty Tty3

4:2345:respawn:/sbin/mingetty Tty4

5:2345:respawn:/sbin/mingetty Tty5

6:2345:respawn:/sbin/mingetty Tty6

Mingetty program can open terminal, set mode. At the same time it will display a text login interface, which is the login interface that we often see, the login interface will prompt for the user name, and the user input user will be passed as parameters to the login program to verify the identity of the user.

Five, User login system

In general, there are three ways to log on to users:

(1) Command line login

(2) SSH login

(3) Graphical interface login

How to switch between graphic mode and text mode

Linux presets provide six command window terminals to let us log in.

The default is the first window, that is, tty1, press Ctrl+alt+f1~f6 to toggle them.

Linux shutdown

Most of the Linux domain is used on the server, and there are few shutdown operations. After all, running a service on the server is endless, unless in exceptional circumstances, the last resort will be turned off.

The correct shutdown process is: Sync>shutdown>reboot>halt

The shutdown instruction is: shutdown, you can see the following help document for man shutdown.

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.