Remove erroneous duplicate Windows boot entry from grub menu on dual-boot system

Hi,

I have a dual-boot fedora 39/windows system.

After updating to fedora 39 an incorrect (duplicate) menuentry appeared in the grub boot menu:

$ sudo os-prober --verbose
/dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows1:efi

/dev/nvme0n1p1 is my fedora system partition.
/dev/sda1 is on a separate drive where the windows system is installed.

The entry for /dev/sda1 is the correct one, whilst the one for /dev/nvme0n1p1 causes an error. I imagine this was somehow left over from a previous install.

I would like to remove the erroneous entry from the boot menu to stop anyone from accidentally choosing it.

I have searched extensively and read what I could to try and figure out what to do but the GRUB2 docs at https://docs.fedoraproject.org/en-US/quick-docs/grub2-bootloader/ were last reviewed in 2012 and I don’t know if the information in them is still valid. I am concerned about doing anything which would potentially stop the windows system from booting at all.

I can see that the boot files are duplicated:

Incorrect entry:

$ sudo ls -lahF /boot/efi/EFI/Microsoft/Boot
total 5.8M
drwx------. 40 root root 8.0K Mar 12  2023 ./
drwx------.  4 root root 4.0K Mar 12  2023 ../
-rwx------.  1 root root  40K Jul 21 15:49 BCD*
-rwx------.  1 root root  64K Mar 12  2023 BCD.LOG*
-rwx------.  1 root root    0 Mar 12  2023 BCD.LOG1*
-rwx------.  1 root root    0 Mar 12  2023 BCD.LOG2*
drwx------.  2 root root 4.0K Mar 12  2023 bg-BG/
-rwx------.  1 root root 1.5M Oct  6  2021 bootmgfw.efi*
-rwx------.  1 root root 1.5M Oct  6  2021 bootmgr.efi*
-rwx------.  1 root root  64K Mar 12  2023 BOOTSTAT.DAT*
-rwx------.  1 root root 5.1K Oct  6  2021 boot.stl*
<snip>

And with /dev/sda1 mounted as /windows/bootefi:

Correct entry:

$ sudo ls -lahF /windows/bootefi/EFI/Microsoft/Boot/
total 6.0M
drwxr-xr-x. 40 root root 5.0K Mar 12  2023 ./
drwxr-xr-x.  4 root root 1.0K Mar 12  2023 ../
-rwxr-xr-x.  1 root root  44K Jul 22 22:24 BCD*
-rwxr-xr-x.  1 root root  64K Mar 12  2023 BCD.LOG*
-rwxr-xr-x.  1 root root    0 Mar 12  2023 BCD.LOG1*
-rwxr-xr-x.  1 root root    0 Mar 12  2023 BCD.LOG2*
drwxr-xr-x.  2 root root 1.0K Mar 12  2023 bg-BG/
-rwxr-xr-x.  1 root root 1.6M Jul  9 20:17 bootmgfw.efi*
-rwxr-xr-x.  1 root root 1.6M Jul  9 20:17 bootmgr.efi*
-rwxr-xr-x.  1 root root  64K Jul  9 22:54 BOOTSTAT.DAT*
-rwxr-xr-x.  1 root root  11K Apr  9 22:40 boot.stl*
<snip>

I am happy to just ignore the files at /boot/efi/EFI/Microsoft/Boot (unless there is some reason why I should rather remove them) though as mentioned, I do want to remove the grub menuentry.

I would be grateful for info on how to safely remove this grub entry whilst ensuring that I can continue to boot the windows system at /dev/sda1.

Thanks for any help.

delete /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi and run os-prober again. But make sure you delete the right one!

Thanks for your speedy response!

I will be careful about which one, but could I move it out of the way by renaming it instead of deleting it? Then if by some chance I was on the wrong partition, could I simply rename it back again to restore the windows boot?

Also, after running os-prober would I need to update the grub conf to make the change persistent or would os-prober do that?

sudo efibootmgr -v

also lists your efi entries.

you can use efibootmgr to remove the efi entry: GRUB - ArchWiki

1 Like

Thanks for this. I ran sudo efibootmgr -v though it’s not clear to me from the output which entry I would want to remove.

I then did the following:

$ sudo mv /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi.OLD
$ sudo os-prober
/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows1:efi

and the output now shows only the correct windows boot entry. However, the old incorrect entry is still in the grub.cfg as it still shows up when I reboot.

What is the correct way to update the grub boot menu?

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
2 Likes