boot today found CentOS8.1 system can not boot!! I recall that I updated some system packages yesterday. At that time, the updated system was not restarted, and the updated system was not detected. It was an oversight!
take a closer look at the log and it turns out that the Switch Root is wrong, as shown below:
prompt error log generation, a simple look, want to get the U disk first, then follow up.
is inserted into the U disk, no device is detected, exit is performed, and sda is identified after repeated twice. As shown below:
then U disk mounted to/sysroot, prompt data to test with U disk,, FSCK detection, the log file/run/initramfs/rdsosreport. TXT is copied to the U disk, and then uninstall U disk. As shown below:
try manually mounting CentOS8 system disk to /sysroot and find the partition mount corresponding to CentOS8. As shown below:
then exit and the system starts normally! Fortunately, it’s not a big problem.
come in the system, think under the analysis of the cause, to fundamentally solve it…
open the log file rdsosreport.txt in the U disk, find the error fragment log analysis:
[ 79.300190] xxx systemd[1]: Reached target Switch Root.
[ 79.300600] xxx systemd[1]: Starting Switch Root...
[ 79.304948] xxx systemctl[2113]: Failed to switch root: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.
[ 79.305456] xxx systemd[1]: initrd-switch-root.service: Main process exited, code=exited, status=1/FAILURE
[ 79.305593] xxx systemd[1]: initrd-switch-root.service: Failed with result 'exit-code'.
[ 79.305789] xxx systemd[1]: Failed to start Switch Root.
[ 79.305811] xxx systemd[1]: initrd-switch-root.service: Triggering OnFailure= dependencies.
[ 79.306342] xxx systemd[1]: Starting Setup Virtual Console...
[ 79.364641] xxx systemd[1]: Started Setup Virtual Console.
[ 79.365205] xxx systemd[1]: Started Emergency Shell.
[ 79.365348] xxx systemd[1]: Reached target Emergency Mode.
[ 79.380910] xxx systemd[1]: Received SIGRTMIN+21 from PID 1675 (plymouthd).
see the key record:
Failed to switch root: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.
because the root path was not mounted successfully, /sysroot had no content, and the os-release file was not found.
, can you imagine if the os-release file for the system is gone?Open the /etc/cenos-release file and find the content, that’s not the problem with this file!
[root@server ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
continue to search, efi directory to see centos related files are there any questions?The size of the GRUbenv file is zero. Is that the problem?!
[root@server ~]# ls -al /boot/efi/EFI/centos/
total 5364
drwx------. 3 root root 4096 Feb 21 23:01 .
drwx------. 6 root root 4096 May 11 2019 ..
-rwx------. 1 root root 134 Jun 7 2019 BOOTX64.CSV
drwx------. 2 root root 4096 Feb 5 09:46 fonts
-rwx------. 1 root root 9570 Feb 13 22:08 grub.cfg
-rwx------. 1 root root 0 Feb 21 23:01 grubenv
-rwx------. 1 root root 1876872 Feb 5 09:46 grubx64.efi
-rwx------. 1 root root 1160136 Jun 7 2019 mmx64.efi
-rwx------. 1 root root 1205152 Jun 7 2019 shimx64-centos.efi
-rwx------. 1 root root 1211224 Jun 7 2019 shimx64.efi
then edits the grubenv file and adds the following.
# GRUB Environment Block
saved_entry=16611cc1c45441e1a5aa9fa702a005ff-4.18.0-147.5.1.el8_1.x86_64
kernelopts=root=UUID=5d5f3d63-4aed-45f1-85a9-e875c29c114a ro resume=UUID=ddeaf98e-c239-46be-95c3-d36156c1b0f6 rhgb quiet
boot_success=0
boot_indeterminate=0
################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
main parameter description (do not write wrong! : p>
saved_entry:是默认的引导项
kernelopts:
root填写/分区的UUID,
resume填写swap分区的UUID
restart, normal start, no more error. Problem solved!
============
Note: if you do not know how to edit this file, you can regenerate grub by executing the following:
[root@server EFI]# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
Generating grub configuration file ...
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
generates grubenv as follows, there will be some incomplete parameters oh.
# GRUB Environment Block
kernelopts=root=UUID=5d5f3d63-4aed-45f1-85a9-e875c29c114a ro resume=UUID=ddeaf98e-c239-46be-95c3-d36156c1b0f6 rhgb quiet
################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
summary:
-
to calmly analyze problems, to learn to analyze and solve problems, this ability is very important.
-
systematically study, master the knowledge of a field is very necessary. The idea and process of solving the problem depends on your understanding of the system!
note: this article is original and shall not be reproduced on any platform without permission. For reprint, contact the author ~
p>