Manually remove a broken package on Debian/Ubuntu
Sometimes, a Debian or Ubuntu package is not installed correctly or can’t be uninstalled. The system update is so completely broken that conventional commands, whether apt-get, ability ordpkg, not corrects the problem.
For example the package varnish, I faced this issue in Ubuntu 14.04. When I try to remove this package with
sudo apt-get remove varnish
the package manager asks to reinstall it properly :
So, How to uninstall this package? The solution: manually uninstall the package.
mv /var/lib/dpkg/info/varnish.* /tmp/ dpkg --remove --force-remove-reinstreq varnish