1

I upgraded my OS from 16.04 to 18.04 yesterday. While upgrading for 6 packages (namely grub-efi-amd64, gdm3, grub-efi-amd64-signed, cups-pk-helper, ubuntu-desktop, gnome-initial-setup ) installation failed but process said upgrading will continue. So I assumed that I'll be able to update them after reboot. System rebooted fine after that but whenever I try install any new packages I get the following error message.

(base) user@L-156108409-HP-ProBook-440-G4:~$ sudo dpkg --configure -a
[sudo] password for user: 
Setting up grub-efi-amd64 (2.02-2ubuntu8.15) ...
od: /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c: Operation not permitted
/usr/share/grub/grub-check-signatures: 22: [: Illegal number: 
dpkg: error processing package grub-efi-amd64 (--configure):
 installed grub-efi-amd64 package post-installation script subprocess returned error exit status 255
Setting up gdm3 (3.28.3-0ubuntu18.04.4) ...
chage: /etc/passwd.7558: Permission denied
chage: cannot lock /etc/passwd; try again later.
Stopped: `/usr/bin/chage -M 99999 gdm' returned error code 1. Exiting.

Removing user `gdm' ...
dpkg: error processing package gdm3 (--configure):
 installed gdm3 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of grub-efi-amd64-signed:
 grub-efi-amd64-signed depends on grub-efi-amd64 | grub-pc; however:
  Package grub-efi-amd64 is not configured yet.
  Package grub-pc is not installed.

dpkg: error processing package grub-efi-amd64-signed (--configure):
 dependency problems - leaving unconfigured
Setting up cups-pk-helper (0.2.6-1ubuntu1.2) ...
chage: /etc/passwd.7581: Permission denied
chage: cannot lock /etc/passwd; try again later.
Stopped: `/usr/bin/chage -M 99999 cups-pk-helper' returned error code 1. Exiting.

Removing user `cups-pk-helper' ...
dpkg: error processing package cups-pk-helper (--configure):
 installed cups-pk-helper package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on gdm3; however:
  Package gdm3 is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
Setting up gnome-initial-setup (3.28.0-2ubuntu6.16.04.6) ...
chage: /etc/passwd.7601: Permission denied
chage: cannot lock /etc/passwd; try again later.
Stopped: `/usr/bin/chage -M 99999 gnome-initial-setup' returned error code 1. Exiting.

Removing user `gnome-initial-setup' ...
dpkg: error processing package gnome-initial-setup (--configure):
 installed gnome-initial-setup package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 grub-efi-amd64
 gdm3
 grub-efi-amd64-signed
 cups-pk-helper
 ubuntu-desktop
 gnome-initial-setup

I realise that it's because of these 6 broken packages and I've tried solutions mentioned here, here and here (installed mokutil, but no difference). I've also tried tried to re-install these packages individually, but it didn't work. Another solution mentioned here suggested me to remove these packages from status file in dpkg, but since two of them were related grub I didn't want to mess around with that.

Could anyone please help me out to figure these issues out? Thanks in advance.

Edit: This link says removing grub entirely and re-installing it. Is it safe to do this? Since this is my work laptop I really don't want to mess around too much.

Edit 2: FYI, I've installed Ubuntu in EFI boot

(base) user@L-156108409-HP-ProBook-440-G4:~$ [ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD" 
EFI boot on HDD

Edit 3: I've tried efibootmgr and got this output, not sure why. I have no problem in booting my system.

(base) user@L-156108409-HP-ProBook-440-G4:~$ sudo efibootmgr
Skipping unreadable variable "Boot0000": Operation not permitted
Skipping unreadable variable "Boot0001": Operation not permitted
Skipping unreadable variable "Boot0002": Operation not permitted
Skipping unreadable variable "Boot0003": Operation not permitted
Skipping unreadable variable "Boot0004": Operation not permitted
Skipping unreadable variable "Boot0005": Operation not permitted
Skipping unreadable variable "Boot0006": Operation not permitted
Skipping unreadable variable "Boot0007": Operation not permitted
Skipping unreadable variable "Boot0008": Operation not permitted
Skipping unreadable variable "Boot0009": Operation not permitted
Skipping unreadable variable "Boot000A": Operation not permitted
Skipping unreadable variable "Boot000B": Operation not permitted
Skipping unreadable variable "Boot000D": Operation not permitted
Skipping unreadable variable "Boot000E": Operation not permitted
Skipping unreadable variable "Boot000F": Operation not permitted
Skipping unreadable variable "Boot0011": Operation not permitted
show_order(): Operation not permitted

Edit 4: Adding some more info, in case it helps for diagnosis. Looks like grub-efi-amd64 is partially configured and it's signed is unpacked. My doubt is how am I able to boot my system when this is only partially configured. And why can't I finish this installation?

(base) user@L-156108409-HP-ProBook-440-G4:~$ dpkg -l | grep grub
ii  grub-common                                2.02-2ubuntu8.15                                    amd64        GRand Unified Bootloader (common files)
iF  grub-efi-amd64                             2.02-2ubuntu8.15                                    amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 version)
ii  grub-efi-amd64-bin                         2.02-2ubuntu8.15                                    amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 binaries)
iU  grub-efi-amd64-signed                      1.93.16+2.02-2ubuntu8.15                            amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 version, signed)
ii  grub2-common                               2.02-2ubuntu8.15                                    amd64        GRand Unified Bootloader (common files for version 2)

Please let me know if you need any further info. Any help is much appreciated.

1 Answers1

0

I managed to solve the issue through a workaround. I removed the package info of all the conflicted packages from /var/lib/dpkg/status (beginning from "Package:..." till end of that) and also made sure to keep the syntax intact. Ref. used: https://thepcspy.com/read/fixing-dpkg-status-corruption/ .I then managed to run sudo dpkg --configure -a and then sudo apt update and sudo apt upgrade . Restarted my system to verify and it booted up without any issues.

But, the package I was trying to install was ROS Melodic (http://wiki.ros.org/melodic/Installation/Ubuntu ) and the installation of these packages ( using sudo apt install ros-melodic-desktop-full ) failed with error message E: Unable to correct problems, you have held broken packages.. I traced it back and figured out that it will lead to ubuntu-desktop package.I tried to install this (again), but it bought back 3 more dpkg errors from the packages ( gdm3, cups-pk-helper, gnome-initial-setup ) which I removed from /var/lib/dpkg/status file. So I ended up reinstalling my system with live USB. The method of modifying status package could work if it's not system critical packages, but in my case it didn't. Hopefully all this info would be helpful to someone.