双系统没有windows启动项

以下是我的操作步骤:

  • mount /dev/nvme0n1p4 /mnt
  • mount --mkdir /dev/nvme0n1p1 /mnt/boot
  • mount --mkdir /dev/nvme1n1p1 /mnt/boot/windows-efi
  • arch-chroot /mnt
  • grub-mkconfig -o /boot/grub/grub.cfg

grub-mkconfig -o /boot/grub/grub.cfg的输出:

Generating grub configuration file ...
Found linux image: /boot/vnlinuz-linux
Found lnitrd image: /boot/initramfs-linux.img
Fount fallback initrd image(s) in /boot: initramfs-linux-fallback.img
Warning:os-prober will be executed to detect other bootable partitions
Adding boot menu entry for UEFI Firmware Settinge ...
done

不知道哪里出错了, 我之前也是类似的步骤, 一次成功, 不知道这次为什么出这样的问题
windows的引导分区应该没问题, 至少能进入windows
另外, 这是GRUB wiki提到的, 要探测其他操作系统, 需要以下步骤:

  • 安装软件os-prober并挂载包含其它系统引导程序的磁盘分区
  • 编辑/etc/default/grub并取消GRUB_DISABLE_OS_PROBER=false这一行的注释

也许是要装 ntfs-3g?不过我都是用 boot menu 或者 efibootmgr 进入 Windows 的。

恩…我也是用类似的方式切换系统的…只是感觉太麻烦了…而且以前又成功加入过windows启动项
没事, 这个问题不大, 大不了继续用上面的方式切换系统

至于ntfs-3g…我不会用, wiki的信息…也没看懂…
而且我之前也没装ntfs-3g, 同样能添加windows启动项

另外, 需要其他信息请说明

grub的wiki上说还要先用root运行os-prober一次再grub-mkconfig

这 wiki 写得不太对。应该是安装 os-prober,然后编辑 /etc/default/grub 取消禁用 os-prober,再重新 grub-mkconfig。不过我不推荐这种方案啦,有时候发现不了 Windows。

我也是第一次没出现windows的选项,是又进了一遍windows,然后到arch重新加载grub才出现的

虽然时间过去这么久,我还是回一下 , os-prober 在arch-choot 模式下不起作用,这点在wiki中有说明

新系统安装grub引导正确步骤是安装:

arch-choot /mnt
pacman -S grub os-prober efibootmgr
grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
passwd root
exit
umount -R /mnt
reboot
以root登录后
os-prober
nano /etc/default/grub
取消 GRUB_DISABLE_OS_PROBER=false 前面的 # 按crtl+s保存,crtl+x退出

grub-mkconfig -o /boot/grub/grub.cfg

这样os-prober才能探测到你计算机上的其他系统

当然你也可以把手动编写 grub.cfg
nano /boot/grub/grub.cfg

以下为我的机器上的windows启动项:

BEGIN /etc/grub.d/30_os-prober

menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $men>
insmod part_gpt
insmod fat
set root='hd0,gpt1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-e>
else
search --no-floppy --fs-uuid --set=root 4FB6-D430 //4FB6-D430 这个UUID你需要更换为你自己的 ESP分区的UUID (ls -al /dev/disk/by-uuid/)
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

END /etc/grub.d/30_os-prober

以下为wiki上grub探测其它系统的部分内容
注意:
分区挂载点并不重要,os-prober读取mtab信息来确认并搜索引导程序的位置。
记得每次运行 grub-mkconfig 之前都把包含其他操作系统引导程序的分区挂载上,以免这些操作系统的启动项丢失。
os-prober在chroot中可能无法正常运作。如果遇到这种情况,重启并引导进入系统后再次尝试。