然后在安装其他软件时就会出现这些错误
Setting up tomcat8 (8.0.32-1ubuntu1.6) ...
cat: /usr/share/tomcat8/defaults.template: No such file or directory
cat: /usr/share/tomcat8/logrotate.template: No such file or directory
chown: cannot access '/etc/tomcat8/policy.d': No such file or directory
dpkg: error processing package tomcat8 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
tomcat8
E: Sub-process /usr/bin/dpkg returned an error code (1)
折腾了半天之后,找到了解决办法
$ sudo mv /var/lib/dpkg/info/ /var/lib/dpkg/info_old/
$ sudo mkdir /var/lib/dpkg/info/
$ sudo apt-get update
...
$ sudo apt-get -f install
...
$ sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old/
$ sudo rm -rf /var/lib/dpkg/info
$ sudo mv /var/lib/dpkg/info_old/ /var/lib/dpkg/info/
输入上述命令之后,执行在 sudo apt-get update 和 sudo apt-get upgrade 就不会有问题了。