今天用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 状态的包就没有了.