sudo apt-get update; sudo apt-get upgrade; sudo apt-get autoremove;
Then, I got the following error.
dpkg: error processing gcc-doc (--remove):
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
All the following attempt didn't work
sudo dpkg --remove --force-remove-reinstreq gcc-doc
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get autoclean
At the end, I did a brute force way.
Find gcc-doc related files in /var/lib/dpkg/info and remove them
find /var/lib/dpkg/info/ -name *gcc-doc* -print | xargs rm
sudo apt-get update; sudo apt-get upgrade;
sudo apt-get install gcc-doc
This worked, but it is now by apt-get/dpkg and has some risk. Please use this with your own risk if you could not find any other solution.