How to Fix ‘Sub-process /usr/bin/dpkg Returned an Error Code (1)’ with grub-efi-amd64 in Ubuntu

Executing sudo apt upgrade or installing a new Linux kernel on an Ubuntu system only to have the process crash with the fatal error “installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1” locks the APT package management database. In modern UEFI-based Ubuntu installations, grub-efi-amd64 updates the EFI bootloader binary on the physical ESP partition. When the EFI partition is unmounted, out of disk space, corrupted by bad FAT32 sectors, or blocked by NVRAM write limits, the GRUB post-installation script aborts.

Verify and Remount the EFI System Partition (/boot/efi)

The most frequent reason the GRUB post-install script fails with exit code 1 is that the UEFI boot partition (/boot/efi) is not currently mounted or is mounted in read-only mode.

  1. Open a Terminal window (press Ctrl + Alt + T).
  2. Check if the EFI partition is actively mounted:
    df -h /boot/efi
  3. If the output does not show an active FAT32 volume mounted at /boot/efi, check your filesystem table:
    cat /etc/fstab | grep efi
  4. Attempt to mount all filesystems defined in fstab:
    sudo mount -a
  5. If mounting fails with a read-only or corrupted error, force a file system check on the EFI partition:
    sudo dosfsck -w -r /dev/sda1
    (Replace /dev/sda1 or /dev/nvme0n1p1 with your actual EFI partition identifier from lsblk).
  6. Mount the partition cleanly and proceed to reconfigure the package.

Check for Full /boot and /boot/efi Partitions

An EFI System Partition (ESP) typically has a modest capacity (between 100 MB and 500 MB). Stale kernel images or leftover EFI boot files can fill the partition to 100% utilisation.

  1. Check available disk space on the boot filesystems:
    df -h /boot /boot/efi
  2. If /boot/efi indicates 100% Use, inspect the files taking up space:
    sudo ls -la /boot/efi/EFI/
  3. Remove obsolete vendor folders from previous Linux distributions or uninstalled dual-boot operating systems.
  4. Purge retired Linux kernels from /boot:
    sudo apt autoremove --purge -y

Manually Install GRUB to the EFI Partition

Reinstalling the GRUB UEFI binaries manually reconstructs necessary EFI directory trees and regenerates bootloader keys.

  1. Verify your physical root disk identifier by running lsblk.
  2. Execute the manual GRUB installation command targeting your primary drive:
    sudo grub-install /dev/sda
    (For NVMe drives, use sudo grub-install /dev/nvme0n1).
  3. If successful, update the GRUB configuration file:
    sudo update-grub

Reconfigure Pending DPKG Packages

Once the EFI environment is functional, instruct dpkg to complete the interrupted package transactions.

  1. In Terminal, execute the database configuration command:
    sudo dpkg --configure -a
  2. Ensure that grub-efi-amd64 and grub-efi-amd64-signed configure without reporting errors.
  3. Run a dependency verification:
    sudo apt --fix-broken install
  4. Perform a final update:
    sudo apt update && sudo apt upgrade -y

Clear Full UEFI NVRAM Boot Variables

Certain motherboard UEFI firmwares have buggy NVRAM implementations that refuse new boot entries when variables become cluttered.

  1. Install the efibootmgr tool:
    sudo apt install -y efibootmgr
  2. List existing boot entries:
    sudo efibootmgr
  3. Delete redundant or stale boot entries:
    sudo efibootmgr -b XXXX -B
    (Replace XXXX with the boot entry number).
  4. Reinstall GRUB and reconfigure dpkg.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.