TransWikia.com

How to fix "Package is in a very bad inconsistent state" error?

Ask Ubuntu Asked by Benjamin Piller on January 18, 2021

I can’t update my system because it freezes while installing a third-party update (zramswap-enabler)!

Sometimes I get the following message in Update manager:

Could not initialize the package information An unresolvable problem occurred while initializing the package information.

Please report this bug against the ‘update-manager’ package and include the following error message:

E:The package zramswap-enabler needs to be reinstalled, but I can't find an archive for it.

I tried to remove the zramswap-enabler, but it’s impossible because I get the following message:

dpkg: error processing zramswap-enabler (--remove):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 zramswap-enabler
E: Sub-process /usr/bin/dpkg returned an error code (1)

Actually I would really reinstall that package, but it is unable to do it! If I remove this third-party PPA then the system is warning me about a very very serious problem.

So why can I not install/reinstall/remove/update this package and why freezes the updater if I try to update?

8 Answers

I used this to fix this same issue:

apt reinstall [package] 

Answered by Zeki on January 18, 2021

The same thing happened to me when I got disconnected from the internet while downloading the wireshark package. After that, when I tried to reinstall it, it threw the same error:

Package is in a very bad inconsistent state

I've tried all the commands to install, purge, remove and reinstall but nothing worked.

After a little bit of googling, I stumbled upon this command:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb

(changed libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb with the package that was creating the problem in the directory /var/cache/apt/archives/).

After running this command all the issues were resolved. I removed the package again using:

sudo apt --purge remove libwireshark8:amd64
sudo apt autoremove to fully remove the package.

Then I installed wireshark again using:

sudo apt-get install wireshark

Everything works smoothly now!

References:

Answered by darkByt3 on January 18, 2021

The other answers are correct to mention a package removal followed by apt-get install -f to reinstall the broken package (and fully install other half-installed packages). However, this can be done in one step:

sudo apt-get install -f --reinstall zramswap-enabler

Answered by David Foerster on January 18, 2021

I had similar problem with quagga, the routing daemon. Just reinstaling the package worked for me:

# apt-get install -f  
<some output ommited>
dpkg: warning: overriding problem because --force enabled:
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.

wget http://security.debian.org/debian-security/pool/updates/main/q/quagga/quagga_0.99.22.4-1+wheezy3_i386.deb
dpkg -i quagga_0.99.22.4-1+wheezy3_i386.deb

Now its ok again:

#apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Answered by locutus on January 18, 2021

i'd try cleaning the status of my installation before resorting to uninstalling whatever created the problem:

apt-get autoclean
apt-get update
apt-get upgrade
apt-get install -f

much better way to solve this in most cases and in at least one instance had helped me when the other way wouldn't work (because huge dependencies on the package to be removed)

Answered by Dr. Azrael Tod on January 18, 2021

This worked for me after pretty much scouring the whole of AskUbuntu and Ubuntu forums! (Source). I'm running Lubuntu 14.04

sudo mv /var/lib/dpkg/info/<packagename>.* /tmp/
sudo dpkg --remove --force-remove-reinstreq <packagename>
sudo apt-get remove <packagename>
sudo apt-get autoremove && sudo apt-get autoclean

Answered by Hamman Samuel on January 18, 2021

I had a situation worse than this. I had to remove the half-installed packages by forcing dependencies.

sudo dpkg --remove --force-remove-reinstreq --force-depends <package-name>

Then I had to reinstall them

sudo apt-get -f install

That should solve any issue. But please make sure you have network connectivity when you try to do this. Otherwise, you will have to go through even more trouble.

Answered by Sriram Murali on January 18, 2021

Edited out of the question and added as an answer.

  1. Make sure that your PPA is set up.

  2. Remove the broken package via the following command:

    sudo dpkg --remove --force-remove-reinstreq zramswap-enabler
    
  3. Install the package again:

    sudo apt-get install zramswap-enabler
    
  4. After restart (not necessary), you are able to install the updates correctly!

Actually you can fix any "Package is in a very bad inconsistent state” issues with this solution!

Answered by nanofarad on January 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP