Sometimes I recognized that a Ubuntu or Debian package does not install correctly and can not be uninstalled. The system update is so completely broken that conventional commands, whether apt-get, ability or dpkg, won’t work. For example if you want to remove a package you will get a message like:
Package is in a very bad inconsistent state - you should reinstall it before attempting a removal.
and it is also not possible to reinstall the package. Therefore you have to uninstall the package by hand.
This are the steps I always do to uninstall a package manually:
mv /var/lib/dpkg/info/PACKAGE.* /tmp/ dpkg --remove --force-remove-reinstreq PACKAGE