CentOS running level and Boot Process

Source: Internet
Author: User

CentOS running level and Boot Process

  1. Linux running level:

1) 0: Shutdown

2) 1. Single User

3) 2. There is no network service in the multi-user status

4) 3. Multi-User Network Services

5) 4. The system is not used and reserved for the user.

6) 5. Graphic Interface

7) 6: system restart

Note: The common running levels are 3 and 5. to modify the running level, you can change the id of the file/etc/inittab to 5: Number in initdefault.

2. Solution to forgetting the root password:

When the machine starts and enters the grub boot program, press e, select the line with label = (usually the second line), then click e, enter 1, (change the running level to 1) Press enter to enter the standalone mode, and then restart to modify the original configuration file.

3. linux boot process:

1) when you turn on the computer power, the computer will first load BIOS information, BIOS contains CPU information, device startup sequence information, hard disk information, memory information, pnP features. In this way, the computer will know which hardware device to read.

2) read MBR. As we all know, the first sector of the disk's 0th track is known as MBR (Master Boot Record), which is the Master Boot Record. Its size is 512 bytes and contains pre-Boot information, partition Table information. After the system finds the hard disk MBR specified by BIOS, it will copy it to the physical memory where the 0X7c00 address is located. The memory content is the Boot Loader, and the specific content to your computer is lilo or grub.

3) Boot Loader: A small program before the operating system kernel runs. In this section, we can initialize hardware devices and create a map of memory space to bring the system's hardware and software environment to a proper state, in order to make all preparations for the final call to the operating system kernel. There are several Boot Loader types, among which Grub, Lilo, and spfdisk are most commonly used. For example, grub reads grub configuration information (generally menu. lst or grub. lst) in the memory and starts different operating systems according to the configuration information.

4) load the kernel: According to the path of the grub kernel image, the system reads the memory image and decompress it. At this time, the screen will usually output the "Uncompressing Linux" prompt. After the kernel is decompressed, the screen outputs "OK, booting the kernel ". The system places the decompressed kernel in the memory, calls the star_kernel () function to start a series of initialization functions, initializes various devices, and completes the establishment of the linux core environment. So far, the linux kernel has been established, and the linux-based program should be able to run normally.

5) User-layer init sets the running level based on the inittab file: After the kernel is loaded, the first program to run is/sbin/init, which reads the/etc/inittab file, perform initialization Based on the file. In fact, the main function of the/init/inittab file is to set the Linux running level in the form of ": id: 5: initdefault:", which indicates that Linux needs to run on level 5. For the running level, see 1.

6) The init process executes rc. sysinit: After the running level is set, the first user-layer file executed by linux is/etc/rc. d/rc. the sysinit script program does a lot of work, including setting the Path, setting the network configuration (/etc/sysconfig/network), starting the swap partition, and setting/proc.

7) Start the kernel module: the kernel module is loaded Based on the/etc/modules. conf file or the file in the/etc/modules. d directory.

8) execute script programs of different running levels: depending on different running sectors, the system runs the corresponding script programs from rc0.d to rc6.d to complete initialization and start the corresponding services.

9) executing/etc/rc. d/rc. local: rc. local is the place for linux to personalize after all initialization work. You can put what you want to set and start here.

10) run the/bin/login program and log on to the system. At this time, the system is waiting for the user to enter username and password. you can log on to the system with your own account.

Reference: http://blog.chinaunix.net/uid-26495963-id-3066282.html

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.