Score:0

Ubuntu 22.04 on BIOS boot errors during apt upgrade because of grub-efi-amd64-signed

cn flag

I have a remote Ubuntu server running for a few months with no problems. And just now, during an apt full-upgrade, I got these errors:

Setting up grub-efi-amd64-signed (1.182~22.04.1+2.06-2ubuntu10) ...
mount: /var/lib/grub/esp: special device /dev/sda15 does not exist.
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 32
dpkg: dependency problems prevent processing triggers for 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 triggers unprocessed
Errors were encountered while processing:
 grub-efi-amd64-signed
 shim-signed
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

It is odd to me since I am on Ubuntu 22.04.1 LTS installed on BIOS boot. I figured these should not have worked a long time ago, but they did until now.

$ [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
BIOS

I have these drives, only /dev/sda is a system drive, with /dev/sda2 being the /boot partition:

$ sudo parted -l
Model: ATA HGST HUH721010AL (scsi)
Disk /dev/sda: 10.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start   End     Size    File system     Name  Flags
 5      1049kB  2097kB  1049kB                        bios_grub
 1      2097kB  17.2GB  17.2GB  linux-swap(v1)        swap
 2      17.2GB  18.3GB  1074MB  ext3
 3      18.3GB  2181GB  2163GB  ext4
 4      2181GB  10.0TB  7820GB  ext4


Model: ATA HGST HUH721010AL (scsi)
Disk /dev/sdb: 10.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  10.0TB  10.0TB  ext4


Model: ATA HGST HUH721010AL (scsi)
Disk /dev/sdc: 10.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  10.0TB  10.0TB  ext4


Model: ATA HGST HUH721010AL (scsi)
Disk /dev/sdd: 10.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  10.0TB  10.0TB  ext4
cc flag
Run apt-cache policy grub-efi-amd64-signed and see if the package is still in a "phased" upgrade. I see it at 59% today, slowly increasing, but you can upgrade the packages (the -bin too) yourself directly.
Hogcryat avatar
cn flag
My problem isn't that the package is held back, but that its post-installation script is failing because it cannot find `/dev/sda15` or something. I never had that partition so I am not sure why it is configured that way in the first place.
cc flag
/var/lib/grub/esp is just an empty dir on my system. Why is there an arm package, grub-efi-arm64-signed , on your amd64 system? Maybe that's messing something up.
Hogcryat avatar
cn flag
It is not installed, you can even see it written explicitly in the `apt` output.
Score:1
cn flag

I've encountered exact same problem on my remote server. Same OS version, same problem with the same grub-efi-amd64-signed package version.

In my case, I have a RAID'ed drive with BIOS boot. And all apt commands except for apt update was giving the exact same error:

mount: /var/lib/grub/esp: special device /dev/sda15 does not exist.

Other resources recommend running apt purge grub\* and then reinstalling proper packages, but in my case the purge doesn't work as well.

I ended up removing shim-signed and the problematic grub packages via the commands below. Although my understanding is that we don't really need grub-efi* and shim-signed with a BIOS boot, please be warned that shim-signed is marked as a protected package, therefore removing it might cause further problems on boot up!

# Use with caution!
dpkg --purge --force-all grub-efi-amd64
dpkg --purge --force-all grub-efi
dpkg --purge --force-all grub-efi-amd64-signed
dpkg --purge --force-all shim-signed

Afterwards, I've run the apt upgrade and apt autoremove with no problems, and encountered no problems during/after reboot. Hope this helps...

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.