Ubuntu 18.04 “grub-install: error: cannot find EFI directory”
Answers to your questions / Bare Metal / Ubuntu 18.04 “grub-instal...
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

Ubuntu 18.04 “grub-install: error: cannot find EFI directory”

by
dma-tube
Created on 2021-06-02 13:03:23 (edited on 2024-09-04 14:24:54) in Bare Metal

I have this issue on many ubuntu 18.04 servers at ovh.
I asked a question also here: https://serverfault.com/questions/1065357/ubuntu-18-04-grub-install-error-cannot-find-efi-directory
The server works fine but since a few weeks ago I got this error:

# apt install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up grub-efi-amd64-signed (1.167~18.04.1+2.04-1ubuntu44) ...
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
dpkg: error processing package grub-efi-amd64-signed (--configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of shim-signed:
shim-signed depends on grub-efi-amd64-signed | grub-efi-arm64-signed; however:
Package grub-efi-amd64-signed is not configured yet.
Package grub-efi-arm64-signed is not installed.

dpkg: error processing package shim-signed (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
grub-efi-amd64-signed
shim-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)

/boot/efi directory is present but empty, while /boot/ contains the following:

# ll /boot/
total 211723
drwxr-xr-x 5 root root 1024 May 21 15:48 ./
drwxr-xr-x 23 root root 4096 May 13 06:55 ../
-rw-r--r-- 1 root root 217414 Apr 12 21:46 config-4.15.0-142-generic
-rw-r--r-- 1 root root 217414 Apr 14 13:15 config-4.15.0-143-generic
-rw-r--r-- 1 root root 217457 Feb 28 2020 config-4.15.0-91-generic
drwxr-xr-x 2 root root 1024 Mar 17 2020 efi/
drwxr-xr-x 6 root root 1024 Jun 2 12:52 grub/
-rw-r--r-- 1 root root 59855039 Apr 25 09:24 initrd.img-4.15.0-142-generic
-rw-r--r-- 1 root root 59858544 May 21 15:48 initrd.img-4.15.0-143-generic
-rw-r--r-- 1 root root 58908955 Apr 25 09:24 initrd.img-4.15.0-91-generic
drwx------ 2 root root 12288 Mar 29 2020 lost+found/
-rw------- 1 root root 4081420 Apr 12 21:46 System.map-4.15.0-142-generic
-rw------- 1 root root 4081437 Apr 14 13:15 System.map-4.15.0-143-generic
-rw------- 1 root root 4069388 Feb 28 2020 System.map-4.15.0-91-generic
-rw------- 1 root root 8445600 Apr 12 21:57 vmlinuz-4.15.0-142-generic
-rw------- 1 root root 8449696 Apr 14 13:18 vmlinuz-4.15.0-143-generic
-rw------- 1 root root 8375960 Feb 28 2020 vmlinuz-4.15.0-91-generic

The server can (re)boot fine, but rebooting doesn't solve the issue.
Any idea what can we do?