修复半安装包

我在使用sudo apt-get upgrade时遇到错误:

 dpkg: error processing libgfortran3:amd64 (--configure): package libgfortran3:amd64 is not ready for configuration cannot configure (current status `half-installed') Errors were encountered while processing: libgfortran3:amd64 E: Sub-process /usr/bin/dpkg returned an error code (1) 

它似乎没有阻止安装/升级其他应用程序。 我相信这个问题是由于在升级应用程序时直接关闭我的PC而引起的。

我怎样才能解决这个问题?

 sudo dpkg --remove --force-remove-reinstreq --dry-run libgfortran3:amd64 

那只是一场干涸。 我不确定删除libgfortran3将采取什么,但运行它,看看。 假设它不会吞噬整个系统,在没有--dry-run情况下再次运行它然后你可以sudo apt-get install ...你需要的软件包。

对于半安装包错误,–reinstall为我工作:

 sudo apt-get install --reinstall packagename 
 sudo apt install --reinstall packagename 

这就像魅力一样。 它解决了我几个月来一直遇到的问题。 我的情况是包libmysqlcppconn7v5

我所做的只是运行sudo apt install --reinstall libmysqlcppconn7v5

如果要通过GUI修复此问题,可以使用synaptic。 Synaptic是一个优秀的包管理工具,曾经包含在旧版本的ubuntu中。 要安装它:

 sudo apt-get install synaptic 

点击修复损坏的包裹。

我用包kibana得到了同样的“半安装包”问题。 我收到以下错误:

 dpkg: error processing kibana (--configure): package kibana is not ready for configuration cannot configure (current status 'half-installed') Errors were encountered while processing: kibana E: Sub-process /usr/bin/dpkg returned an error code (1) 

如果有人仍然面临这种问题,那么你可以试试这个:

 sudo rm /var/lib/dpkg/info/kibana* cd /var/cache/apt/archives sudo rm kibana* apt-get --reinstall install kibana 

这对我有用。 您只需要用半安装的包名替换“kibana”一词。

这应该可以解决您的问题,而无需重新安装包。

 sudo dpkg --force-remove-reinstreq --remove  

其次是: sudo apt-get update