I need to boot Windows and two other Linux distors using Grub. So, I have installed Grub on UEFI partition with a dedicated partition for storing the files used by Grub using the following command.
sudo grub-install --efi-directory=/mnt/efi --root-directory=/mnt/grub --bootloader-id=Grub --uefi-secure-boot --target=x86_64-efi /dev/sda
/dev/sda1 mounted on /mnt/efi is my EFI partition, and /dev/sda2 mounted on /mnt/grub is the partition intended for Grub files.
However upon booting Grub is seemingly unable to find the grub.cfg file I placed at /mnt/grub, and shows the default Grub shell. I am able to manually recover my system by typing either configfile /efi/Grub/grub.cfg or configfile (hd0,gpt2)/grub/grub.cfg.
Here are some of my files
$ sudo tree /mnt/efi/EFI
/mnt/efi/EFI
├── Grub
│ ├── BOOTX64.CSV
│ ├── fbx64.efi
│ ├── grub.cfg
│ ├── grubx64.efi
│ ├── mmx64.efi
│ └── shimx64.efi
└── Microsoft
|...
$ sudo tree /mnt/grub/grub
/mnt/grub/grub
├── fonts
│ └── unicode.pf2
├── grub.cfg
├── grubenv
└── x86_64-efi
|...
$ sudo cat /mnt/efi/EFI/Grub/grub.cfg
search.fs_uuid 3110d895-a376-484a-8dba-e0475b9a977c root hd0,gpt2
set prefix=($root)'/grub'
configfile $prefix/grub.cfg
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/sda1 2048 526335 524288 256M EFI System
/dev/sda2 526336 657407 131072 64M Linux filesystem
/dev/sda3 657408 690175 32768 16M Microsoft reserved
/dev/sda4 690176 563607551 562917376 268.4G Microsoft basic data
/dev/sda5 563607552 697825279 134217728 64G Linux filesystem
/dev/sda6 697825280 966260735 268435456 128G Linux filesystem
/dev/sda7 966260736 983037951 16777216 8G Linux swap
/dev/sda8 983037952 1117254748 134216797 64G Linux filesystem
/dev/sda9 1117255680 1385691135 268435456 128G Linux filesystem
/dev/sda10 1385691136 1402468350 16777215 8G Linux swap
I feel like there is some trivial mistake I am making, but I have spent too much time on this.