Failed to open \EFI\BOOT\grubx64.efi - Not Found (Dual Boot Ubuntu with Windows 10)

Background

I have a Windows 10 machine with a SSD where I have installed Ubuntu LTS 20.04. This setup worked wonderfully for months. When I turn my machine on I get to choose which operative system to use.

Problem

That is, until yesterday. Yesterday I logged on my Windows boot, did nothing special and then turned the machine off. Windows probably installed some updates after I left.

Today I turned my machine on and realized I couldn't log on to my Ubuntu partition, where all of my work is:

Failed to open \EFI\BOOT\grubx64.efi - Not Found  
Failed to load image \EFI\BOOT\grubx64.efi: Not Found    
start_image() returned Not Found  

Research

I did some searching around but it looks like this problem has a specific solution for each case.

So I installed Boot-repair, and got the following diagnostics link:

https://paste.ubuntu.com/p/TdbRzdmQsZ/

I didn't run the "Recommended Repair" option yet, as this was discouraged in a similar problem in favor of asking advice to the community first:

Error: "Failed to open \EFI\BOOT\grubx64.efi..." (Dual-Booting)

Questions

My Ubuntu partition is where all of my work is. I cannot stress the importance of this dual boot working properly. With this in mind I have the following questions:

  • How can I fix the issue now?
  • How can I prevent it from ever happening again?

Solution 1:

As the error states, you are missing grubx64.efi in the UEFI directory EFI/ubuntu. How that happened is anyone's guess, since a bad install would not have been working for months.

To fix, just copy grubx64.efi to the EFI/ubuntu directory. Your install media should have a copy. from the install media, you can mount the UEFI partition, say at /mnt, so the copy target would look like /mnt/EFI/ubuntu/grub.x64.efi (caps matter, make the target match what is actually there).

Your UEFI partition (ESP) is on nme0n1p1, from the running install media, mount it at /mnt:

sudo mount -tvfat /dev/nvme0n1p1 /mnt

You should now see the location you need to put the grubx64.efi file in /mnt/efi/ubuntu. Take a look with ls, you should have shimx64.efi and grub.cfg there already according to your boot-repair report.

Copy grubx64.efi to that location. The install media should have a copy of grubx64.efi in /EFI/boot/grubx64.efi, so the command is:

sudo cp /EFI/boot/grubx64.efi /mnt/efi/ubuntu 

Unmount the /mnt, remove the install media, and reboot. With grubx64.efi present in the same directory as shimx64.efi, the grub UEFI boot should work.