Ubuntu 20.04 grub efi apt error "mount: /var/lib/grub/esp: special device /dev/sda15 does not exist. dpkg: error processing package grub-efi-amd64-signed post-installation subprocess returned status 32" (debconf)

This happend on a Ubuntu 20.04 server with non-UEFI boot system (and software RAID 0)

  • apt dist-upgrade
    • 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

Strange, "esp" and a non existing-device "/dev/sda15"... are we using EFI at all?

  • cat /etc/fstab

    • No EFI partition
  • efibootmgr
    • EFI variables are not supported on this system.

No, this is definitly no EFI system

A forum post lead me to check the debconf variables:

https://ubuntuforums.org/showthread.php?t=2480652&p=14119050#post14119050

  • debconf-show grub-pc
    • grub-pc    grub-pc/timeout    string    0
      grub-pc    grub-pc/postrm_purge_boot_grub    boolean    false
      grub-pc    grub-pc/mixed_legacy_and_grub2    boolean    true
      grub-pc    grub2/update_nvram    boolean    true
      grub-pc    grub-pc/kopt_extracted    boolean    false
      grub-pc    grub-pc/install_devices_failed    boolean    false
      grub-pc    grub-efi/install_devices_disks_changed    multiselect    /dev/sda15
      grub-pc    grub2/unsigned_kernels    note    
      grub-pc    grub2/kfreebsd_cmdline_default    string    quiet splash
      grub-pc    grub-pc/install_devices_empty    boolean    false
      grub-pc    grub-pc/install_devices_failed_upgrade    boolean    true
      grub-pc    grub-efi/install_devices_failed    boolean    false
      grub-pc    grub-efi/install_devices_empty    boolean    false

      grub-pc    grub2/kfreebsd_cmdline    string    
      grub-pc    grub2/no_efi_extra_removable    boolean    false
      grub-pc    grub-pc/hidden_timeout    boolean    true
      grub-pc    grub-pc/install_devices_disks_changed    multiselect    
      grub-pc    grub-efi/install_devices    multiselect    /dev/sda15
      grub-pc    grub2/linux_cmdline    string    consoleblank=0 systemd.show_status=true ipv6.disable=1
      grub-pc    grub2/linux_cmdline_default    string    
      grub-pc    grub-pc/chainload_from_menu.lst    boolean    true
      grub-pc    grub-pc/install_devices    multiselect    /dev/disk/by-id/ata-Micron_1100_MTFDDAK512TBN_1706160F1EF6, /dev/disk/by-id/ata-Micron_1100_MTFDDAK512TBN_18471FAE18E5

I tried a lot of things. This is was finally worked (If I recall correctly)

  • debconf-get-selections | grep grub-pc > debconf_grub-pc.txt
    • Backup settings
  • cp debconf_grub-pc.txt debconf_grub-pc-modified.txt
    • Create a file which we'll modify
  • vi debconf_grub-pc-modified.txt
    • Remove all "grub-efi" lines, save and exit
  • echo PURGE | debconf-communicate grub-pc
    • Purge all grub-pc settings
  • debconf-set-selections debconf_grub-pc-modified.txt
    • Restore only valid settings
  • debconf-show grub-pc
  • mv /var/cache/debconf /var/cache/debconf.bak
    • Remove debconf cache, it will be rebuilt automatically
  • dpkg --configure -a
    • I think I was asked if we want to leave grub unconfigured -> "yes"
    • Should now fix the problem "dpkg: error processing package"
  • dpkg-reconfigure grub-pc
    • Accept defaults, device(s): select main device(s) e.g. /dev/sda, /dev/sdb  (without numbers)
  • update-grub
    • Not sure if this is necessary
  • apt purge grub-efi
    • Not sure if this is necessary
  • apt update
  • apt dist-upgrade
  • reboot