Grub 命令运行两次

Grub 命令运行两次

我正在尝试更改 grub 中的启动优先级和超时。当我运行“update-grub”命令时,即使只执行一次,我也会看到两次相同的输出。

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-46-generic
Found initrd image: /boot/initrd.img-5.11.0-46-generic
Found linux image: /boot/vmlinuz-5.11.0-44-generic
Found initrd image: /boot/initrd.img-5.11.0-44-generic
Found linux image: /boot/vmlinuz-5.11.0-43-generic
Found initrd image: /boot/initrd.img-5.11.0-43-generic
Found linux image: /boot/vmlinuz-5.11.0-41-generic
Found initrd image: /boot/initrd.img-5.11.0-41-generic
Found Windows Boot Manager on /dev/sda5@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings
done
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-46-generic
Found initrd image: /boot/initrd.img-5.11.0-46-generic
Found linux image: /boot/vmlinuz-5.11.0-44-generic
Found initrd image: /boot/initrd.img-5.11.0-44-generic
Found linux image: /boot/vmlinuz-5.11.0-43-generic
Found initrd image: /boot/initrd.img-5.11.0-43-generic
Found linux image: /boot/vmlinuz-5.11.0-41-generic
Found initrd image: /boot/initrd.img-5.11.0-41-generic
Found Windows Boot Manager on /dev/sda5@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings
done

需要一些帮助来解决这个问题。

另外我的超时是 10 秒。但它等待了 30 秒。我看到了一些与此相关的答案,我需要研究一下。不确定这些是否相关。

谢谢

答案1

之所以运行两次,是因为您的系统上安装了两次 GRUB,并且update-grub每次都运行一次。

具体来说,一个安装在下方/boot/grub(这意味着如果没有单独的启动分区,则安装在根系统分区中;如果有启动分区,则安装在启动分区中),另一个安装在下方/boot/efi/EFI/ubuntu/grub(这意味着安装在 ESP/EFI 分区中)。这也是它们更新的顺序,/boot/grub是第一个。

您可以通过运行来显示执行该命令时运行的脚本cat `which update-grub`的内容来发现这一点(最有可能)。update-grub/usr/sbin/update-grub

ubuntu在这种情况下,因为您使用的是 elementaryOS,它基于 Ubuntu 并继承了相同的启动过程和 GRUB shims。

我尚不清楚在什么情况下grub会创建第二个文件夹,但这不是一个需要修复的问题,它似乎是预期的行为。

相关内容