Zend certified PHP/Magento developer

Python update broke apt-listchanges completely breaking apt & dpkg

  • OS: Debian 11
  • OG Python vertion: 3.9

While installing a package, I had a problem with some dependencies being installed by python and so I was foolish enough to update python – an absolutely avoidable procedure, like so:

Download python.tgz > make altinstall > update-alternatives > seemingly working python…`

Here i did update-alternatives casually:

1st attempt: update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1

Then i continue installing the package i really wanted to install and run pip which gave me my first error:

E: Sub-process /usr/bin/apt-listchanges --apt || test $? -ne 10 returned an error code (1)
E: Failure running script /usr/bin/apt-listchanges --apt || test $? -ne 10

After a bit of search i found a few solutions and started with the following:

None of this helped, so I go back and forth on the update-alternatives trying to create a symlink between /usr/local/bin/python <-> /usr/bin/python & /usr/local/bin/pip <-> /usr/bin/pip and a mixture of python3 & pip3 as well. Apologies for being a bit vague here as i don’t remember the exact sequence of the update-alternatives commands.

None of these fixed, so i decided to remove python3.10 by removing the symlink, which didn’t help. Try and create symlink for python3.9, that didn’t work. My python files are still there as i am too afraid to.

Now, i start getting the dpkg errors:

dpkg: error processing package python3 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: error processing package python3 (--configure):
 subprocess installed post-installation script returned error exit status 127
`E: Sub-process /usr/bin/dpkg returned an error code (1)`


```sh
dpkg: error processing package python3 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 python3

Then i tried following methods:

sudo apt install -f
sudo dpkg --configure -a
sudo apt install --reinstall python3

I still have both my pythons 3.9 & 3.10, sudo apt update works – though don’t know how.. upgrade fails, autoremove, clean and such which alvays fails giving the same error as above:

dpkg: error processing package python3 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 python3

A default suggestion has been to delete the offending package, since its python3 i don’t want to delete it because so many packages and heck the OS depends on it and i am scared.

I rebooted after whatever cleaning up i could do and i still have there problems. Another suggest was to re-install OS, which i really really want to avoid.

So, i highly appreciate this to be resolved without me having to re-install the OS.
OS: Debian 11
OG Python vertion: 3.9

While installing a package, I had a problem with some dependencies being installed by python and so I was foolish enough to update python – an absolutely avoidable procedure, like so:

Download python.tgz > make altinstall > update-alternatives > seemingly working python…`

Here i did update-alternatives casually:

1st attempt: update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1

Then i continue installing the package i really wanted to install and run pip which gave me my first error:

E: Sub-process /usr/bin/apt-listchanges --apt || test $? -ne 10 returned an error code (1)
E: Failure running script /usr/bin/apt-listchanges --apt || test $? -ne 10

After a bit of search i found a few solutions and started with the following:

None of this helped, so I go back and forth on the update-alternatives trying to create a symlink between /usr/local/bin/python <-> /usr/bin/python & /usr/local/bin/pip <-> /usr/bin/pip and a mixture of python3 & pip3 as well. Apologies for being a bit vague here as i don’t remember the exact sequence of the update-alternatives commands.

None of these fixed, so i decided to remove python3.10 by removing the symlink, which didn’t help. Try and create symlink for python3.9, that didn’t work. My python files are still there as i am too afraid to.

Now, i start getting the dpkg errors:

dpkg: error processing package python3 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: error processing package python3 (--configure):
 subprocess installed post-installation script returned error exit status 127
E: Sub-process /usr/bin/dpkg returned an error code (1)
dpkg: error processing package python3 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 python3

Then i tried following methods:

sudo apt install -f
sudo dpkg --configure -a
sudo apt install --reinstall python3

I still have both my pythons 3.9 & 3.10, sudo apt update works – though don’t know how.. upgrade fails, autoremove, clean and such which alvays fails giving the same error as above:

dpkg: error processing package python3 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 python3

A default suggestion has been to delete the offending package, since its python3 i don’t want to delete it because so many packages and heck the OS depends on it and i am scared.

I rebooted after whatever cleaning up i could do and i still have there problems. Another suggest was to re-install OS, which i really really want to avoid.

So, i highly appreciate this to be resolved without me having to re-install the OS.

Thank you..