This guide fixes the grub-efi-amd64-signed or shim-signed package error on older Ubuntu servers that boot using legacy BIOS. It replaces the EFI bootloader packages with GRUB for BIOS and completes the interrupted package configuration.

Setting up grub-efi-amd64-signed ...
Unknown device "/dev/disk/by-id/*": No such file or 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
E: Sub-process /usr/bin/dpkg returned an error code (1)


Important: Only follow the repair steps if the boot-mode check below reports Legacy BIOS. Do not remove grub-efi or shim-signed from a UEFI server, as this may prevent it from booting.

This procedure changes bootloader packages and writes GRUB to the server's boot disk. Before continuing:

  • create a current backup;
  • make sure you can access the server's Rescue Console in mPanel;
  • run the commands from an account with sudo access; and
  • do not reboot until all verification steps have completed successfully.


Ubuntu 18.04 and 20.04 are outside Canonical's standard support period. After resolving the package error, plan to migrate the workload to a supported Ubuntu release or review Ubuntu Pro if the server must remain on an older release.

1. Confirm the server uses legacy BIOS


Run:

if [ -d /sys/firmware/efi ]; then
    echo "Boot mode: UEFI"
else
    echo "Boot mode: Legacy BIOS"
fi


If the result is Boot mode: UEFI, stop here. The repair commands in this article do not apply to that server.

Continue only if the result is Boot mode: Legacy BIOS.

2. Identify the boot disk


Display the root filesystem and its parent devices:

ROOT_SOURCE=$(findmnt -no SOURCE /)
printf 'Root filesystem: %s\n' "$ROOT_SOURCE"
lsblk -s -o NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT "$ROOT_SOURCE"


Follow the output from the root filesystem to the parent device whose type is disk. Use the whole-disk path, not a partition.

For example, if the root filesystem is /dev/vda1, the boot disk is normally /dev/vda, not /dev/vda1.

Set BOOT_DISK to the whole-disk path you identified. Replace <disk-name> before running the command:

BOOT_DISK=/dev/<disk-name>
lsblk -dn -o NAME,TYPE,SIZE "$BOOT_DISK"


Confirm that this returns the expected device with type disk. If it does not, correct BOOT_DISK before continuing.

3. Replace the EFI bootloader packages


The following command installs GRUB for legacy BIOS and removes the EFI bootloader packages that are blocking package configuration:

sudo apt-get install grub-pc grub-efi-amd64- grub-efi-amd64-signed- shim-signed- --allow-remove-essential


Review the proposed package changes before accepting them. Do not add -y to this command.

If prompted to choose a GRUB installation device, select the whole boot disk identified in the previous step, such as /dev/vda. Do not select a partition such as /dev/vda1.

4. Install and update GRUB


Install the BIOS version of GRUB to the selected disk, rebuild its configuration, and complete any interrupted package configuration:

sudo grub-install --target=i386-pc "$BOOT_DISK"
sudo update-grub
sudo dpkg --configure -a
sudo apt-get -f install


Each command must finish without an error before you continue.

5. Verify the repair


Check that the legacy BIOS GRUB packages are installed and that no packages remain partially configured:

dpkg-query -W -f='${binary:Package}: ${Status}\n' grub-pc grub-pc-bin
sudo dpkg --audit
sudo apt-get check


Both GRUB packages should report install ok installed. dpkg --audit should return no output, and apt-get check should finish without an error.

When these checks succeed, reboot the server while keeping the mPanel Rescue Console available:

sudo reboot


After the server returns, confirm that you can log in and that a normal package update completes:

sudo apt-get update
sudo apt-get upgrade


Changes within the guest operating system remain customer-managed. BinaryLane Support can assist with access to the Rescue Console and other BinaryLane platform features. See What support options are available? for details.