Debian Stretch – Fix Update Issues with Buggy Dpkg

aptdebiandpkg

I saw Debian Jessie – dpkg / apt intall, update and uninstall broken and unlike that one, python is well and good herein.

[$] ls -l /usr/bin/python

lrwxrwxrwx 1 root root 9 Jun  3 20:09 /usr/bin/python -> python2.7

There are 3-4 packages which are making updates/upgrades on the system next to impossible.

[$] sudo dpkg --audit cme libconfig-model-perl libconfig-model-dpkg-perl fonts-arphic-uming
The following packages are in a mess due to serious problems during
installation.  They must be reinstalled for them (and any packages
that depend on them) to function properly:
 cme                  Check or edit configuration data with Config::Model
 fonts-arphic-uming   (no description available)
 libconfig-model-dpkg-perl editor for Dpkg source files with validation
 libconfig-model-perl module for describing and editing configuration data

The following packages are missing the list control file in the
database, they need to be reinstalled:
 fonts-arphic-uming   (no description available)

The following packages are missing the md5sums control file in the
database, they need to be reinstalled:
 fonts-arphic-uming   (no description available)

Trying to reinstall the packages via aptitude I get this –

[$] sudo aptitude reinstall cme libconfig-model-perl libconfig-model-dpkg-perl fonts-arphic-uming
                              
The following packages will be REINSTALLED:
  cme fonts-arphic-uming libconfig-model-dpkg-perl libconfig-model-perl 
0 packages upgraded, 0 newly installed, 4 reinstalled, 0 to remove and 29 not upgraded.
E: Can't find a source to download version '2.092-1' of 'libconfig-model-perl:amd64'
After unpacking 0 B will be used.
E: Can't find a source to download version '2.092-1' of 'libconfig-model-perl:amd64'
E: Internal error: couldn't generate list of packages to download

Forgot to share that I had already downloaded the libconfig-model-perl binary package from snapshots.debian.org and tried installing it, got the following –

[$] sudo dpkg -i libconfig-model-perl_2.092-1_all.deb

[sudo] password for shirish: 
D000001: ensure_diversions: new, (re)loading
D000001: ensure_statoverrides: new, (re)loading
(Reading database ... 1205324 files and directories currently installed.)
Preparing to unpack libconfig-model-perl_2.092-1_all.deb ...
D000001: process_archive oldversionstatus=broken due to postinst failure
dpkg-maintscript-helper: error: version '2.075-2~' is not valid
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
dpkg-maintscript-helper: error: version '2.075-2~' is not valid
dpkg: error processing archive libconfig-model-perl_2.092-1_all.deb (--install):
 subprocess new pre-removal script returned error exit status 1
D000001: ensure_diversions: same, skipping
dpkg-maintscript-helper: error: version '2.070-1~' is not valid
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
D000001: ensure_diversions: same, skipping
D000001: cmpversions a='0:2016.03.30' b='0:2016.05.24' r=-2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
Errors were encountered while processing:
 libconfig-model-perl_2.092-1_all.deb

I am nonplussed, can somebody help?

My sources.list –

[$] cat /etc/apt/sources.list

 #### testing #########
deb http://httpredir.debian.org/debian/ testing main contrib non-free
deb-src http://httpredir.debian.org/debian testing main contrib non-free

 #### unstable #########
deb http://httpredir.debian.org/debian unstable main contrib non-free
deb-src http://httpredir.debian.org/debian unstable main contrib 

 #### experimental #########
deb http://httpredir.debian.org/debian experimental main contrib 
deb-src http://httpredir.debian.org/debian experimental main contrib

 ##### Debug packages #######
deb http://debug.mirrors.debian.org/debian-debug/ testing-debug main
deb http://debug.mirrors.debian.org/debian-debug/ unstable-debug main
deb http://debug.mirrors.debian.org/debian-debug/ experimental-debug main

DPkG version –

[$] apt-cache policy dpkg
                 
dpkg:
  Installed: 1.18.14
  Candidate: 1.18.14
  Version table:
     1.18.15 1
          1 http://httpredir.debian.org/debian unstable/main amd64 Packages
 *** 1.18.14 600
        600 http://httpredir.debian.org/debian testing/main amd64 Packages
        100 /var/lib/dpkg/status

On Stephen's advice did the following –

[$] sudo rm /var/lib/dpkg/info/libconfig-model-perl.prerm

and tried to install the old package –

┌─[shirish@debian] - [~] - [5108]
└─[$] sudo dpkg -i libconfig-model-perl_2.092-1_all.deb

D000001: ensure_diversions: new, (re)loading
D000001: ensure_statoverrides: new, (re)loading
(Reading database ... 1205324 files and directories currently installed.)
Preparing to unpack libconfig-model-perl_2.092-1_all.deb ...
D000001: process_archive oldversionstatus=broken due to postinst failure
dpkg-maintscript-helper: error: version '2.070-1~' is not valid
dpkg: error processing archive libconfig-model-perl_2.092-1_all.deb (--install):
 subprocess new pre-installation script returned error exit status 1
D000001: ensure_diversions: same, skipping
dpkg-maintscript-helper: error: version '2.075-2~' is not valid
dpkg: error while cleaning up:
 subprocess new post-removal script returned error exit status 1
D000001: ensure_diversions: same, skipping
D000001: cmpversions a='0:2016.03.30' b='0:2016.05.24' r=-2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
Errors were encountered while processing:
 libconfig-model-perl_2.092-1_all.deb

Any more ideas anybody?

Searching for broken packages shows nothing –

[$] alias aptb 

aptb='aptitude search '\''~b'\'

And the search –

┌─[shirish@debian] - [~] - [5109]
└─[$] aptb
              
┌─[shirish@debian] - [~] - [5110]

This shouldn't happen, right?

I had already turned on dpkg-debug as can be seen –

┌─[shirish@debian] - [~] - [4998]
└─[$] cat /etc/dpkg/dpkg.cfg

# dpkg configuration file
#
# This file can contain default options for dpkg.  All command-line
# options are allowed.  Values can be specified by putting them after
# the option, separated by whitespace and/or an `=' sign.
#
debug=1

# Do not enable debsig-verify by default; since the distribution is not using
# embedded signatures, debsig-verify would reject all packages.
no-debsig

# Log status changes and actions to a file.
log /var/log/dpkg.log

but still did do as Stephen asked –

┌─[shirish@debian] - [~] - [5126]
└─[$] su -
                                 
Password: 

root@debian:~# DPKG_DEBUG=1 dpkg -i libconfig-model-perl_2.092-1_all.deb
dpkg: error: cannot access archive 'libconfig-model-perl_2.092-1_all.deb': No such file or directory

root@debian:~# pwd
/root

root@debian:~# cd /home/shirish

root@debian:/home/shirish# DPKG_DEBUG=1 dpkg -i libconfig-model-perl_2.092-1_all.deb

D000001: ensure_diversions: new, (re)loading
D000001: ensure_statoverrides: new, (re)loading
(Reading database ... 1205324 files and directories currently installed.)
Preparing to unpack libconfig-model-perl_2.092-1_all.deb ...
D000001: process_archive oldversionstatus=broken due to failed removal or installation
dpkg-maintscript-helper: error: version '2.070-1~' is not valid
dpkg: error processing archive libconfig-model-perl_2.092-1_all.deb (--install):
 subprocess new pre-installation script returned error exit status 1
D000001: ensure_diversions: same, skipping
dpkg-maintscript-helper: error: version '2.075-2~' is not valid
dpkg: error while cleaning up:
 subprocess new post-removal script returned error exit status 1
D000001: ensure_diversions: same, skipping
D000001: cmpversions a='0:2016.03.30' b='0:2016.05.24' r=-2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
D000001: cmpversions a='0:1.18.14' b='0:1.16' r=2
Errors were encountered while processing:
 libconfig-model-perl_2.092-1_all.deb

With the old version of dpkg, the packages were able to install and show no issues –

┌─[shirish@debian] - [~] - [5168]
└─[$] sudo dpkg --audit cme libconfig-model-perl libconfig-model-dpkg-perl fonts-arphic-uming
                                        
┌─[shirish@debian] - [~] - [5169]

I am going to keep it open for a day just in case something untoward happens. Meanwhile, I will upgrade everything except dpkg and do that at the very last.

Best Answer

You can try reinstalling from snapshots; you'll find the appropriate version of libconfig-model-perl there:

wget http://snapshot.debian.org/archive/debian/20160924T233848Z/pool/main/libc/libconfig-model-perl/libconfig-model-perl_2.092-1_all.deb
sudo dpkg -i libconfig-model-perl_2.092-1_all.deb

Given the dpkg-maintscript-helper errors you're getting, with a current version of dpkg, there's probably something else badly messed up. To get libconfig-model-perl reinstalled, delete the prerm script and reinstall the package:

sudo rm /var/lib/dpkg/info/libconfig-model-perl.prerm
sudo dpkg -i libconfig-model-perl_2.092-1_all.deb

If that doesn't work, you can try downgrading dpkg itself to version 1.18.10, which is the last version released before the failing version checks were introduced. Once you've done that, try reinstalling libconfig-model-perl yet again — the version checks won't fail, and the maintainer scripts should complete without any other difficulties.

Once that's done, try aptitude reinstall ... again and if necessary, reinstall any other missing package from snapshots.

Related Question