How to fix broken synaptic updates: "Package is in a very bad inconsistent state"

Solution 1:

None of the other answers worked for me on Maverick.

In my case, I found this worked:

sudo rm /var/lib/dpkg/info/flashplugin-nonfree.prerm

sudo dpkg --remove --force-remove-reinstreq flashplugin-nonfree

(replacing "flashplugin-nonfree" with the name of the broken package, and replacing "prerm" with the type of script that failed - in my case it was "postrm", the post-removal script.)

And they say Ubuntu is easy to use!! grumble grumble

Solution 2:

I had the exact same issue with a mysql install. You need to purge the packge. Simply removing a package does not remove the config files that came with it.

Also, I'm going to refer to mysql-server-5.0, but realize that there's a wrapper package mysql-server that always points to the latest version. i.e. if you ask to install mysql-server, apt-get should tell you that it depends on mysql-server-5.0 and install both. If you have the mysql-server package on the system, you should make sure that's gone too before you attempt to reinstall.

  • Make sure the mysql server (mysqld) isn't running. If it is, bring it down:

    sudo /etc/init.d/mysqld stop

  • Check if any packages depend on mysql-server-5.0:

    sudo apt-cache rdepends mysql-server-5.0

    If they do, you'll need to use the --force option to uninstall.

  • Purge the package (include the --force option, depending on #2)

    sudo apt-get --purge remove --force mysql-server-5.0

  • Make sure the installer files are also cleared by running

    sudo apt-get autoclean
    sudo apt-get autoremove

  • Install the server package again

    sudo apt-get install mysql-server-5.0

This should hopefully fix your problem. However, the package might still be broken, if you made any changes to files that came from the mysql-common package.

mysql-common is the base package used by both client and server components. If things aren't working still, try re-installing this package. There will definitely be packages that depend on this; check using #2 above. Purge mysql-server before reinstalling mysql-common. Also, do not forget to reinstall mysql-common, else your system will be very broken.

Solution 3:

You might want to give aptitude a try, which has better handling of dependencies:

sudo aptitude remove mysql-server-5.0

Solution 4:

I had this problem with mailman. Deleted /etc/init.d/mailman with

rm /etc/init.d/mailman

fixed it :)