软件包安装、删除出错的终极解决方法

注意:你应该先去寻找其他解决方法,无效再来尝试本方法!!

本方法适用于任何软件包安装,删除时报告的类似于:“post-xxxxx失败”,以及其他错误。


---------言归正传---------

原理:dpkg之所以能够对每个包的状态了如指掌,完全是因为dpkg数据库--->>/var/lib/dpkg/status
这个文本文件中记录了软件仓库中曾经安装过的软件包的安装状态。
所以,只需要改动这个文件就能够改变软件包的状态。

软件包的状态:

引用:
1、not-installed
The package is not installed on your system.
2、config-files
Only the configuration files of the package exist on the system.
3、half-installed
The installation of the package has been started, but not com-
pleted for some reason.
4、unpacked
The package is unpacked, but not configured.
5、half-configured
The package is unpacked and configuration has been started, but
not yet completed for some reason.
6、 triggers-awaited
The package awaits trigger processing by another package.
7、 triggers-pending
The package has been triggered.
8、 installed
The package is unpacked and configured OK.


以上请详细参考man dpkg
根据以上状态:half-installed和half-configured是常见的错误状态,不完全配置,或者不完全安装。

还需要注意的是:
软件包还有一个选择状态:

引用:
1、install
The package is selected for installation.
2、deinstall
The package is selected for deinstallation (i.e. we want to
remove all files, except configuration files).
3、purge The package is selected to be purged (i.e. we want to remove
everything, even configuration files).



最后组合起来的错误状态大概就有6种,安装、删除出错都会将软件包的状态标记成其中之一!
它们的状态都要被修改成:install ok installed ; deinstall ok not-installed或purge ok not-installed。

最后需要注意的是:
软件包除了处在not-install 的状态,其余状态都是有完整的描述的。
要将错误状态修改成installed状态,需要查看一下软件包的描述是否有。(这个一般是有的)
要将错误状态修改成not-install状态,需要删除软件包的描述,删除Section行下面的全部。(不要把别人的删掉)

例子:

引用:
Package: libexempi3
Status: purge ok half-installed
Priority: optional
Section: libs
Installed-Size: 748
Maintainer: Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Source: exempi
Version: 2.0.2-2
Depends: libc6 (>= 2.4), libexpat1 (>= 1.95.8), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.2.1)
Description: library to parse XMP metadata (Library)
Exempi is a library to parse XMP metadata as defined by the
specification.
.
XMP (Extensible Metadata Platform) facilitates embedding metadata in files
using a subset of RDF. Most notably XMP supports embedding metadata in PDF
and many image formats, though it is designed to support nearly any file type.
Original-Maintainer: Asheesh Laroia <asheesh@asheesh.org>
Homepage: http://libopenraw.freedesktop.org/wiki/Exempi


显然这个状态是有错误的。只要修改成:

引用:
Package: libexempi3
Status: purge ok not-installed
Priority: optional
Section: libs


这个软件包的状态就修改好了,不会再报错了。

好了,写了这么多了,最后一个警告:编辑这个文件之前记得备份!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值