Linux Study Notes-system guiding process

Source: Internet
Author: User

Analysis of Linux boot process
1. System guiding process
Firmware firmware (CMOS/BIOS) Post power-on self-check
Bootstrap loader (grub) loads the kernel
Load kernel driver hardware
Start Process init
Read the execution configuration file/etc/inittab

Common firmware settings
Security Settings
List of bootable Media
Guiding media search sequence
Power Management
Startup details display

In Linux, if the parent process of a process is not completed for some reason, the process is automatically directed to the INIT process after the system discovers it. Therefore, in theory, the INIT process is the parent process of all processes.
If the child process ends, but the parent process does not know. Then the child process is programmed as a zombie process.

ID: Run-levels: Action: Process
Grep-V indicates exclude characters in the file
For example, grep-V "^ #"/etc/inittab | more
Display by page. The first line of the inittab row is # not displayed.

ID: identifier. It is generally a behavior ID of two letters or numbers.
Run-levels: Specifies the running level. You can specify multiple methods.
Action: specifies where the running status can be understood
Process: Specifies the script/command to be run as a behavior.
The first three items are all set for process.

Script/etc/rc. d/rc. sysinit
This script is used to load environment variables and generate log information.
If you want to execute a command at every startup, you can add it to the end of the/etc/rc. d/RC/sysinit file. Each running level will be executed

Script/etc/rc. d/RC
Corresponding to the service to be started at each running level. Complete subsequent startup.
Determined by initdefault

Directory/ERC/rc. d/rcN. d
[Root @ Lovelock Frost] # ls-L/etc/rc. d/rc3.d
Total 0
Lrwxrwxrwx. 1 Root 16 Aug 2 k01smartd-> ../init. d/smartd
Lrwxrwxrwx. 1 Root 17 Aug 2 k02oddjobd->.../init. d/oddjobd
Lrwxrwxrwx. 1 Root 17 Aug 2 k05wdaemon->.../init. d/wdaemon
Lrwxrwxrwx. 1 Root 16 Aug 2 23:04 k10psacct->.../init. d/psacct
Lrwxrwxrwx. 1 Root 19 Aug 2 k10saslauthd->.../init. d/saslauthd
Lrwxrwxrwx. 1 Root 15 Aug 2 k15httpd-> ../init. d/httpd
Lrwxrwxrwx. 1 Root 24 Aug 2 K30spice-vdagentd-> ../init. d/spice-vdagentd
Example: k15httpd
S-start startup Item
K-kill non-startup Item
Numbers represent priority, starting a small one first
Script Name httpd

Review:
Firmware physical hardware power-on self-check
|
Bootloader -- grub
|
Load kernel Kernel
|
Init
|
/Etc/inittab
|
Initdefault: determines the default running level of the system
|
/Etc/rc. d/rc. sysinit
|
/Etc/rc. d/RC
|
/Etc/rc. d/rcN. d n = 0 ~ 6
|
Username
|
Password
Two actions. One wait indicates that other commands are enabled after the command is started.
If a command is automatically started upon startup, its action is wait.
Powerfail: When a power error occurs, run the command specified by process without waiting for it to end.
Powerokwait: Execute the command specified by process when the clerk recovers
Respawn: Once the command specified by process is terminated, the command is re-run.

Local terminal tty can be used at runtime level 2345 and can be used for switching
Set the self-starting program:
Ln-S
Chkconfig
Ntsysv can only change the commands installed by default.

Dmesg check whether the hardware is identified by the kernel
Grep sshd/var/log/messages

Menu. lst
Default = 0 default system entry when the dual-system is started
Timeout = 5 wait for time before entering the system, 5S, doesn't make too much sense
Splashimage = (hd0, 0)/GRUB/splash.xpm.gz (hd0, 0) represents the first hard disk. It is a special representation of grub, with a resolution of 640*480 and a color depth of 14.
Title can be changed as needed
Root defines the directory where all startup files are located, that is,/boot
The kernel is followed by the kernel location Ro, indicating that the kernel is read-only during loading.
Initrd loads the image file, and the necessary Image File Settings during system boot

Case: Root Password forgotten
Enter the single-user mode, reset the root password, boot to enter the grub interface, press e to enter the edit mode, select the kernel line, and press the e key again, enter 1 or s in the last line of the new interface to enter single-user mode.
E: edit the current Startup menu. Edit
C: Enter the command line mode command of grub
B: Start the current menu item boot.
D: Delete the current row.

Any operating system that allows users to sit in front of a computer is not safe and can be cracked. Therefore, servers are stored in the data center.
The grub guiding process is actually very simple. If you can systematically learn about the problems on the internet, it will not exist.
Set password and encryption for grub
# Grub-md5-crypt
Or grub
Grub> md5crypt
If important system files are lost, you can use the CD to enter the repair mode.

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.