One of my most popular answers is instructions on how to repair grub. Over time, others have contributed bug fixes to the answer. A recent comment, though, made me wonder if it works on newer UEFI hardware.
Gabor wrote:
I get a "cannot find EFI directory" at step 7 and cannot boot. Any ideas?
All my hardware is older, pre-UEFI hardware. So my question is this: Are my instructions, particularly step 7, applicable to UEFI hardware? If not, what changes need to be made?
If you have EFI, then there will be an EFI System Partition (ESP) on the disk. This partition has to be mounted on
/boot/efi
, so that GRUB can use it. The partition:boot
flag enabledEFI
folderEFI
by the OEM, but no guaranteesI don't have one on hand, but you can see examples of how such a partition will look:
Super User post about creating one, with
parted -l
output:Unix & Linux post, also about creating one, with a GParted screenshot:
So, the task here is, somewhere around steps 3 & 4:
Mount it:
Then you can proceed with your usual answer. I have done it myself. Consider it similar to mounting a
/boot
partition if you have one separate.You can mount it anywhere you like. In that case, just specify the mount directory to GRUB while installing:
In your original answer, you wrote:
This isn't true under EFI. Well, Windows is still pretty rude, and could be said to assume it's the only OS, but it does not replace GRUB. Under EFI, multiple boot loader coexist on the EFI System Partition (ESP), and Windows does not delete or replace GRUB.
That said, the average user might not notice any difference in symptoms between a BIOS-mode and an EFI-mode installation of Windows after Ubuntu, because what Windows does in EFI mode is to set its own boot loader as the default. Thus, the computer ends up booting Windows instead of Ubuntu. This looks like the same problem as under BIOS, but it's not.
Something similar to your solution may work under EFI, but it's overkill, and therefore has the potential to create more problems than it solves. In outline, the simplest way to get GRUB back after installing Windows under EFI is:
ubuntu
entry to the top of the boot order list.sudo update-grub
in a Terminal window.At this point, Windows should show up as an option in the GRUB menu on the next reboot.
An alternative would use the built-in Windows program
bcdedit
instead of EasyUEFI, but EasyUEFI is, well, easier, despite being a third-party program that must be downloaded and installed.