1

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
the_nuts
  • 412
  • 6
  • 18
  • 1
    Well that's interesting. Your system is definitely using legacy boot, strangely enough. So grub-efi should not even be installed. I wonder how it got there? I would attempt to purge any package where the name contains `grub-efi`. You also should spend some time trying to find out how this happened, and make sure legacy grub is actually installed. – Michael Hampton Jun 03 '21 at 21:06
  • @MichaelHampton I added the fdisk of another server where this is happening. From dpkg.log I see it's there from the very first day, after the server was installed I did an `apt upgrade` and it shows `2020-09-07 15:10:55 upgrade grub-efi-amd64-bin:amd64 2.02-2ubuntu8.17 2.02-2ubuntu8.18` ... `status installed grub-efi-amd64:amd64 2.02-2ubuntu8.18`. So it seems it was there from the image of my provider (they are OVH dedicated servers) – the_nuts Jun 03 '21 at 21:33
  • to delete it and install grub legacy, what package should I install? I'm a bit confused, I wouldn't want to make the system unbootable... – the_nuts Jun 03 '21 at 21:37
  • In my case, the EFI partition(for me /dev/sdc1) was not mounted correctly to /boot/efi since as it was missing in /etc/fstab. This can be checked with output of `df -Th` is missing `/boot/efi`. After mounting it the package installed correctly and issue disappeared. – harish Feb 04 '22 at 22:52

1 Answers1

2

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!

  • thanks, the issue is fixed and the system is still able to boot (even if now it has no grub-* packages at all) – the_nuts Jun 11 '21 at 08:27
  • On my KVM VPS i had empty /boot/efi and no EFI in /etc/fstab and so i tried to remove grub-efi-amd64-signed package and see no longer error. I would be worried to remove it if computer use EFI boot (set in BIOS i guess). – 16851556 Jun 29 '21 at 09:22