ubuntu 18.04 "grub-install: error: cannot find EFI directory"
I have this issue on multiple ubuntu 18.04 servers.
During a regular apt update && apt upgrade
I get this error:
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
I'm on a server, I don't use grub and I never heard of EFI, I didn't change any of its settings as far as I know.
I have /dev/md1 mounted on /boot, and I see I have a directory /boot/efi but it's empty.
How can I fix this issue?
fdisk -l:
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F4BBD515-6E5E-4152-AD41-6D80A4A69583
Device Start End Sectors Size Type
/dev/sda1 40 2048 2009 1004.5K BIOS boot
/dev/sda2 4096 3905976319 3905972224 1.8T Linux RAID
/dev/sda3 3905976320 3907022847 1046528 511M Linux swap
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2C2D425C-9EAF-472D-8820-068D587A47D0
Device Start End Sectors Size Type
/dev/sdb1 40 2048 2009 1004.5K BIOS boot
/dev/sdb2 4096 3905976319 3905972224 1.8T Linux RAID
/dev/sdb3 3905976320 3907022847 1046528 511M Linux swap
Disk /dev/md2: 1.8 TiB, 1999857713152 bytes, 3905972096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
fdisk -l
, second server:
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x762b7381
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 4096 1050623 1046528 511M fd Linux raid autodetect
/dev/sda2 1050624 467808255 466757632 222.6G fd Linux raid autodetect
/dev/sda3 467808256 468854783 1046528 511M 82 Linux swap / Solaris
Disk /dev/md2: 445.1 GiB, 477958766592 bytes, 933513216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk /dev/md1: 511 MiB, 535756800 bytes, 1046400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x41167758
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 4096 1050623 1046528 511M fd Linux raid autodetect
/dev/sdb2 1050624 467808255 466757632 222.6G fd Linux raid autodetect
/dev/sdb3 467808256 468854783 1046528 511M 82 Linux swap / Solaris
Solution 1:
I use 18.04 on Legacy BIOS boot. I have only these grub packages:
- grub-common
- grub-gfxpayload-lists
- grub-pc
- grub-pc-bin
- grub2-common
Probably you have to remove the grub-efi packages:
apt remove grub-efi*
Good luck!