Linux Boot Sequence
Motherboard BIOS power-on self-test hardware
-Read hard drive boot sector (MBR)
-Boot Boot program (GRUB)
-Select System
-Load the system kernel (kernel shell)
-Start the system to read the corresponding default settings (environment variables, runlevel)
--Start the appropriate services and processes
--Landing System interface
Boot program configuration file
/etc/grub2.cfg
To view all boot levels
#cd--/usr/lib/systemd/system ls
1. (1) View the default boot level for the current boot
#systemctl Get-default
To modify the default startup level
Example: Level 3--"Level 5
Ln-sf/usr/lib/systemd/system/graphical.target/etc/systemd/system/default.target
Example: Level 5--"Level 3
Systemctl Set-default Multi-user.target (level to modify)
[note] RunLevel can only be modified by means of a soft connection
Simulated accident
Level 0 that will be modified to start the system will not start
Repair:
Reboot into Grub Boot interface
--up and down arrows end countdown
--Press the E key to enter the startup parameter settings
--Find Linux16 at the end of the line UTF-8 add systemd.unit = Rescue.target (Specify mode to enter the system)
-->ctrl x (startup parameter setting)
Crack root Password
Reboot into Grub Boot interface
--up and down arrows end countdown
--Press the E key to enter the startup parameter settings
--Method ①: Find Linux16 to modify ro to RW init =/systemctl/bin/sh (enter root into the system default shell) to avoid hard drive loading
--method ②xd:utf-8 after adding keyword Rd.break
-->ctrl x
:/#mount View mount table, check whether the mount permission of the root partition is RW, if RO, need to mount, load permissions
:/#mount-O remount,rw/sysroot re-mount, load permissions
:/#chroot/sysroot/bin/bash Toggle Normal Startup Bash
:/#unset LANG Clear language environment variables
:/#passwd Change Password
:/#getenforce View selinux status
If SELinux is not closed, you need to allow SELinux to accept the new password
:/#touch/.autorelabel Create an associated tag file under/
:/#exit back to SH
:/#reboot Restart to verify the new password
Analysis of startup process of Linux system