tony@tony:~/doc/dpkg$ dpkg-deb -I nano_1.3.10-2_i386.deb
new debian package, version 2.0.
size 477372 bytes: control archive= 2656 bytes.
12 bytes, 1 lines conffiles
714 bytes, 18 lines control
3529 bytes, 51 lines md5sums
613 bytes, 21 lines * postinst #!/bin/sh
160 bytes, 5 lines * postrm #!/bin/sh
379 bytes, 20 lines * preinst #!/bin/sh
288 bytes, 14 lines * prerm #!/bin/sh
Package: nano
Version: 1.3.10-2
Section: editors
Priority: important
Architecture: i386
Depends: libc6 (>= 2.3.5-1), libncursesw5 (>= 5.4-5)
Suggests: spell
Conflicts: nano-tiny (<= 1.0.0-1), pico
Replaces: pico
Provides: editor
Installed-Size: 1108
Maintainer: Jordi Mallach
Description: free Pico clone with some new features
GNU nano is a free replacement for Pico, the default Pine editor. Pine is
copyrighted under a restrictive licence, that makes it unsuitable for
Debian's main section. GNU nano is an effort to provide a Pico-like
editor, but also includes some features that were missing in the original,
such as 'search and replace', 'goto line' or internationalization support.
$ dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-===========-================-========================================
ii aalib1 1.4p5-28 ascii art library - transitional package
ii adduser 3.85 Add and remove users and groups
ii alien .63 install non-native packages with dpkg
... ...
* 第一字符为期望值,它包括:
o u 状态未知,这意味着软件包未安装,并且用户也未发出安装请求.
o i 用户请求安装软件包.
o r 用户请求卸载软件包.
o p 用户请求清除软件包.
o h 用户请求保持软件包版本锁定.
* 第二列,是软件包的当前状态.此列包括软件包的六种状态.
o n 软件包未安装.
o i 软件包安装并完成配置.
o c 软件包以前安装过,现在删除了,但是它的配置文件还留在系统中.
o u 软件包被解包,但还未配置.
o f 试图配置软件包,但是失败了.
o h 软件包安装,但是但是没有成功.
* 第三列标识错误状态,可以总结为四种状态. 第一种状态标识没有问题,为空. 其它三种符号则标识相应问题.
o h 软件包被强制保持,因为有其它软件包依赖需求,无法升级.
o r 软件包被破坏,可能需要重新安装才能正常使用(包括删除).
o x 软包件被破坏,并且被强制保持.
也可以以统配符模式进行模糊查询, 比如我要查找以nano字符开始的所有软件包:
$ dpkg -l nano*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii nano 1.3.10-2 free Pico clone with some new features
pn nano-tiny (no description available)
un nanoblogger (no description available)
这种错误一定要作为严重问题向错误跟踪系统提交报告.象这种脚本的问题,自己对其进行调试, 以判断问题所在, 比如您可以简单的在脚本的第一行以后插入 set -x, 对其运行情况进行跟踪.除非必要, 您也应该拒绝使用这类软件包.
处理卸载过程中损坏的控制文件
当软件包的卸载脚本出现问题时.即使您可以强制删除控制脚本没有清除干净的文件,这也会妨碍dpkg正确的维护您的系统,从而有可能在系统中留下垃圾文件.对于这类问题, 还没有太好的处理方法(强烈建议您提交错误报告), 唯有等待软件更新(或自行对软件包包修复). 然后借助更新包将相关文件卸载.
9. dpkg vs rpm
* 列出系统中安装的软件包
o rpm -qa
o dpkg --list
* 列出软件包信息
o rpm -qi pkgname
o dpkg --status pkgname
* 列出一个包所安装的文件
o rpm -ql pkgname
o dpkg --listfiles pkgname
* 列出本地包文件的信息
o rpm -qpi file.rpm
o dpkg --info file.deb
* 列出本地包文件所含文件
o rpm -qpl file.rpm
o dpkg --contents file.deb
* 安装本地包
o rpm -i file.rpm
o dpkg --install file.deb
* 从系统中清除包
o rpm -E pkgname
o dpkg --purge pkgname
* 查询文件归属
o rpm -qf file
o dpkg --search file