13

I was trying to rescue GRUB in Linux. I was able to login in the OS following this tutorial:

https://www.lisenet.com/2014/grub2-rescue-mode-error-unknown-filesystem/

I have 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 am not very experienced using mount or other commands.

9

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

It depends on your distribution where EFI system is mounted and on some distributions it isn't 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:

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"

  • 1
    Thanks, In the grub-install --efi-directory=/boot/EFI as i chroot into /mnt. – krishnakant Nov 26 '17 at 19:20
  • Maybe stupid Q but I don't have an EFI dir. Where do I get one? I mean it is supposed to contain files, which command can recreate it? – Lennart Rolland Aug 29 at 0:18
  • @LennartRolland If you have a UEFI compatible system then your system drive will be GPT partitioned and contains a "UEFI System partition." usually the first partition and will be of the type EF00. Many distributions will mount this by default as /boot/efi to among other things allow the GRUB boot loader to update its files. If not you'll have to mount it yourself and add it to fstab. You might also have a UEFI system but that is using legacy mode which means your partitions will be msdos type and you won't have a /boot/efi. Weirder configurations exist but that covers the majority of them. – jdwolf Sep 8 at 20:43
  • Your instructions if EFI is not mounted are wrong. See my edit. mount | grep /dev/sda6 doesn't work. If EFI is not mounted, you have to check the partitions for type. – giusti Oct 2 at 17:06
  • @giusti Probably better to just not make specific device name references. – jdwolf Oct 19 at 18:10
1

Grub rescue mode can be treated as

set root=(hd0,gpt6)
set prefix=(hd0,gpt6)/boot/grub
insmod normal
normal

Once you login, enter sudo update-grub && sudo grub-install /dev/sda.

  • Should the grub-install not the done before the update-grub? – danger89 Oct 18 '18 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.