I was trying to rescue grub on linux I was able to login to the os following this tutorial


I need to upgrade grub to fix the problem However, when I run grub-install , I get an error.

$ grub-install /dev/sda
grub-install: error: cannot find EFI directory.

My file system contains sda4 , sda5 , and sda6 for the EFI system, Linux swap, and Linux file system respectively.

I'm not really experienced with mount commands

Best Answer

When you run grub-install by default it assumes the EFI system is mounted as /boot/efi

It depends on your distribution where the efi system is mounted and on some distributions it's not mounted after boot

First check if /boot/efi is mounted with

mount | grep /boot/efi

If that doesn't work first try the following to see if it is mounted elsewhere.

mount | grep /dev/[efi device]

If neither of those work do.

mount /dev/[efi device] /mnt

Now run away

grub-install --efi-directory=[efi dir]
grub-mkconfig -o /boot/grub/grub.cfg

where [efi dir] is either /boot/efi or /mnt and [efi device] is the device with the EFI system partition. If you don't know use the command lsblk -o NAME,PARTTYPE,MOUNTPOINT | grep -i "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"