Home >System Tutorial >LINUX >Steps to enter CentOS 7 emergency repair mode

Steps to enter CentOS 7 emergency repair mode

PHPz
PHPzforward
2024-01-13 09:36:111401browse

Open the centos7 page and appear:

Welcome to emergency mode! after logging in, type “journalctl -xb” to view system logs, “systemctl reboot” to reboot, “systemctl default” to try again to boot into default mode.

give root password for maintenance

(?? Control-D???):

Solution:

Execute runlevel and display unknown

Modify the default startup level

a. Delete first: mv /etc/systemd/system/default.target /etc/systemd/system/default.target.back #Rename the file

b. Create a soft link file: ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

or

ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target

You can also use the systemctl command:

systemctl set-default graphical.target

systemctl isolate multi-user.target

Error reported during execution: Error getting authority: Error initializing authority: Could not connect: Resource temporarily unavailable (g-io-error-quark, 1)

View log journalctl -xb

Found a mounting error in the log:

Steps to enter CentOS 7 emergency repair mode

It can be seen that it is a mounting problem, the /home file is not mounted

Edit automatically mounted files vi /etc/fstab

Comment out the line that mounts /home (backup first)

#/dev/mapper/centos-home /home xfs default 0 0

Restart the server reboot

After the startup is successful, the page is stuck on the white bar. You can press the esc key to view the startup details. It is stuck on /etc/rc.d/rc.local. Restart into single-user mode:

(1). Select e

as the default option when booting up.

Steps to enter CentOS 7 emergency repair mode

(2).Find the line of ro

Steps to enter CentOS 7 emergency repair mode

(3) Change ro to rw init=/sysroot/bin/sh and press ctrl x to start

Steps to enter CentOS 7 emergency repair mode

(4) After entering the single-user page, execute chroot /sysroot to obtain root permissions

After entering single-user mode, edit the rc.local file, comment out all startup items related to /home, and restart the server

After the restart is successful, it will enter the normal mode. At this time, you can check the /home mounting problem

(1).lvs -a -o devices Check the disk details and you can see that the attr parameter of home does not have a (activated) inactive status

(2).lvchange -a y /dev/mapper/centos-home Activate home

(3).Mount home,mount /dev/mapper/centos-home /home

(4). Mount successfully, change the original comments in fstab and rc.local back

Steps to enter CentOS 7 emergency repair mode

Restart successful, problem solved

The above is the detailed content of Steps to enter CentOS 7 emergency repair mode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete