每当我升级 Fedora 并且它包含新内核时,随后的重新启动总是出现内核恐慌,说它找不到根设备。发生的情况是,更新版本/boot/grub2/grub.cfg
使用设备名称而不是 UUID(设备名称是正确的):
menuentry 'Fedora Linux (6.2.10-300.fc38.x86_64) 38 (Thirty Eight)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-6.2.10-300.fc38.x86_64-advanced-9aec70be-1bb8-47e9-9be4-be979d9f7ec1' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod btrfs
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 9aec70be-1bb8-47e9-9be4-be979d9f7ec1
else
search --no-floppy --fs-uuid --set=root 9aec70be-1bb8-47e9-9be4-be979d9f7ec1
fi
echo 'Loading Linux 6.2.10-300.fc38.x86_64 ...'
linux /boot/vmlinuz-6.2.10-300.fc38.x86_64 root=/dev/sda3 ro
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-6.2.10-300.fc38.x86_64.img
}
将其重置为 UUID 后,系统将按预期启动:
menuentry 'Fedora Linux (6.2.10-300.fc38.x86_64) 38 (Thirty Eight)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-6.2.10-300.fc38.x86_64-advanced-9aec70be-1bb8-47e9-9be4-be979d9f7ec1' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod btrfs
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 9aec70be-1bb8-47e9-9be4-be979d9f7ec1
else
search --no-floppy --fs-uuid --set=root 9aec70be-1bb8-47e9-9be4-be979d9f7ec1
fi
echo 'Loading Linux 6.2.10-300.fc38.x86_64 ...'
linux /boot/vmlinuz-6.2.10-300.fc38.x86_64 root=UUID=9aec70be-1bb8-47e9-9be4-be979d9f7ec1 ro
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-6.2.10-300.fc38.x86_64.img
}
现在,如果我在重新启动之前手动运行sudo grub2-mkconfig -o /boot/grub2/grub.cfg
,它还会使用 UUID 创建启动条目。这可能和我的/etc/default/grub
设置有关吗?
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_CMDLINE_LINUX=""
#GRUB_TERMINAL_OUTPUT="console"
GRUB_GFXMODE=1920x1080x32
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_DISABLE_RECOVERY=true
GRUB_DISABLE_SUBMENU=y
GRUB_DISABLE_OS_PROBER=true
GRUB_ENABLE_BLSCFG=false
GRUB_THEME="/boot/grub2/themes/darkmatter/theme.txt"
Fedora 在升级过程中如何更新 grub?