Unable to install all updates due to one program's unmet dependacies

I haven't touched my Ubuntu Mate machine in about 6 months. When I dust it off I find it has an update list a mile long. But it will not let me install them because one program "cqrlog" has unmet dependencies. sudo apt-get upgrade returns:

...
Errors were encountered while processing:
 /tmp/apt-dpkg-install-fhTCNR/00-cqrlog_2.4.0-3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I do not need the program anymore however sudo apt-get purge cqrlog and sudo apt-get purge cqrlog-data both return


    dpkg: error processing package cqrlog (--remove):
     package is in a very bad inconsistent state; you should
     reinstall it before attempting a removal
    dpkg: too many errors, stopping
    Errors were encountered while processing:
     cqrlog
    Processing was halted because there were too many errors.
    E: Sub-process /usr/bin/dpkg returned an error code (1)

I then tried sudo apt-get reinstall cqrlog which returned:


    ...
    dpkg: warning: old cqrlog package post-removal script subprocess returned error exit status 1
    dpkg: trying script from the new package instead ...
    dpkg: error processing archive /var/cache/apt/archives/cqrlog_2.4.0-3_amd64.deb (--unpack):
     new cqrlog package post-removal script subprocess returned error exit status 1
    dpkg: error while cleaning up:
     new cqrlog package post-removal script subprocess returned error exit status 1
    Errors were encountered while processing:
     /var/cache/apt/archives/cqrlog_2.4.0-3_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

so any help you could give before I give up and distro hop again would be appreciated. Thanks.


Solution 1:

In such a situation, you should ask APT for low-level package removal using

sudo dpkg --purge --force-all cqrlog-data
sudo dpkg --purge --force-all cqrlog

Then check for new software lists, install all updates by

sudo apt-get update # add any error output to the question
sudo apt-get dist-upgrade
sudo apt-get install -f
sudo dpkg --configure -a

and continue to use the system.