我只有图片。而且我不能很好地写问题。
我正在启动我的笔记本电脑(使用Windows 10 Pro
和CentOS8
)。
systemctl status initrd-switch-root.service
https://i.stack.imgur.com/fuGRU.jpg
https://i.stack.imgur.com/CAQ7Y.jpg
最后一张图片Failed to Start Switch Root
。和
Failed to switch root: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.
https://i.stack.imgur.com/onWbr.jpg
做一个ls -al /sysroot
该目录是空的。
我dmesg
得到了:
知道为什么会发生这种故障吗?
显然,我该如何解决它?
在图像中,唯一有效的条目是 Rescue
CentOS 条目位于 Windows 条目上方CentOS Linux (0-rescue-***)
请帮忙。
编辑1:
使用溶液https://unix.stackexchange.com/a/212710/117555
- 检查开发->
ls -al /dev/s*
- 插入 U 盘
- 再次检查->
ls -al /dev/s*
- 创建挂载目录->
mkdir -p /mnt/logError_SwitchRoot
- 安装棒 ->
mount /dev/sd[letter][number] /mnt/logError_SwitchRoot
- 复制文件->
cp /run/initramfs/rdsosreport.txt /mnt/logError_SwitchRoot
- 卸下棒 ->
umount /mnt/logError_SwitchRoot
我现在已rdsosreport.txt
存档https://drive.google.com/file/d/1vMK0QAoyMZ7xTibDqn8Y_Y9nohUStN-6/view?usp=sharing
检查文件:
/dev/nvme0n1p1: LABEL="SYSTEM_DRV" UUID="5464-19F2" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="31ebd6ef-ec98-42c7-a57b-7855c2c9a1f3"
/dev/nvme0n1p5: LABEL="WINRE_DRV" UUID="C2EC6975EC69651F" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="51363955-3d66-4f95-92de-732ccff36936"
/dev/nvme0n1p6: LABEL="boot_efi" UUID="6E91-210B" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="5291c15b-2f5c-42a0-b3e3-2c69f27b801b"
/dev/nvme0n1p7: UUID="7471a525-f8c8-4a77-819e-65b40c04eaaf" TYPE="ext4" PARTUUID="13b3a31b-193f-4ef5-9076-a083cdc857de"
/dev/nvme0n1p8: UUID="d1ee8d12-37a1-43e7-9f13-0f97544864aa" TYPE="ext4" PARTUUID="88cd29e2-3b20-44e4-bdf4-0ce02d9008d6"
/dev/nvme0n1p9: UUID="54f24598-4a21-4875-bacd-61c060de891f" TYPE="ext4" PARTUUID="d1126852-240f-4e03-a8f3-86f769b3fd77"
/dev/nvme0n1p10: UUID="3fc5f4f8-566b-48e2-85e1-59f5dccdcb57" TYPE="ext4" PARTUUID="b2190e39-3ee8-4a41-a156-6a866ee8ee14"
/dev/nvme0n1p11: UUID="42640b78-ce32-403c-8705-8c12e2d02855" TYPE="swap" PARTUUID="acc07fc2-4876-42c0-9d02-b066c04cfd4f"
/dev/sda1: LABEL="EFI" UUID="67E3-17ED" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="5cd547d2-a0ef-4c51-8a00-9877055342bb"
/dev/nvme0n1: PTUUID="e24c5cda-1faa-490b-b677-7c4792194960" PTTYPE="gpt"
/dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="b692aa4c-0d83-40f0-8707-cd0b49290b00"
/dev/nvme0n1p3: PARTLABEL="Basic data partition" PARTUUID="72f573a8-4b1d-40ab-900c-5b2b608fa964"
/dev/nvme0n1p4: PARTLABEL="Basic data partition" PARTUUID="50badba8-609d-4a24-b957-c8f90b8d7d80"
/dev/sda2: PARTUUID="f704e2d2-a0b9-4fa4-9b19-cef07c8b6668"
和
BOOT_IMAGE=(hd1,gpt7)/vmlinuz-5.8.0-1.el8.elrepo.x86_64
编辑2:
我找到了一些我的安装图片(2020年7月5日15:05,供我参考)!
DATA
/home
nvme0n1p8
SYSTEM
/boot/efi
nvme0n1p6
/var
nvme0n1p10
/
nvme0n1p9
/boot
nvme0n1p7
swap
nvme0n1p11
这是我的信息(重启后)
[root@centos /]# lsblk -o NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,UUID,MOUNTPOINT
NAME MAJ:MIN RM SIZE RO FSTYPE UUID MOUNTPOINT
loop0 7:0 0 29.8M 1 squashfs /var/lib/snapd/snap/snapd/8140
loop1 7:1 0 55M 1 squashfs /var/lib/snapd/snap/core18/1754
loop2 7:2 0 29.9M 1 squashfs /var/lib/snapd/snap/snapd/8542
loop3 7:3 0 55M 1 squashfs /var/lib/snapd/snap/core18/1880
loop4 7:4 0 97M 1 squashfs /var/lib/snapd/snap/core/9665
loop5 7:5 0 62.1M 1 squashfs /var/lib/snapd/snap/gtk-common-themes/1506
nvme0n1 259:0 0 477G 0
├─nvme0n1p1 259:1 0 260M 0 vfat 5464-19F2
├─nvme0n1p2 259:2 0 16M 0
├─nvme0n1p3 259:3 0 115.7G 0
├─nvme0n1p4 259:4 0 104G 0
├─nvme0n1p5 259:5 0 1000M 0 ntfs C2EC6975EC69651F
├─nvme0n1p6 259:6 0 1G 0 vfat 6E91-210B /boot/efi
├─nvme0n1p7 259:7 0 1G 0 ext4 7471a525-f8c8-4a77-819e-65b40c04eaaf /boot
├─nvme0n1p8 259:8 0 174G 0 ext4 d1ee8d12-37a1-43e7-9f13-0f97544864aa /home
├─nvme0n1p9 259:9 0 32G 0 ext4 54f24598-4a21-4875-bacd-61c060de891f /
├─nvme0n1p10 259:10 0 24G 0 ext4 3fc5f4f8-566b-48e2-85e1-59f5dccdcb57 /var
└─nvme0n1p11 259:11 0 24G 0 swap 42640b78-ce32-403c-8705-8c12e2d02855 [SWAP]
[root@centos /]#
我有这个清单...
/tmp/nvme0n1p6/:
total 16
drwxr-xr-x 4 root root 4096 Jan 1 1970 .
drwxr-xr-x 6 root root 120 Jun 11 02:11 ..
drwxr-xr-x 4 root root 4096 Jul 5 2020 EFI
-rwxr-xr-x 1 root root 4096 Jan 1 1980 FSCK0000.REC
drwxr-xr-x 2 root root 4096 Jul 22 2020 System Volume Information
/tmp/nvme0n1p6/EFI:
total 16
drwxr-xr-x 4 root root 4096 Jul 5 2020 .
drwxr-xr-x 4 root root 4096 Jan 1 1970 ..
drwxr-xr-x 2 root root 4096 Jul 5 2020 BOOT
drwxr-xr-x 3 root root 4096 Aug 23 2020 centos
/tmp/nvme0n1p6/EFI/BOOT:
total 1544
drwxr-xr-x 2 root root 4096 Jul 5 2020 .
drwxr-xr-x 4 root root 4096 Jul 5 2020 ..
-rwxr-xr-x 1 root root 1211224 May 7 2020 BOOTX64.EFI
-rwxr-xr-x 1 root root 356800 May 7 2020 fbx64.efi
/tmp/nvme0n1p6/EFI/centos:
total 5360
drwxr-xr-x 3 root root 4096 Aug 23 2020 .
drwxr-xr-x 4 root root 4096 Jul 5 2020 ..
-rwxr-xr-x 1 root root 134 May 7 2020 BOOTX64.CSV
drwxr-xr-x 2 root root 4096 Apr 14 2020 fonts
-rwxr-xr-x 1 root root 5502 Jul 5 2020 grub.cfg
-rwxr-xr-x 1 root root 0 Aug 23 2020 grubenv
-rwxr-xr-x 1 root root 1877384 Apr 14 2020 grubx64.efi
-rwxr-xr-x 1 root root 1160136 May 7 2020 mmx64.efi
-rwxr-xr-x 1 root root 1205152 May 7 2020 shimx64-centos.efi
-rwxr-xr-x 1 root root 1211224 May 7 2020 shimx64.efi
/tmp/nvme0n1p6/EFI/centos/fonts:
total 8
drwxr-xr-x 2 root root 4096 Apr 14 2020 .
drwxr-xr-x 3 root root 4096 Aug 23 2020 ..
/tmp/nvme0n1p6/System Volume Information:
total 8
drwxr-xr-x 2 root root 4096 Jul 22 2020 .
drwxr-xr-x 4 root root 4096 Jan 1 1970 ..
这是另一个列表
/tmp/nvme0n1p7/:
total 360344
dr-xr-xr-x 7 root root 4096 Aug 11 2020 .
drwxr-xr-x 7 root root 140 Jun 11 02:17 ..
-rw-r--r-- 1 root root 166 Dec 4 2019 .vmlinuz-4.18.0-147.el8.x86_64.hmac
-rw-r--r-- 1 root root 172 Jun 10 2020 .vmlinuz-4.18.0-193.6.3.el8_2.x86_64.hmac
drwxrwxrwx 2 nobody 65534 4096 Sep 7 2020 System Volume Information
-rw------- 1 root root 3838259 Dec 4 2019 System.map-4.18.0-147.el8.x86_64
-rw------- 1 root root 3910484 Jun 10 2020 System.map-4.18.0-193.6.3.el8_2.x86_64
-rw------- 1 root root 4654688 Jul 7 2020 System.map-5.7.8-1.el8.elrepo.x86_64
-rw------- 1 root root 4714527 Aug 2 2020 System.map-5.8.0-1.el8.elrepo.x86_64
-rw-r--r-- 1 root root 184613 Dec 4 2019 config-4.18.0-147.el8.x86_64
-rw-r--r-- 1 root root 187643 Jun 10 2020 config-4.18.0-193.6.3.el8_2.x86_64
-rw-r--r-- 1 root root 197087 Jul 7 2020 config-5.7.8-1.el8.elrepo.x86_64
-rw-r--r-- 1 root root 201589 Aug 2 2020 config-5.8.0-1.el8.elrepo.x86_64
drwxr-xr-x 2 root root 4096 Jul 5 2020 efi
drwx------ 2 root root 4096 Apr 14 2020 grub2
-rw------- 1 root root 71713525 Jul 5 2020 initramfs-0-rescue-fb78af0a9247484aad9831a10a928084.img
-rw------- 1 root root 49320247 Jul 6 2020 initramfs-4.18.0-147.el8.x86_64.img
-rw------- 1 root root 18223920 Jul 6 2020 initramfs-4.18.0-147.el8.x86_64kdump.img
-rw------- 1 root root 49864041 Jul 6 2020 initramfs-4.18.0-193.6.3.el8_2.x86_64.img
-rw------- 1 root root 18642820 Jul 6 2020 initramfs-4.18.0-193.6.3.el8_2.x86_64kdump.img
-rw------- 1 root root 50414753 Jul 15 2020 initramfs-5.7.8-1.el8.elrepo.x86_64.img
-rw------- 1 root root 50395127 Aug 11 2020 initramfs-5.8.0-1.el8.elrepo.x86_64.img
drwxr-xr-x 3 root root 4096 Jul 5 2020 loader
drwx------ 2 root root 16384 Jul 5 2020 lost+found
-rwxr-xr-x 1 root root 8106744 Jul 5 2020 vmlinuz-0-rescue-fb78af0a9247484aad9831a10a928084
-rwxr-xr-x 1 root root 8106744 Dec 4 2019 vmlinuz-4.18.0-147.el8.x86_64
-rwxr-xr-x 1 root root 8913656 Jun 10 2020 vmlinuz-4.18.0-193.6.3.el8_2.x86_64
-rwxr-xr-x 1 root root 8558528 Jul 7 2020 vmlinuz-5.7.8-1.el8.elrepo.x86_64
-rwxr-xr-x 1 root root 8742176 Aug 2 2020 vmlinuz-5.8.0-1.el8.elrepo.x86_64
/tmp/nvme0n1p7/System Volume Information:
total 12
drwxrwxrwx 2 nobody 65534 4096 Sep 7 2020 .
dr-xr-xr-x 7 root root 4096 Aug 11 2020 ..
-rw-rw-rw- 1 nobody 65534 76 Sep 7 2020 IndexerVolumeGuid
/tmp/nvme0n1p7/efi:
total 8
drwxr-xr-x 2 root root 4096 Jul 5 2020 .
dr-xr-xr-x 7 root root 4096 Aug 11 2020 ..
/tmp/nvme0n1p7/grub2:
total 8
drwx------ 2 root root 4096 Apr 14 2020 .
dr-xr-xr-x 7 root root 4096 Aug 11 2020 ..
lrwxrwxrwx 1 root root 25 Apr 14 2020 grubenv -> ../efi/EFI/centos/grubenv
/tmp/nvme0n1p7/loader:
total 12
drwxr-xr-x 3 root root 4096 Jul 5 2020 .
dr-xr-xr-x 7 root root 4096 Aug 11 2020 ..
drwx------ 2 root root 4096 Aug 11 2020 entries
/tmp/nvme0n1p7/loader/entries:
total 28
drwx------ 2 root root 4096 Aug 11 2020 .
drwxr-xr-x 3 root root 4096 Jul 5 2020 ..
-rw-r--r-- 1 root root 395 Jul 5 2020 fb78af0a9247484aad9831a10a928084-0-rescue.conf
-rw-r--r-- 1 root root 323 Jul 5 2020 fb78af0a9247484aad9831a10a928084-4.18.0-147.el8.x86_64.conf
-rw-r--r-- 1 root root 353 Jul 6 2020 fb78af0a9247484aad9831a10a928084-4.18.0-193.6.3.el8_2.x86_64.conf
-rw-r--r-- 1 root root 356 Jul 15 2020 fb78af0a9247484aad9831a10a928084-5.7.8-1.el8.elrepo.x86_64.conf
-rw-r--r-- 1 root root 356 Aug 11 2020 fb78af0a9247484aad9831a10a928084-5.8.0-1.el8.elrepo.x86_64.conf
/tmp/nvme0n1p7/lost+found:
total 20
drwx------ 2 root root 16384 Jul 5 2020 .
dr-xr-xr-x 7 root root 4096 Aug 11 2020 ..
我怎么知道/sysroot是什么?
我还没有/boot/efi
挂载,/boot目录也没有!
如何挂载/boot/efi?
grub 命令不起作用!
编辑3:
为了解决这个问题
# grub2-editenv list
grub2-editenv: error: invalid environment block.
# grub2-editenv set
grub2-editenv: error: invalid environment block.
#
我跟随https://access.redhat.com/solutions/5622731
# mv /boot/grub2/grubenv /boot/grub2/grubenv.bak
# grub2-set-default 1
# grub2-editenv list
saved_entry=1
# grub2-editenv set
#
编辑4:
https://www.golinuxcloud.com/update-grub2-grubby-grub2-editenv-rhel-8/ 检查https://www.techbrown.com/change-default-grub-entries-timeout-centos-rhel/ 对我有用
# grub2-editenv - set "kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro"
重启后
[root@centos /]# grub2-editenv list
saved_entry=1
boot_success=1
kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet
[root@centos /]#
编辑5:
[root@centos /]# grub2-editenv list
saved_entry=fb78af0a9247484aad9831a10a928084-4.18.0-193.14.2.el8_2.x86_64
boot_success=1
kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet
boot_indeterminate=1
[root@centos /]#
对我来说这行很奇怪:
saved_entry=fb78af0a9247484aad9831a10a928084-4.18.0-193.14.2.el8_2.x86_64
编辑6:
[root@centos /]# ls -al /boot/efi/EFI/centos/
total 5820
drwx------. 3 root root 4096 Jun 11 13:50 .
drwx------. 4 root root 4096 Nov 16 2020 ..
-rwx------. 1 root root 134 Jul 31 2020 BOOTX64.CSV
drwx------. 2 root root 4096 Mar 2 16:03 fonts
-rwx------. 1 root root 5502 Jul 5 2020 grub.cfg
-rwx------. 1 root root 0 Aug 23 2020 grubenv.bak
-rwx------. 1 root root 2285336 Mar 2 16:03 grubx64.efi
-rwx------. 1 root root 1162400 Jul 31 2020 mmx64.efi
-rwx------. 1 root root 1238416 Jul 31 2020 shimx64-centos.efi
-rwx------. 1 root root 1244496 Jul 31 2020 shimx64.efi
[root@centos /]# ls -al /boot/grub2/
total 20
drwx------. 2 root root 4096 Jun 12 22:20 .
dr-xr-xr-x. 7 root root 4096 Jun 11 13:58 ..
-rw-r--r--. 1 root root 5503 Jun 11 05:01 grub.cfg
-rw-------. 1 root root 1024 Jun 12 22:20 grubenv
lrwxrwxrwx. 1 root root 25 Apr 14 2020 grubenv.bak -> ../efi/EFI/centos/grubenv
[root@centos /]# cat /boot/grub2/grubenv
# GRUB Environment Block
saved_entry=fb78af0a9247484aad9831a10a928084-4.18.0-305.3.1.el8.x86_64
boot_success=1
kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet
boot_indeterminate=1
#################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################[root@centos /]#
显然有什么不对劲!!!该/efi/EFI/centos/grubenv
文件不存在并且/boot/grub2/grubenv
似乎格式错误。
根据这个链接https://bugzilla.redhat.com/show_bug.cgi?id=1435435
物理文件必须位于/efi/EFI/centos/grubenv
并且符号链接/boot/grub2/grubenv
应指向/efi/EFI/centos/grubenv
。
如何创建/efi/EFI/centos/grubenv
文件而不直接编辑它?
和
[root@centos /]# awk -F\' '/^menuentry/ {print $2}' /boot/grub2/grub.cfg
Windows Boot Manager (on /dev/nvme0n1p1)
System setup
[root@centos /]#
[root@centos /]# awk -F\' '/^menuentry/ {print $2}' /boot/efi/EFI/centos/grub.cfg
Windows Boot Manager (on /dev/nvme0n1p1)
System setup
[root@centos /]#
[root@centos /]# grub2-mkconfig -o /boot/grub2/grub.cfg.bck
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
[root@centos /]#
[root@centos /]# awk -F\' '/^menuentry/ {print $2}' /boot/grub2/grub.cfg.bck
Windows Boot Manager (on /dev/nvme0n1p1)
System setup
[root@centos /]#
我复制来测试:
# cp /boot/grub2/grubenv /boot/efi/EFI/centos/
条目没有出现?
我遵循这个关联
# ls -al /boot/loader/entries
total 36
drwx------. 2 root root 4096 Jun 11 13:57 .
drwxr-xr-x. 3 root root 4096 Jul 5 2020 ..
-rw-r--r--. 1 root root 395 Jul 5 2020 fb78af0a9247484aad9831a10a928084-0-rescue.conf
-rw-r--r--. 1 root root 358 Jun 11 11:36 fb78af0a9247484aad9831a10a928084-4.18.0-193.14.2.el8_2.x86_64.conf
-rw-r--r--. 1 root root 353 Jul 5 2020 fb78af0a9247484aad9831a10a928084-4.18.0-193.6.3.el8_2.x86_64.conf
-rw-r--r--. 1 root root 336 Jun 11 13:57 fb78af0a9247484aad9831a10a928084-4.18.0-305.3.1.el8.x86_64.conf
-rw-r--r--. 1 root root 366 Jun 11 12:05 fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64.conf
-rw-r--r--. 1 root root 356 Jul 15 2020 fb78af0a9247484aad9831a10a928084-5.7.8-1.el8.elrepo.x86_64.conf
-rw-r--r--. 1 root root 356 Aug 11 2020 fb78af0a9247484aad9831a10a928084-5.8.0-1.el8.elrepo.x86_64.conf
[root@centos /]#
并遵循这个答案https://stackoverflow.com/a/64637392
我列出所有# grubby --info=ALL
我查看具体的# grubby --info 0
检查我的默认值是什么
[root@centos /]# grubby --info DEFAULT
index=3
kernel="/boot/vmlinuz-4.18.0-305.3.1.el8.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-4.18.0-305.3.1.el8.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-305.3.1.el8.x86_64) 8"
id="fb78af0a9247484aad9831a10a928084-4.18.0-305.3.1.el8.x86_64"
[root@centos /]#
我试图用 #grubby --args amd_iommu=on --update-kernel=/boot/vmlinuz-$(uname -r)
和 with更改默认值grubby --args amd_iommu=on --update-kernel 2
但它不起作用(使用# grubby --info DEFAULT
)!
正在审核 0 条条目
[root@centos /]# grubby --info 0
index=0
kernel="/boot/vmlinuz-5.12.10-1.el8.elrepo.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params amd_iommu=on"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-5.12.10-1.el8.elrepo.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa)"
id="fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64"
[root@centos /]#
和以下https://unix.stackexchange.com/a/394889/400726
按标题选择:
[root@centos /]# grub2-editenv - set saved_entry='Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa)'
[root@centos /]#
显然它改变了。
[root@centos /]# grubby --info DEFAULT
index=0
kernel="/boot/vmlinuz-5.12.10-1.el8.elrepo.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params amd_iommu=on"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-5.12.10-1.el8.elrepo.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa)"
id="fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64"
[root@centos /]#
重启了,还是不行!
审阅
[root@centos /]# cmp /boot/efi/EFI/centos/grubenv /boot/grub2/grubenv
/boot/efi/EFI/centos/grubenv /boot/grub2/grubenv differ: byte 38, line 2
[root@centos /]#
文件已经改变了,不一样了!
[root@centos /]# cat /boot/efi/EFI/centos/grubenv
# GRUB Environment Block
saved_entry=fb78af0a9247484aad9831a10a928084-4.18.0-305.3.1.el8.x86_64
boot_success=0
kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet
boot_indeterminate=0
##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################[root@centos /]#
[root@centos /]# cat /boot/grub2/grubenv
# GRUB Environment Block
saved_entry=Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa)
boot_success=1
kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet
boot_indeterminate=1
##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################[root@centos /]#
我正在尝试
[root@centos /]# rm /boot/grub2/grubenv.bak
rm: remove symbolic link '/boot/grub2/grubenv.bak'? y
[root@centos /]#
[root@centos /]# rm /boot/efi/EFI/centos/grubenv.bak
rm: remove regular empty file '/boot/efi/EFI/centos/grubenv.bak'? y
[root@centos /]#
[root@centos /]# ln -s /boot/grub2/grubenv /boot/efi/EFI/centos/grubenv
ln: failed to create symbolic link '/boot/efi/EFI/centos/grubenv': Operation not permitted
[root@centos /]#
我更喜欢一个符号链接(但是,我了解这种情况https://www.linuxquestions.org/questions/suse-opensuse-60/boot-is-not-allowing-symbolic-link-creation-4175682262/#post6166967)!
[root@centos /]# cp /boot/grub2/grubenv /boot/efi/EFI/centos/
[root@centos /]#
有什么解决办法吗?
[root@centos /]# ls -al /boot/grub2/
total 28
drwx------. 2 root root 4096 Jun 12 23:07 .
dr-xr-xr-x. 7 root root 4096 Jun 11 13:58 ..
-rw-r--r--. 1 root root 5503 Jun 11 05:01 grub.cfg
-rw-r--r--. 1 root root 6956 Jun 12 22:59 grub.cfg.bck
-rw-------. 1 root root 1024 Jun 12 22:59 grubenv
[root@centos /]#
[root@centos /]# ls -al /boot/efi/EFI/centos/
total 5824
drwx------. 3 root root 4096 Jun 12 23:09 .
drwx------. 4 root root 4096 Nov 16 2020 ..
-rwx------. 1 root root 134 Jul 31 2020 BOOTX64.CSV
drwx------. 2 root root 4096 Mar 2 16:03 fonts
-rwx------. 1 root root 5502 Jul 5 2020 grub.cfg
-rwx------. 1 root root 1024 Jun 12 23:06 grubenv
-rwx------. 1 root root 2285336 Mar 2 16:03 grubx64.efi
-rwx------. 1 root root 1162400 Jul 31 2020 mmx64.efi
-rwx------. 1 root root 1238416 Jul 31 2020 shimx64-centos.efi
-rwx------. 1 root root 1244496 Jul 31 2020 shimx64.efi
[root@centos /]#
编辑7
记住最初的符号链接问题,我需要修复。
这里我们有默认条目...作为复制的结果。
[root@centos /]# grubby --info DEFAULT
index=0
kernel="/boot/vmlinuz-5.12.10-1.el8.elrepo.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params amd_iommu=on"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-5.12.10-1.el8.elrepo.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa)"
id="fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64"
[root@centos /]#
我需要测试更改,但首先我需要检查所有条目。
[root@centos /]# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-5.12.10-1.el8.elrepo.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params amd_iommu=on"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-5.12.10-1.el8.elrepo.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa)"
id="fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64"
index=1
kernel="/boot/vmlinuz-5.8.0-1.el8.elrepo.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-5.8.0-1.el8.elrepo.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.8.0-1.el8.elrepo.x86_64) 8.2 (Ootpa)"
id="fb78af0a9247484aad9831a10a928084-5.8.0-1.el8.elrepo.x86_64"
index=2
kernel="/boot/vmlinuz-5.7.8-1.el8.elrepo.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-5.7.8-1.el8.elrepo.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.7.8-1.el8.elrepo.x86_64) 8.2 (Ootpa)"
id="fb78af0a9247484aad9831a10a928084-5.7.8-1.el8.elrepo.x86_64"
index=3
kernel="/boot/vmlinuz-4.18.0-305.3.1.el8.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-4.18.0-305.3.1.el8.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-305.3.1.el8.x86_64) 8"
id="fb78af0a9247484aad9831a10a928084-4.18.0-305.3.1.el8.x86_64"
index=4
kernel="/boot/vmlinuz-4.18.0-193.14.2.el8_2.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-4.18.0-193.14.2.el8_2.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-193.14.2.el8_2.x86_64) 8 (Core)"
id="fb78af0a9247484aad9831a10a928084-4.18.0-193.14.2.el8_2.x86_64"
index=5
kernel="/boot/vmlinuz-4.18.0-193.6.3.el8_2.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-4.18.0-193.6.3.el8_2.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-193.6.3.el8_2.x86_64) 8 (Core)"
id="fb78af0a9247484aad9831a10a928084-4.18.0-193.6.3.el8_2.x86_64"
index=6
kernel="/boot/vmlinuz-0-rescue-fb78af0a9247484aad9831a10a928084"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-0-rescue-fb78af0a9247484aad9831a10a928084.img"
title="CentOS Linux (0-rescue-fb78af0a9247484aad9831a10a928084) 8 (Core)"
id="fb78af0a9247484aad9831a10a928084-0-rescue"
[root@centos /]#
现在,我尝试更改条目。
[root@centos /]# grubby --args amd_iommu=on --update-kernel 3
[root@centos /]# grubby --info DEFAULT
index=0
kernel="/boot/vmlinuz-5.12.10-1.el8.elrepo.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params amd_iommu=on"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-5.12.10-1.el8.elrepo.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa)"
id="fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64"
[root@centos /]#
(以前的方法不起作用),现在使用替代方式。
[root@centos /]# grub2-editenv - set saved_entry='CentOS Linux (4.18.0-305.3.1.el8.x86_64) 8'
[root@centos /]# grubby --info DEFAULT
index=3
kernel="/boot/vmlinuz-4.18.0-305.3.1.el8.x86_64"
args="ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params amd_iommu=on"
root="UUID=54f24598-4a21-4875-bacd-61c060de891f"
initrd="/boot/initramfs-4.18.0-305.3.1.el8.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-305.3.1.el8.x86_64) 8"
id="fb78af0a9247484aad9831a10a928084-4.18.0-305.3.1.el8.x86_64"
[root@centos /]#
解决了:
Finally, after restart the changes works!!!
答案1
总结:
- 你是进入紧急模式启动时
- 报告的错误是:
Failed to switch root: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.
- 表示
rdsosreport.txt
实际上没有安装任何东西/sysroot
,并且/proc/cmdline
只有一个内核引导选项:BOOT_IMAGE=(hd1,gpt7)/vmlinuz-5.8.0-1.el8.elrepo.x86_64
。
从rdsosreport.txt
信息来看,看起来应该至少列出root=UUID=54f24598-4a21-4875-bacd-61c060de891f
或root=/dev/nvme0n1p9
类似的内容,以识别实际的根文件系统。但root=
根本没有选择。这表明引导加载程序问题相对简单,除非还有其他问题。
RHEL/CentOS 8 将此信息存储在一个grubenv
文件中,在像您这样的 UEFI 系统中,/boot/efi/EFI/centos/grubenv
当所有文件系统都已安装到其正常位置时,该文件将位于该文件中。该文件应包含如下行:
kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro
您不应grubenv
直接编辑该文件,而应使用命令grub2-editenv
:grub2-editenv list
查看设置并grub2-editenv set "kernelopts=root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro"
进行设置。
但要达到可以使用的程度grub2-editenv
,您首先需要启动并运行操作系统。
当 GRUB 菜单出现时,使用箭头键移动到与您要使用的内核相对应的行(可能是第一行或第三行)。然后按E而不是按Enter。将显示启动项以供编辑。找到以 开头的行linux /vmlinuz-...
,将光标移动到该行的末尾,然后键入空格和root=/dev/nvme0n1p9
。 (您也可以使用 UUID 形式,但这更难正确输入。)
然后查看屏幕底部,找到将启动修改后的条目的按键(如果我没记错的话,Control+ )。X
如果这有效,您的系统应该正常启动到 CentOS - 仅这一次。要永久解决该问题,您需要grubenv
按照上面所述修复该文件。
答案2
我在启动 Rocky 8.6 映像时遇到完全相同的问题:
在命令行上我执行以下过程:
- 只需重新挂载 sysroot 即可:
mount -o remount,rw /sysroot
- 更改初始化文件
vi /sysroot/etc/init.sh
i
#!/bin/bash
exec /sbin/init
- 更改执行标志:
/sysroot//usr/bin/chmod ugo+x /sysroot/etc/init.sh
- 重新安装ro
mount -o remount,ro /sysroot
- 继续启动:
exit
解决了我当前安装的问题。但我想知道为什么我会收到这个错误,这似乎是一个错误?