Linux Academy: Getting Started with Linux Tutorials

Source: Internet
Author: User
Keywords linux academy linux tutorial linux academy vs cloud guru linux devops tools

Linux system startup process

The startup of Linux is actually very similar to the startup process of Windows, but we cannot see the startup information on Windows, and we will see a lot of startup information when Linux starts, such as whether a service is started.

In the Linux Academy, it will show you that the startup process of the Linux system can be roughly divided into five parts: kernel boot; run init; system initialization; establish terminal; user login system.

Kernel boot
When the computer is powered on, the BIOS self-test is the first step. It starts according to the boot device (usually a hard disk) set in the BIOS. Then the grub program on the boot device starts to boot linux. When the boot program successfully completes the boot task, Linux takes over the control of the CPU from their hands, and then the CPU begins to execute the core image code of Linux, starting the Linux boot process . That is, the so-called kernel boot has started. In the kernel boot process, it is actually very complicated. We treat it as a black box. Anyway, the Linux kernel does some work. Finally, the kernel calls and loads the init program. The work is done. Handed over to the next protagonist, init.

Run init
The init process is the starting point of all processes in the system. You can compare it to the ancestor of all processes in the system. Without this process, no process in the system will start. The init program first needs to read the configuration file / etc / inittab. inittab is an unexecutable text file, which consists of several lines of instructions. The specific content is as follows: (you can execute the command cat / etc / inittab on your linux to obtain this)

Take the above inittab file as an example to illustrate the format of inittab. The lines starting with # are comment lines. Except for the comment lines, each line has the following format:

A detailed explanation of the above items is as follows:

1.id

Id refers to the entry identifier, which is a string. For other login program items such as getty or mingetty, the id and tty number must be the same, otherwise the getty program will not work properly. 2.Runlevel

runlevel is the identifier of the runlevel that init is in, and generally uses 0-6 and S or s. 0, 1, and 6 run levels are reserved by the system: 0 is the shutdown action, 1 is the restart to single-user mode, and 6 is the restart; S and s have the same meaning, indicating single-user mode, and no inittab file is required, so they are not in inittab It appears that in fact, when entering single-user mode, init runs / sbin / sulogin directly on the console (/ dev / console). In the general system implementation, several levels of 2, 3, 4, and 5 are used. In the CentOS system, 2 means multi-user mode without NFS support, and 3 means fully multi-user mode (also the most commonly used level). 4 Reserved for user customization, 5 means XDM graphical login mode. Levels 7-9 can also be used. Traditional Unix systems do not define these levels. runlevel can be multiple values in parallel to match multiple runlevels. For most actions, the runlevel will only be executed if it matches the current runlevel successfully.

3.action

The action describes how the subsequent process runs. Possible values for action include: initdefault, sysinit, boot, bootwait, etc .: initdefault is a special action value used to identify the default startup level; when init is activated by the core, it will read the initdefault item in inittab to obtain The runlevel is used as the current runlevel. If there is no inittab file, or there is no initdefault item, init will request runlevel on the console. Actions such as sysinit, boot, bootwait, etc. will run unconditionally when the system is started, and the runlevel will be ignored. The remaining actions (excluding initdefault) are all related to a runlevel. The definition of each action is described in detail in the inittab man manual.

4.process

process is the specific execution procedure. You can take parameters after the program.

Tips: It doesn't matter if you don't understand this file. With your in-depth understanding of Linux, if you look back at this file, you will suddenly be cheerful. But you must now understand the meaning of each level of runlevel.
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.