1

After recent upgrades on an older machine (16.04 -> 18.04 -> 20.04), I can now no longer install anything as apt runs into an error trying to remove linux-image-4.4.0-190-generic, see below for terminal output:

$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.4.0-190-generic
0 upgraded, 0 newly installed, 1 to remove and 53 not upgraded.
1 not fully installed or removed.
After this operation, 7.250 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 177055 files and directories currently installed.)
Removing linux-image-4.4.0-190-generic (4.4.0-190.220) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.4.0-190-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-48-generic
Found initrd image: /boot/initrd.img-5.4.0-48-generic
Found linux image: /boot/vmlinuz-4.15.0-118-generic
Found initrd image: /boot/initrd.img-4.15.0-118-generic
/etc/grub.d/bin/grubcfg_proxy: error while loading shared libraries: libcrypto.so.1.0.0: cannot open 
shared object file: No such file or directory
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-4.4.0-190-generic (--remove):
 installed linux-image-4.4.0-190-generic package post-removal script subprocess returned error exit s
tatus 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-4.4.0-190-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have run sudo apt update beforehand, and running sudo apt upgrade fails on the same error on removal before it manages to install anything.

The first error notice in the output of sudo apt autoremove or sudo apt install -f points to problems with shared library libcrypto.so.1.0.0 from libssl, which I cannot install to fix it because of the exact problem I'm having.

I've also tried to go around it by using --only-upgrade in combination with --reinstall libssl-dev libssl1.1, but this doesn't prevent it from trying to remove the linux-image:

sudo apt --only-upgrade install --reinstall libssl-dev libssl1.1 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.4.0-190-generic
0 upgraded, 0 newly installed, 2 reinstalled, 1 to remove and 53 not upgraded.
1 not fully installed or removed.
Need to get 0 B/2.900 kB of archives.
After this operation, 7.250 kB disk space will be freed.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 177055 files and directories currently installed.)
Removing linux-image-4.4.0-190-generic (4.4.0-190.220) ...

[...]

How do I remove this image and/or fix the underlying problem?

Edit: added mention of sudo apt update/upgrade

Energya
  • 113
  • 53 not upgraded: don't do things in apt when it's "dirty". You need to at least run sudo apt update and sudo apt upgrade to make sure that your package management/maintenance tasks are caught up. – Nmath Sep 30 '20 at 19:11
  • I have run sudo apt update and when running sudo apt upgrade I also get the same problem: before trying to install 53 packages, it wants to remove the linux-image, meaning I can't upgrade. I'll add this in the question – Energya Sep 30 '20 at 19:18
  • Try to move the problematic file out the way by sudo mv /etc/grub.d/bin/grubcfg_proxy ~/ and then resume package installation. Do you remember by who and when this file was created? Please check https://askubuntu.com/a/1168126/66509 – N0rbert Sep 30 '20 at 19:34
  • @N0rbert I've tried, but no luck, it still errors. I don't know about the when of the file, but I'm the only one using the computer and I have changed some grub settings to enable windows dual-boot, so things may have been corrupted during distribution upgrade – Energya Sep 30 '20 at 19:35
  • Maybe purging the grub-customizer package will help. Also please add output of ls -R /etc/grub.d to the question. – N0rbert Sep 30 '20 at 19:38
  • @N0rbert @jarno Thanks for pointing me to grub-customizer, purging it wasn't possible (same error), but just starting it caused it to update and apparently fix the grub files by itself. sudo apt install -f worked perfectly afterwards! If you can post something to that effect as an answer, I can accept it. – Energya Sep 30 '20 at 19:43

1 Answers1

1

You have suspicious binaries in the /etc/grub.d/ subdirectory, especially the grubcfg_proxy.

This file is a part of the grub-customizer package.

So you have to try to call GRUB Customizer to fix the issue by its own.

And then resume package upgrade.

N0rbert
  • 99,918