debian升级后Grub菜单中找不到Windows项(转)

debian升级后Grub菜单中找不到Windows项(转)
原文地址:https://forums.debiancn.org/t/topic/3598

机器安装的是Debian bullseye和Windows双系统。近日由bullseye升至bookworm,再启动后发现grub菜单上原来有的Windows项没有了。
解决方法

安装 os-prober
查看/etc/default/grub:取消原有注释行: GRUB_DISABLE_OS_PROBER=false
重启后发现Windows项又被扫描到了。
如果不必每次都更新grub时扫描各分区中的系统,可再注释掉该行即可。

上述方法在笔记本上成功实现了,但转到台式机上应用没有成功。采用了手动修改40_custom的方式。

运行 sudo os-prober 得到:

/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi

检测到Windows在/dev/sda1分区上。

运行sudo blkid /dev/sda1得到:

/dev/sda1: UUID="04E0-B3F3" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="eb8cea0d-4005-4148-9ca9-841f15302ab1"

检测到UUID="04E0-B3F3"。

运行sudo vi /etc/grub.d/40_custom,填上内容:

    menuentry "Windows 10" --class windows --class os {
    insmod ntfs
    search --no-floppy --set=root --fs-uuid 04E0-B3F3
    ntldr /bootmgr
    }

注意,替换--fs-uuid后面值为刚才检测到的UUID值。

运行sudo update-grub
重启即可看到grub菜单上有了Windows 10入口项,测试可进入Win10系统。

个人实践
先使用取消原有注释行: GRUB_DISABLE_OS_PROBER=false的方法,无效;再使用上面编辑 40_custom 文件的方法,在执行 sudo update-grub 命令后,引导菜单中会出现两项 windows 引导,其中有一个应该是开启os-prober后自动扫描得到的,另一项是在 40_custom文件中加入的,不过我上面的菜单脚本在我的机器上无法引导到 windows,提示“无法找到 ntldr...”。
最终结论是:

  1. 编辑 /etc/default/grub,取消原有注释行: GRUB_DISABLE_OS_PROBER=false
  2. 运行sudo update-grub

参考
GRUB does not detect Windows 5
os-prober and update-grub find windows install, yet it does not show in boot menu 2
DualBoot/Windows10 - Debian Wiki 1

posted @ 2023-11-02 08:56  汉学  阅读(1025)  评论(0)    收藏  举报