Analysis of startup process of Linux system

Source: Internet
Author: User

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

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.