![os-prober 和 update-grub 找到 windows 安装,但它没有显示在启动菜单中](https://linux22.com/image/942314/os-prober%20%E5%92%8C%20update-grub%20%E6%89%BE%E5%88%B0%20windows%20%E5%AE%89%E8%A3%85%EF%BC%8C%E4%BD%86%E5%AE%83%E6%B2%A1%E6%9C%89%E6%98%BE%E7%A4%BA%E5%9C%A8%E5%90%AF%E5%8A%A8%E8%8F%9C%E5%8D%95%E4%B8%AD.png)
我的系统运行的是 Ubuntu 21.04。我最近使用 Clonezilla 将系统从旧 SSD 移至新的 M.2 驱动器。在此过程中,我需要运行 update-grub。系统启动正常,但我无法选择启动另一个驱动器上的 Windows 10 安装,启动时它不在 grub 菜单中。
os-prober and update-grub both seem to find it no problem:
root@zap:/# os-prober
/dev/sdb1@/efi/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
root@zap:/#
root@zap:/#
root@zap:/# 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-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-4.13.0-37-generic
Found initrd image: /boot/initrd.img-4.13.0-37-generic
Found linux image: /boot/vmlinuz-4.13.0-36-generic
Found initrd image: /boot/initrd.img-4.13.0-36-generic
Found Windows Boot Manager on /dev/sdb1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings
done
root@zap:/#
我忘记了什么?
答案1
总结:
sudo echo GRUB_DISABLE_OS_PROBER=false >> /etc/default/grub && sudo update-grub
细节:
OS Prober 在最新版本中不再默认运行grub
:
警告:不会执行 os-prober 来检测其他可启动分区。这些分区上的系统将不会添加到 GRUB 启动配置中。检查 GRUB_DISABLE_OS_PROBER 文档条目
此类问题从2021年5月开始出现。
因此我遵循了以下建议:
% sudo echo GRUB_DISABLE_OS_PROBER=false >> /etc/default/grub && sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Sourcing file `/etc/default/grub.d/lubuntu-grub-theme.cfg'
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/lubuntu-grub-theme/theme.txt
Found linux image: /boot/vmlinuz-5.13.0-19-generic
Found initrd image: /boot/initrd.img-5.13.0-19-generic
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 20.04 LTS (20.04) on /dev/nvme0n1p6
Adding boot menu entry for UEFI Firmware Settings
done
$ tail -1 /etc/default/grub
GRUB_DISABLE_OS_PROBER=false
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.10
Release: 21.10
Codename: impish
$ os-prober
/dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
/dev/nvme0n1p6:Ubuntu 20.04 LTS (20.04):Ubuntu:linux
grep menuentry /boot/grub/grub.cfg
现在我可以在我的文件中看到我的 Ubuntu 20.04 LTS 启动项/boot/grub/grub.cfg
,以及 Windows 启动项:
$ grep 'menuentry.*Windows' /boot/grub/grub.cfg
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-C633-8883' {
高血压