dpkg fails to install grub-efi-amd64 signed and shim-signed

Bug #1871963 reported by Seija K.
218
This bug affects 61 people
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
Invalid
Undecided
Unassigned
grub2-signed (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

See above

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: dpkg 1.19.7ubuntu3
ProcVersionSignature: Ubuntu 5.4.0-21.25-generic 5.4.27
Uname: Linux 5.4.0-21-generic x86_64
ApportVersion: 2.20.11-0ubuntu26
Architecture: amd64
CasperMD5CheckResult: skip
Date: Thu Apr 9 18:41:33 2020
InstallationDate: Installed on 2020-04-09 (0 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Beta amd64 (20200402)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: dpkg
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Seija K. (rose128) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in dpkg (Ubuntu):
status: New → Confirmed
Revision history for this message
Lee Trager (ltrager) wrote :

Just confirming this as well

 sudo apt install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up grub-efi-amd64-signed (1.139+2.04-1ubuntu24) ...
/var/lib/dpkg/info/grub-efi-amd64-signed.postinst: 23: Syntax error: word unexpected (expecting ")")
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status
 2
Errors were encountered while processing:
 grub-efi-amd64-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Lee Trager (ltrager) wrote :

It looks like there is an extra ';;' in the script, the following patch fixes it.

--- /tmp/grub-efi-amd64-signed.postinst 2020-04-09 16:50:58.585757438 -0700
+++ /var/lib/dpkg/info/grub-efi-amd64-signed.postinst 2020-04-09 16:51:12.029644653 -0700
@@ -16,7 +16,7 @@

 case $1 in
     configure)
- target=x86_64-efi
+ target=x86_64-efi ;;
  # Check /boot/grub to see if we previously installed to an ESP. We don't
  # want to trigger the install code just by installing the package,
  # normally the installer installs grub itself first.

I do get a warning that "The GRUB boot loader was previously installed to a disk that is no longer present, or whose unique identifier has changed for some reason." I haven't changed the disks on my system or done anything else that should trigger this.

Changed in grub (Ubuntu):
status: New → Confirmed
Paul White (paulw2u)
affects: grub (Ubuntu) → grub2 (Ubuntu)
Paul White (paulw2u)
affects: grub2 (Ubuntu) → grub2-signed (Ubuntu)
Revision history for this message
Steve Langasek (vorlon) wrote :

Fixed in the version in -proposed, and the broken grub2-signed has been backed out of the release pocket.

Changed in dpkg (Ubuntu):
status: Confirmed → Invalid
Changed in grub2-signed (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Abdel Bolanos Martinez (abdel-bolanos) wrote :

Hi, I see it says (Fix Released).
How can I apply the fix to my pc?
Thanks

Revision history for this message
Jerome (jeromebourget-7) wrote :

Abdel, you can edit the file :
/var/lib/dpkg/info/grub-efi-amd64-signed.postinst
And replace this line :
target=x86_64-efi ;;
For that (remove the ";;") :
target=x86_64-efi
Save and try to update again

Revision history for this message
Abdel Bolanos Martinez (abdel-bolanos) wrote :

Thanks! It worked just fine.

Revision history for this message
Rob Frohne (frohro) wrote :

For me there as no semicolon, but I still get the error.

rohro@frohro-260:~/Projects/IQ_SDR/Receiver$ sudo vi /var/lib/dpkg/info/grub-efi-amd64-signed.postinst
frohro@frohro-260:~/Projects/IQ_SDR/Receiver$ sudo apt upgrade -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  clang-tidy-9 clang-tools-9 gnome-software-common libberkeleydb-perl libcgi-fast-perl libcgi-pm-perl libclang1-9
  libclass-accessor-perl libfcgi-perl libfdk-aac1 libffi6 libmypaint-1.3-0 libobjc-8-dev libpoppler95
  libpython3.7 libpython3.7-minimal libpython3.7-stdlib libwxgtk-webview3.0-gtk3-0v5 node-node-uuid
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up grub-efi-amd64-signed (1.140+2.04-1ubuntu24) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavai
lable
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 grub-efi-amd64-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)
frohro@frohro-260:~/Projects/IQ_SDR/Receiver$

Revision history for this message
Brett Bogert (bbogert24) wrote : Re: [Bug 1871963] Re: dpkg fails to install grub-efi-amd64 signed and shim-signed

Rob,

       Your problem is due to another process having the
/var/cache/debconf.dat
       file in a locked state:

     debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

       The original problem reported was due to a syntax error in the
code which is now fixed.

       I have never seen this particular problem before so haven't a
clue how to fix it.

       Normally if you have a file locked during an apt command it is
due to another apt
       process locking it. This could be due to an automated check for
update(e.g. apt update)
       command running when you are trying to do a manual command or
from one of the
       package managers being left open when you are trying to do a
manual command.

       Hope this helps,

Brett "WolfMan" Bogert
<email address hidden>

On 4/10/20 7:42 PM, Rob Frohne wrote:
> For me there as no semicolon, but I still get the error.
>
> rohro@frohro-260:~/Projects/IQ_SDR/Receiver$ sudo vi /var/lib/dpkg/info/grub-efi-amd64-signed.postinst
> frohro@frohro-260:~/Projects/IQ_SDR/Receiver$ sudo apt upgrade -f
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> Calculating upgrade... Done
> The following packages were automatically installed and are no longer required:
> clang-tidy-9 clang-tools-9 gnome-software-common libberkeleydb-perl libcgi-fast-perl libcgi-pm-perl libclang1-9
> libclass-accessor-perl libfcgi-perl libfdk-aac1 libffi6 libmypaint-1.3-0 libobjc-8-dev libpoppler95
> libpython3.7 libpython3.7-minimal libpython3.7-stdlib libwxgtk-webview3.0-gtk3-0v5 node-node-uuid
> Use 'sudo apt autoremove' to remove them.
> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> 1 not fully installed or removed.
> After this operation, 0 B of additional disk space will be used.
> Do you want to continue? [Y/n]
> debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
> Setting up grub-efi-amd64-signed (1.140+2.04-1ubuntu24) ...
> debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavai
> lable
> dpkg: error processing package grub-efi-amd64-signed (--configure):
> installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
> Errors were encountered while processing:
> grub-efi-amd64-signed
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> frohro@frohro-260:~/Projects/IQ_SDR/Receiver$
>

Revision history for this message
Ken Wagner (beaucoder) wrote :

Brett,

Thanks for the update. I know how to unlock the lock files.

Ken Wagner

On 4/11/20 12:24 PM, Brett Bogert wrote:
> Rob,
>
>       Your problem is due to another process having the
> /var/cache/debconf.dat
>       file in a locked state:
>
> debconf: DbDriver "config": /var/cache/debconf/config.dat is locked
> by another process: Resource temporarily unavailable
>
>       The original problem reported was due to a syntax error in the
> code which is now fixed.
>
>       I have never seen this particular problem before so haven't a
> clue how to fix it.
>
>       Normally if you have a file locked during an apt command it is
> due to another apt
>       process locking it. This could be due to an automated check for
> update(e.g. apt update)
>       command running when you are trying to do a manual command or
> from one of the
>       package managers being left open when you are trying to do a
> manual command.
>
>       Hope this helps,
>
> Brett "WolfMan" Bogert
> <email address hidden>
>
>
> On 4/10/20 7:42 PM, Rob Frohne wrote:
>> For me there as no semicolon, but I still get the error.
>>
>> rohro@frohro-260:~/Projects/IQ_SDR/Receiver$ sudo vi /var/lib/dpkg/info/grub-efi-amd64-signed.postinst
>> frohro@frohro-260:~/Projects/IQ_SDR/Receiver$ sudo apt upgrade -f
>> Reading package lists... Done
>> Building dependency tree
>> Reading state information... Done
>> Calculating upgrade... Done
>> The following packages were automatically installed and are no longer required:
>> clang-tidy-9 clang-tools-9 gnome-software-common libberkeleydb-perl libcgi-fast-perl libcgi-pm-perl libclang1-9
>> libclass-accessor-perl libfcgi-perl libfdk-aac1 libffi6 libmypaint-1.3-0 libobjc-8-dev libpoppler95
>> libpython3.7 libpython3.7-minimal libpython3.7-stdlib libwxgtk-webview3.0-gtk3-0v5 node-node-uuid
>> Use 'sudo apt autoremove' to remove them.
>> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
>> 1 not fully installed or removed.
>> After this operation, 0 B of additional disk space will be used.
>> Do you want to continue? [Y/n]
>> debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
>> Setting up grub-efi-amd64-signed (1.140+2.04-1ubuntu24) ...
>> debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavai
>> lable
>> dpkg: error processing package grub-efi-amd64-signed (--configure):
>> installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
>> Errors were encountered while processing:
>> grub-efi-amd64-signed
>> E: Sub-process /usr/bin/dpkg returned an error code (1)
>> frohro@frohro-260:~/Projects/IQ_SDR/Receiver$
>>

Revision history for this message
Deepak G N R (gnrdeepak) wrote :

Hello,

There is no semicolon in the file but I still have same problem.

====================================================================================
Do you want to continue? [Y/n] y
Setting up grub-efi-amd64-signed (1.142+2.04-1ubuntu26) ...
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 10
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                         dpkg: dependency problems prevent configuration of 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 unconfigured
Errors were encountered while processing:
 grub-efi-amd64-signed
 shim-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)
====================================================================================

Ubuntu software center was missing. "sudo apt-get install ubuntu-software" resulted in the same error. However, software center installation was successful.

How can I fix this? Please assist.

Regards,
Deepak

Revision history for this message
Philipp Classen (philipp-classen) wrote :

Just had the same issue as Deepak. Same error after upgrading from 18.04 to 20.04, but I checked and apparently also had the fix of the semicolon in /var/lib/dpkg/info/grub-efi-amd64-signed.postinst. So, there might be another issue that is causing the same problem.

Running it with "set -x", I could see that the "/usr/lib/grub-multi-install --target=$target" call was failing (with target=x86_64-efi). Why it failed, I could not find out.

I was able to fix the installation problem by running the commands from https://stackoverflow.com/a/53284186/783510:

# sudo apt-get purge grub\*
# sudo apt-get install grub-efi
# sudo apt-get autoremove
# sudo update-grub

After that, the apt-get errors were gone, and the installation could be completed.

(Another issue, which I will mention as there is a tiny chance that it is related, although I doubt it: After rebooting, I was not able to boot (not even reaching the question for the passphrase). To solve it, I had to disable Secure Boot, then I reached the state where I could enter my passphrase to unlock the encrypted partition.)

My notebook: Lenovo ThinkPad X1 Carbon 4th

Revision history for this message
Bastian (oimel) wrote :

Had the same issue as philipp-classen, upgrade from 19.10 to 20.04 and install failed:

grub-efi-amd64-signed (1.142+2.04-1ubuntu26) wird eingerichtet ...
dpkg: Fehler beim Bearbeiten des Paketes grub-efi-amd64-signed (--configure):
 »installiertes grub-efi-amd64-signed-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 10 zurück
Fehler traten auf beim Bearbeiten von:
 grub-efi-amd64-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Also solved it following the instructions on https://stackoverflow.com/a/53284186/783510

Revision history for this message
Mike Reed (rhjeepdriver) wrote :
Download full text (11.4 KiB)

Not sure what to do now.

mike@mike-desktop:~$ sudo apt-get purge grub\*
[sudo] password for mike:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'grub-legacy' for glob 'grub*'
Note, selecting 'grub-doc' for glob 'grub*'
Note, selecting 'grub-ipxe' for glob 'grub*'
Note, selecting 'grub-efi' for glob 'grub*'
Note, selecting 'grub-emu' for glob 'grub*'
Note, selecting 'grub-coreboot' for glob 'grub*'
Note, selecting 'grub-linuxbios' for glob 'grub*'
Note, selecting 'grub-common' for glob 'grub*'
Note, selecting 'grub-invaders' for glob 'grub*'
Note, selecting 'grub-coreboot-bin' for glob 'grub*'
Note, selecting 'grub-ieee1275-bin' for glob 'grub*'
Note, selecting 'grub-coreboot-dbg' for glob 'grub*'
Note, selecting 'grub-xen-bin' for glob 'grub*'
Note, selecting 'grub-ieee1275-dbg' for glob 'grub*'
Note, selecting 'grub-xen-dbg' for glob 'grub*'
Note, selecting 'grub2-common' for glob 'grub*'
Note, selecting 'grub-legacy-doc' for glob 'grub*'
Note, selecting 'grub-legacy-ec2' for glob 'grub*'
Note, selecting 'grub-splashimages' for glob 'grub*'
Note, selecting 'grub-yeeloong' for glob 'grub*'
Note, selecting 'grub-pc' for glob 'grub*'
Note, selecting 'grub-theme-breeze' for glob 'grub*'
Note, selecting 'grub-imageboot' for glob 'grub*'
Note, selecting 'grub-xen' for glob 'grub*'
Note, selecting 'grub-pc-bin' for glob 'grub*'
Note, selecting 'grub-pc-dbg' for glob 'grub*'
Note, selecting 'grub-efi-amd64-bin' for glob 'grub*'
Note, selecting 'grub-gfxpayload-lists' for glob 'grub*'
Note, selecting 'grub-efi-amd64-dbg' for glob 'grub*'
Note, selecting 'grub2-themes-ubuntu-mate' for glob 'grub*'
Note, selecting 'grub-rescue-pc' for glob 'grub*'
Note, selecting 'grub-ieee1275' for glob 'grub*'
Note, selecting 'grub' for glob 'grub*'
Note, selecting 'grub2' for glob 'grub*'
Note, selecting 'grub-efi-amd64' for glob 'grub*'
Note, selecting 'grub-efi-ia32' for glob 'grub*'
Note, selecting 'grub-efi-ia64' for glob 'grub*'
Note, selecting 'grub-efi-amd64-signed' for glob 'grub*'
Note, selecting 'grub-efi-ia32-bin' for glob 'grub*'
Note, selecting 'grub2-splashimages' for glob 'grub*'
Note, selecting 'grub-efi-ia32-dbg' for glob 'grub*'
Note, selecting 'grub-emu-dbg' for glob 'grub*'
Note, selecting 'grub-xen-host' for glob 'grub*'
Note, selecting 'grub-theme-starfield' for glob 'grub*'
Note, selecting 'grub-firmware-qemu' for glob 'grub*'
Package 'grub-efi-ia64' is not installed, so not removed
Package 'grub-yeeloong' is not installed, so not removed
Package 'grub' is not installed, so not removed
Package 'grub-legacy' is not installed, so not removed
Package 'grub-legacy-doc' is not installed, so not removed
Package 'grub-doc' is not installed, so not removed
Package 'grub-gfxpayload-lists' is not installed, so not removed
Package 'grub-legacy-ec2' is not installed, so not removed
Package 'grub-imageboot' is not installed, so not removed
Package 'grub-invaders' is not installed, so not removed
Package 'grub-splashimages' is not installed, so not removed
Package 'grub-theme-breeze' is not installed, so not removed
Package 'grub2-splashimages' is not installed, so not removed
Package 'grub...

Revision history for this message
hackeron (hackeron) wrote :

It seems to only happen when doing:

# DEBIAN_FRONTEND=noninteractive apt-get -f install

When it is interactive, it asks to select /dev/sda and then it upgrades.

How to upgrade this package non interactive?

Revision history for this message
Nathanaël Langlois (etoilefilante) wrote :

I've tried everything, the patch was already applied, and the stackoverflow solution didn't work; I still have the error on ubuntu 20

Revision history for this message
LaMpiR (lampir) wrote :

I have the same problem as the #17. I have tried everything from stackoverflow but nothing.

Revision history for this message
Nathanaël Langlois (etoilefilante) wrote :

I just completely reinstalled an OVH server, and got the error while upgrading to ubuntu 20 from ubuntu 18. On the other server, an update created the error, it wasn't there when I installed ubuntu 20

Revision history for this message
Nathanaël Langlois (etoilefilante) wrote :

An update released this morning of I don't know what package fixed the issue on multiple servers, so this appears to have been fixed

Revision history for this message
LaMpiR (lampir) wrote :

For me as well.

Revision history for this message
Alex Haydock (alexhaydock) wrote :

We're seeing this one too, on Ubuntu 20.04. I think something interesting to note is the disk layout which might be causing it to happen.

During apt upgrade or forced grub package installation, I get:

    mount: /var/lib/grub/esp: special device /dev/sda1 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

It seems like the install script is looking for /dev/sda1 to install GRUB updates to.

When checking /etc/fstab, I can see a line which states:

    # /boot/efi was on /dev/sda1 during curtin installation

It's a VMware VM which was installed to a single emulated SCSI root VMDK, which will have been /dev/sda during installation. But /dev/sda1 no longer exists because new disks have been added to this system since then.

It seems like when assigning letters (as per the /dev/sd* schema), the SAS disks get assigned letters first, followed by the SCSI boot drive, which ends up being /dev/sdq (meaning the partition GRUB originally installed to is now all the way down at /dev/sdq1).

The disk that ends up being allocated to /dev/sda is one of many in a RAID array, and these are encrypted using LUKS across the entire disk (no partition). So there is no /dev/sda1 at all anymore as far as the GRUB installer is concerned.

Is there any way I can force GRUB to find the correct /boot/efi location? (Running lsblk confirms it is definitely at /dev/sdq1 now).

Revision history for this message
Ben Simpson (thehoagie) wrote :

I am seeing this and I suspect it is because I installed Windows on an extra SSD that was a Linux partition. /dev/sda is that device

```
Setting up grub-efi-amd64-signed (1.155.1+2.04-1ubuntu35.1) ...
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 12
```

I haven't tried purging the grub package because of the high risk. This seems to be a stale reference to the partition on what used to be a different OS.

Revision history for this message
Simeon Walker (simeon-walker) wrote :

I too am seeing this error. Same circumstances as #23.
I have recently installed Win 10 on sda but sda1 is not the NTFS partition, that is sda2.
Ubuntu is on sdb, / on sdb2, /boot/efi on sdb1.
I can find no reference to sda1 in my Ubuntu /etc or /boot so I don't know where it's coming from.
Don't know if it's safe to reboot now.

Revision history for this message
Ben Simpson (thehoagie) wrote :

Philipp Classen #13

> (Another issue, which I will mention as there is a tiny chance that it is related, although I doubt it: After rebooting, I was not able to boot (not even reaching the question for the passphrase). To solve it, I had to disable Secure Boot, then I reached the state where I could enter my passphrase to unlock the encrypted partition.)

Small modification to your commands above - after purging the grub packages I did a `sudo apt-get install grub-efi-amd64-signed` instead of `sudo apt-get install grub-efi`. I believe the signed packages include the CA certificate needed to allow secure boot in the BIOS settings. This could make a difference if this option is enabled. I suspect this might have been what you observed.

Revision history for this message
Pieter De Wit (pieter-insync) wrote :

I am seeing this too (late upgrade to the system)

For me, this is caused by /usr/lib/grub/grub-multi-install:

# /usr/lib/grub/grub-multi-install
mount: /var/lib/grub/esp: special device /dev/sdb1 does not exist.

I have a /dev/sdb, but it's a raw disk, no part. table

# ls /dev/sdb*
/dev/sdb

Thanks :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.