dpkg Errors were encountered while process...


今天用apt-get 删除一个包时遇到了错误, dpkg 也删除不了.

$ sudo apt-get purge wireshark-common
提示错误:  
忘了什么了, 大意是说wireshark 应该是什么,它不是什么,
blablabla ... 总之是它处理不了了, 大概是我动过什么了.
Errors were encountered while processing ....
subprocess post-removal script returned error exit status...
$dpkg -P wireshark-common
提示错误: 同上
dpkg -l 显示的是'pc' 状态.

工具不行了,只能手工进行了. 网上也搜了几下, 还是我的简单靠谱!
解决办法:
$sudo updatedb
$locate wireshark
找到的项全部删除(一看就知道无用),
对于/var/lib/info/ 下有两项,不用客气,删...!, 量它也起不了什么尘土!
再一次: $dpkg -P wireshark-common 成功!
$dpkg -l |grep wireshark  世界恢复正常!



------------------------------------------------------------
补充知识:
------------------------------------------------------------
查询依赖关系:
apt-cache depends proj
查询反向依赖关系:
apt-cache rdepends proj
查询安装包deb中的依赖关系

dpkg-deb --info <deb package>|grep Depends

查询安装包deb中的内容
dpkg-deb --contents  <deb package>
------------------------------------------------------------
What do the various dpkg flags like 'ii' 'rc' mean?
------------------------------------------------------------

The first letter displays what is the expected status of the package.
The second letter displays what is the current status of the package.

So for example:

ii means 'It should be installed and it is installed' whereas
rc means 'It's removed/uninstalled but it's configuration files are still there'

------------------------------------------------------------
删除查到的无用的配置信息(包已经删除,但配置信息还保留着).
------------------------------------------------------------

 

dpkg -l | grep ^rc | cut -d' ' -f3 | sudo xargs dpkg --purge

 

只所以用-f3, 是因为rc后面跟了2个空格, cut 指令只cut掉一个空格,后面那个空格作为-f2, 名称就是-f3了.

或者

$ dpkg -l |grep ^rc |awk '{print $2}'|sudo xargs dpkg --purge

awk 的域分割考虑了连续的分割字符,显得比较人性化!


这样 rc 状态的包就没有了.
 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值