I had Ubuntu and Windows 10 dual boot, working perfectly fine. Due to slow performance of Ubuntu on my machine, I wanted to replace it with Elementary OS, while maintaining the dual boot. I fired up the E OS iso, chose something else, removed the ubuntu partition and created a new one and installed elementary on it. Theoretically, it should have worked. When I restarted I directly booted into Windows 10. I knew that bios might have placed windows as higher priority boot than Linux. So I went to bios and changed the order. Now, it landed me on grub prompt. I used this command to boot into Elementary:
set prefix=(hd0,7)/boot/grub set root=(hd0,7) insmod normal normal
And I was greeted into Elementary OS. Now I ran:
It went fine and I restarted the laptop, thinking that it worked! Next thing, I was again dropped to grub prompt. When I entered the above command to boot into Elementary, grub menu appeared! It worked with all the entries (I could boot into Windows and Elementary OS)
I did a google search and ended on finding that I haven't ran
sudo grub-install /dev/sda. So I went over to Elementary again and ran it. It gave me an error, saying that 'GPT partition labeled 'bios boot' could not be found' (similar). Again googling for some time resulted with, I needed to create a new partition with 'bios_grub' flag. (Why? It used to work earlier without such thing.) Did it. Still problem stays same. (I can still boot into Windows using BIOS or by entering the command at grub prompt and boot into either two!)
I saw this answer while writing this question and thought of giving it a try.
But, I don't have a grubx64.efi in my /boot/grub directory! I thought maybe I didn't install the OS in EFI mode, but running
dmesg | grep "EFI v" gives
[ 0.000000] efi: EFI v2.31 by American Megatrends.