This chapter focuses on:
1.linux Boot Process
2.linux Run Level
3.linux Start Service Management
4.GRUB Configuration and application
5. Start Fault Analysis Solution
Linux startup process
1. Firmware (fireware): Fixed on the hardware program, mainly Cmos/bios
2.post power-on self-test,
1. Detect hardware information, such as CPU, memory, etc. hardware information is working properly.
2. Security settings
3. Bootable Media list
4. Bootable Media Search Program
5. Power Management
6. Start the detail information
3. Read the MBR (Master boot record) master boot record
MBR is located at 0 column head 0 Head 1 sector
To read the master boot Record process:
1.boot loader bootloader loaded into kernel
After loading the kernel
Drive hardware: For other embedded cores can be cut, read only the required driver of the platform, the driver is different from the firmware detection, the driver refers to the software level to understand the hardware.
Start init: The initialization process is the first process initiated by the system, read the Inittab file after startup, and execute the default runlevel to continue booting, in Unix, the PID of the INIT process is the process ID constant is 1, general
Other processes are randomly changed, but the init process is different, from the PID to see that the INIT process is responsible for a more advanced process, is the kernel scheduler kernel Scheduler, which allocates CPU time, is the Linux sub-
The performer of the time attribute to obtain CPU time.
PS: Two kinds of processes in Linux
1. Orphan process: The parent process dies and the child process is not dead, at which point the child process is directed to the Init process.
2. Zombie Process: Child process death, parent process not dead.
Information about the process can be seen from Ps–le |more
2.partition table
3.Magic number
The init process reads the/etc/inittab file
Linux Run Level:
0 halt shutdown, do not set as default run level
1 Single-User mode
2 Multi-user mode, no graphical interface, no NFS (NET file server) file sharing service
3 multi-user mode with NFS
4 Unused custom runlevel, or reserved run level
5 XLL Install the system after default, that is, the version number of Xwindow
6 reboot reboot and do not set as default.
You can view the current run level through RunLevel. or telinit switch the run level
You can also Ctrl+alt FN N as the run level number
For GRUB configuration Files
Default defines the operating system that defaults to start 0 for the first
Timout default wait time, that is, grub default is 3 seconds keyboard does not respond to enter
Splashimage defines a picture of the Grub interface (if you need to customize it, make it smaller, and the card doesn't work well)
Hidden menu Hidden Menus
PS: (hd0,0) The first partition of the first hard disk/boot is not separate, it belongs to the root partition
Title defines the name of the menu item
Root sets the partition where the grub (hd0,0) root device resides
Kernel define where the kernel is located
INITRD Loading photographed image file
When you forget the root password, you can enter single user mode, select kernel line in grub by pressing E (edit), and then press E to enter 1 or S (single) in the last line of the new interface, and then press B to enter one-user mode. Change root password by passwd
The Grub command, which can be set through Hiddenmenu.
E: Edit when moving forward
C:commod
B:boot
D: Delete When moving forward
1. The grub password can be set via Grub GRUB-MD5-CRPYT
Copy ciphertext paste to grub conf title
PASSWORD–MD5 cipher
When we get to grub, I need p to enter the password.
Grub Repair
When booting into grub only
Grub> such a prompt, then look at/grub/grub.conf
Enter the GRUB command line for manual boot
If the entire Inittab file is deleted, you need to go to the BIOS to use the image for repair, enter the F5 repair mode, enter the Linux rescue into the repair
Data will be mounted to/mnt/sysimage
CP Inittab to the specified directory to complete the repair
Linux boot process