Windows 10 Is Not Visible On Grub

bootboot-loaderdual-bootgrub2windows

I had elementary OS on my computer. I wiped my hard drive and installed Windows 10 without any problem. Then I shrinked the actual partition it was using, I installed Pardus in that empty partition. In order to install it, I had to disable secure boot in BIOS. It installed properly as well.

When I finally booted my computer, in GRUB menu there was no Windows 10 option. The weird thing is that when enable Secure Boot from BIOS, it cannot boot Pardus so it boots to Windows!

So far I've tried os-prober which didn't find any other OS, I've tried this link, it said ntldr not found or something of the sort. I've replaced ntldr /bootmgr with chainloader +1, and then it said invalid EFI file path. I tried to use UUID of both the largest partition which is named "Microsoft Basic Data" and used the one named "EFI System". Both game me the same error: "EFI file path."

Here is my /etc/grub.d/40_custom:

# Skipping the initial part of the file
menuentry "Windows 10" --class windows --class os {
   insmod ntfs
   search --no-floppy --set=root --fs-uuid FA53-79CA
   chainloader +1
}

Here is the result of my fdisk -l:

Disk /dev/sda: 465,8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: # some hex identifier here

Device         Start       End   Sectors   Size Type
/dev/sda1       2048   1023999   1021952   499M Windows recovery environment
/dev/sda2    1024000   1226751    202752    99M EFI System
/dev/sda3    1226752   1259519     32768    16M Microsoft reserved
/dev/sda4    1259520 490168319 488908800 233,1G Microsoft basic data
/dev/sda5  490168320 968570879 478402560 228,1G Linux filesystem
/dev/sda6  968570880 976771071   8200192   3,9G Linux swap

I am thinking that I might have deleted Windows bootloader but as I've mentioned it boots to Windows when I enable Secure Boot from BIOS.

Best Answer

First of all the fact that Windows boots indicates you have UEFI and that you could use your motherboards boot selector to boot Windows instead of GRUB. It's usually F2 or F12 during boot.

Your Windows 10 menu entry is using

chainloader +1

Which means load the first sector of the root device. Which will not work because the system is UEFI not legacy BIOS.

Instead set the root device to the EFI system and chainload the EFI for windows:

insmod part_gpt
insmod search_fs_uuid
insmod chain
search --no-floppy --set=root --fs-uuid FA53-79CA
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi

Also confirm that the UUID is correct with blkid and is for the EFI system.

GRUB should automatically detect Windows but it will not detect them on RAIDed disks.

Related Question