CentOS System Startup Process

Source: Internet
Author: User

CentOS System Startup Process
CentOS (Community Enterprise Operating System) is one of the Linux releases, it is from the source code compiled by Red Hat Enterprise Linux according to open source code regulations. Because of the same source code, some servers that require high stability use CentOS instead of the commercial version of Red Hat Enterprise Linux. The difference between the two lies in that CentOS does not contain closed source code software.

After we press the enable key, do we know the secrets behind the system? Here, I will show you the secrets behind linux boot.

Power-on self-check

After the main board is powered on, the system first checks Each internal device by the POST program. If any error is found in the self-check, the system will handle the problem in two cases: For serious faults (fatal faults) the instance is shut down. At this time, no prompts or signals are provided because various initialization operations are not completed. If the fault is not serious, a prompt or sound alarm signal is provided, waiting for the user to handle it.

BIOS boot phase

After the self-check is passed, find the boot devices in order. The first device with a boot program is the device to be used for this start. Generally, the computer enters the BIOS by pressing the "F2" or "Del" key. In this case, we can adjust the hard drive startup sequence. After finding the first device with a boot program, the BIOS will find the MBR in the device and read the Bootloader.

GRUP boot phase

At this time we can see our Centos system, but generally do not need to operate, will automatically start the system. In fact, we can also manually start the system.

Manually start the system on the grub command line interface:
grub> root (hd#,#)grub> kernel /vmlinuz-VERSION-RELEASE ro root=/dev/DEVICEgrub> initrd /initramfs-VERSION-RELEASE.imggrub> boot
Grub command line interface:
E: editing mode, used to edit the menu; c: Command mode, interactive interface; help: get the help list; help KEYWORD: Detailed help information; find (hd #,#) /PATH/TO/SOMEFILE: root (hd #, #) sets the grup root device; kernel/PATH/TO/KERNEL_FILE: sets the kernel file used for this startup; additionally, you can add many Kernel support using the cmdline parameter. For example, init =/path/to/init, selinux = 0; initrd/PATH/TO/INITRAMFS_FILE: set ramdisk to provide additional files for the selected kernel; boot: boot to start the selected kernel;
Configuration File parameters:/boot/grub. conf
Default = #: Set the default menu item to start. The title number starts from 0. timeout = #: specifies the duration of the menu item waiting for the option to be selected; splashimage = (hd #, #)/PATH/TO/XPM_PIC_FILE: Specifies the PATH of the menu background image file; hiddenmenu: hides the menu; password [-- md5] STRING: menu editing authentication; title TITLE title: defines the menu item "TITLE", which can appear multiple times; used to guide multiple kernels or operating systems; root (hd #,#): grub searches for the device partition where stage2 and kernel files are located. It is the "root" of grub; kernel/PATH/TO/VMLINUZ_FILE [PARAMETERS]: The kernel started; initrd/PATH/TO/INITRAMFS_FILE: the ramfs file matched by the kernel; password [-- md5] STRING: authenticates when the selected kernel or operating system is started.
Kernel loading stageThe kernel will initialize itself:
Detects all recognizable hardware devices, loads hardware drivers, (may use ramdisk to load drivers), and mounts the root file system in read-only mode; run the first application of the user space:/sbin/init.
Init initialization phase

After the kernel is loaded, the init program is run. After the init process is started, control of the system startup is handed over to the init process;/sbin/init process is the parent process of all processes. After the init process is started, it first reads the configuration file/etc/inittab and performs the following operations:

1. execute the system initialization script (/etc/rc. d/rc. sysinit) to perform basic configuration for the system, and mount the root file system and other file systems in read/write mode. Now the system is basically running, determine the running level and start the corresponding service. 2. determine the running level after startup; 3. run/etc/rc. d/rc. This file defines the order in which the service is started after k s, and the specific service status at each running level is put in/etc/rc. d/rcn. d (n = 0 ~ 6) All files in the directory are linked to/etc/init. d file; 4. key sequence settings; 5. script definition for UPS; 6. start the virtual terminal/sbin/mingetty; 7. run X on runlevel 5.

Configuration File:/etc/inittab; each line defines an action and the corresponding process

Id: runlevels: action: process; id: the identifier of a task. runlevels: the level at which the task is started: under what conditions should this task be started; process: task; (script or program); action: wait until the current level of the task is switched; respawn: once this task is terminated, it will be automatically restarted; initdefault: Set the default running level; at this time, process is omitted; sysinit: set the system initialization method, here it is generally specified/etc/rc. d/rc. sysinit script; K *: the service to be stopped; K ### *. The smaller the priority and number, the closer the service is to be stopped. The dependent service is disabled first, and then the dependent service is disabled; S *: the service to be started; S ### *: priority. The smaller the number, the higher the priority. The dependent service is started first, and the dependent service is started later;

Chkconfig command: control the startup or shutdown status of/etc/init. d/each service script at each level;

View: chkconfig -- list [name] add: chkconfig -- add name Delete: chkconfig -- del name

Modify the specified link type:

Chkconfig [-- level LEVELS] name <on | off | reset> -- level LEVELS: Specifies the level to be controlled. The default value is 2345.

Init command:

Level switch: init #; level view: who-r.

Note: At the normal level, the last service S99local started is not linked to/etc/init. A script under d is linked to/etc/rc. d/rc. local (/etc/rc. local) scripts. Therefore, programs that are inconvenient or do not need to be written as service scripts expect to run automatically upon startup can be directly placed in this script file.

Address: http://www.linuxprobe.com/system-startup-process.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.