升级到 16.04 后无法安装或升级,出现 gcc-doc 错误

升级到 16.04 后无法安装或升级,出现 gcc-doc 错误

我对 Ubuntu 还比较陌生。几天前,我从 14.04 升级到了 16.04。升级后,我既不能安装新软件,也不能升级操作系统。当我输入

 sudo apt-get upgrade

我得到这是我的输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apt apt-transport-https apt-utils gcc-doc libapt-inst2.0 libapt-pkg5.0 
6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 2.011 kB/2.014 kB of archives.
After this operation, 6.144 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 libapt-pkg5.0 amd64 1.2.12~ubuntu16.04.1 [696 kB]
Get:2 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 libapt-inst2.0 amd64 1.2.12~ubuntu16.04.1 [55,4 kB]
Get:3 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 apt amd64 1.2.12~ubuntu16.04.1 [1.038 kB]
Get:4 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 apt-utils amd64 1.2.12~ubuntu16.04.1 [196 kB]
Get:5 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 apt-transport-https amd64 1.2.12~ubuntu16.04.1 [25,7 kB]
Fetched 2.011 kB in 2s (859 kB/s)         
(Reading database ... 325999 files and directories currently installed.)
Preparing to unpack .../gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb ...
install-info: No dir file specified; try --help for more information.
dpkg: warning: subprocess old pre-removal script returned error exit         status 1
dpkg: trying script from the new package instead ...
dpkg: error processing archive /var/cache/apt/archives/gcc-    doc_4%3a5.3.1-1ubuntu1_amd64.deb (--unpack):
 there is no script in the new version of the package - giving up
install-info: No dir file specified; try --help for more information.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit     status 1
Preparing to unpack .../libapt-pkg5.0_1.2.12~ubuntu16.04.1_amd64.deb     ...
Unpacking libapt-pkg5.0:amd64 (1.2.12~ubuntu16.04.1) over     (1.2.10ubuntu1)     ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Errors were encountered while processing:
 /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

使用下面的错误代码,我在 AskUbuntu 中搜索解决方案,但找不到有效的解决方案。

 Errors were encountered while processing:
 /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb
 E: Sub-process /usr/bin/dpkg returned an error code (1)

我在软件中心有 gcc-doc 等待升级。当我尝试在软件中心升级它时,它花了很长时间,并且没有升级。在 Synaptics 中,它因 gcc-doc 而停止升级。

非常感谢您的帮助。

答案1

我在这里遇到了同样的问题。然后经过谷歌搜索,我找到了解决方案(我希望如此)如何修复“包处于非常糟糕的不一致状态”错误?

跑步:

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

相关内容