更新:经过多次尝试,结果发现,/etc/fstab
加载/boot
到正确分区的行已被注释掉。取消注释后,我可以使用 正常加载新内核apt
,并且计算机现在可以正常启动。
我的 Ubuntu 机器 (20.04) 正在启动一个更旧的内核版本,并忽略了几个较新的内核。GRUB 菜单仅显示正在加载的内核条目之前的内核条目,因此我没有切换的选项。欢迎提出任何建议。
正在加载的内核是5.4.0-80-generic
。
当我运行时,sudo grub-mkconfig | grep menuentry | grep generic
它显示了几个较新的内核:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-92-generic
Found initrd image: /boot/initrd.img-5.4.0-92-generic
Found linux image: /boot/vmlinuz-5.4.0-91-generic
Found initrd image: /boot/initrd.img-5.4.0-91-generic
Found linux image: /boot/vmlinuz-5.4.0-90-generic
Found initrd image: /boot/initrd.img-5.4.0-90-generic
Found linux image: /boot/vmlinuz-5.4.0-89-generic
Found initrd image: /boot/initrd.img-5.4.0-89-generic
Found linux image: /boot/vmlinuz-5.4.0-88-generic
Found initrd image: /boot/initrd.img-5.4.0-88-generic
Found linux image: /boot/vmlinuz-5.4.0-81-generic
Found initrd image: /boot/initrd.img-5.4.0-81-generic
Adding boot menu entry for UEFI Firmware Settings
done
menuentry 'Ubuntu, with Linux 5.4.0-92-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-92-generic-advanced-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-92-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-92-generic-recovery-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-91-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-91-generic-advanced-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-91-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-91-generic-recovery-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-90-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-90-generic-advanced-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-90-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-90-generic-recovery-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-89-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-89-generic-advanced-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-89-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-89-generic-recovery-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-88-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-88-generic-advanced-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-88-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-88-generic-recovery-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-81-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-81-generic-advanced-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
menuentry 'Ubuntu, with Linux 5.4.0-81-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-81-generic-recovery-fe6a612c-184d-443a-a4b3-3254e11ff7eb' {
更新etc/default/grub
然后GRUB_DEFAULT="gnulinux-5.4.0-92-generic-advanced-fe6a612c-184d-443a-a4b3-3254e11ff7eb"
运行sudo update-grub
不会产生任何效果——它仍然启动到旧内核并且只显示旧内核选项。
好像我的 GRUB 选项被冻结了。几个月前,我遇到了一个问题,一些软件更新导致计算机无法启动。我不得不通过 USB 启动,然后远程登录以更新内核(到当前加载的版本)。我可能在执行此操作时犯了一个错误,但我不知道是什么。