命令模板:

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

清理Docker示例:

sudo mv /var/lib/dpkg/info/docker.* /tmp/
sudo dpkg --remove --force-remove-reinstreq docker.io
sudo apt-get remove docker docker-ce docker.io containerd.io
sudo apt-get autoremove && sudo apt-get autoclean

参考链接:

https://askubuntu.com/questions/148715/how-to-fix-package-is-in-a-very-bad-inconsistent-state-error/510887#510887

https://github.com/docker/for-linux/issues/52#issuecomment-333563492