Unable to install or upgrade after an upgrade to 16.04 with gcc-doc error [duplicate]

Solution 1:

I had the same problem here. Then after googling, I found solution (i hope) on How to fix "Package is in a very bad inconsistent state" error?

Run:

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