dpkg -V ,输出的含义是什么?

dpkg -V ,输出的含义是什么?

我对所有包运行了 DPKG Verify 并得到了这个输出,但我不知道这意味着什么:

??5?????? c /etc/lightdm/lightdm-gtk-greeter.conf
??5?????? c /etc/default/chromium-browser
??5??????   /usr/local/etc/no-ip2.conf
??5??????   /var/lib/dokuwiki/data/cache/_dummy
??5?????? c /etc/xdg/menus/mate-settings.menu
??5?????? c /etc/apache2/apache2.conf
??5?????? c /etc/apt/apt.conf.d/10periodic
??5?????? c /etc/sysctl.conf
??5??????   /var/lib/xine/xine.desktop
??5??????   /boot/vmlinuz-4.4.0-21-generic
??5??????   /usr/lib/python3/dist-packages/cupshelpers/__pycache__/cupshelpers.cpython-35.pyc
??5??????   /usr/lib/python3/dist-packages/cupshelpers/__pycache__/xmldriverprefs.cpython-35.pyc
??5??????   /usr/lib/python3/dist-packages/cupshelpers/__pycache__/config.cpython-35.pyc
??5??????   /usr/lib/python3/dist-packages/cupshelpers/__pycache__/openprinting.cpython-35.pyc
??5??????   /usr/lib/python3/dist-packages/cupshelpers/__pycache__/__init__.cpython-35.pyc
??5??????   /usr/lib/python3/dist-packages/cupshelpers/__pycache__/ppds.cpython-35.pyc
??5??????   /usr/lib/python3/dist-packages/cupshelpers/__pycache__/installdriver.cpython-35.pyc
??5?????? c /etc/xdg/autostart/mate-volume-control-applet.desktop
??5?????? c /etc/libvirt/qemu/networks/default.xml

答案1

dpkg -V或者dpkg --verify通过比较存储在数据库中的元数据和文件路径来检查包的完整性。您可以使用--verify-format选项选择输出格式,但目前仅支持rpm格式。在rpm格式中,仅显示未通过任何检查的路径。

举一个检查失败的例子:

??5?????? c /etc/lightdm/lightdm-gtk-greeter.conf

这里:

  • ?表示检查失败,例如由于权限问题

  • 第三个字符,5表示已通过md5sum()检查

  • c第二列表示选中的属性,目前仅支持conffile( )c

man dpkg

--verify-format 格式名称

设置 --verify 命令的输出格式。

目前唯一支持的输出格式是 rpm,它由每条未通过任何检查的路径组成一行。每行以 9 个字符开头,报告具体的检查结果,'?' 表示无法进行检查(缺乏支持、文件权限等),'.' 表示检查通过,字母数字字符表示特定检查失败;唯一有效的检查是 md5sum 验证,第三个字符表示为 '5'。

该行后面跟着一个空格和一个属性字符(当前对于 conffiles 为“c”),另一个空格和路径名。

答案2

来自dpkg手册页:

  -V, --verify [package-name...]
          Verifies the integrity of package-name or all packages if
          omitted, by comparing information from the files installed by
          a package with the files metadata information stored in the
          dpkg database (since dpkg 1.17.2).  The origin of the files
          metadata information in the database is the binary packages
          themselves. That metadata gets collected at package unpack
          time during the installation process.

          Currently the only functional check performed is an md5sum
          verification of the file contents against the stored value in
          the files database.  It will only get checked if the database
          contains the file md5sum. To check for any missing metadata in
          the database, the --audit command can be used.

          The output format is selectable with the --verify-format
          option, which by default uses the rpm format, but that might
          change in the future, and as such, programs parsing this
          command output should be explicit about the format they
          expect.

“?”表示无法进行检查,很可能是由于缺乏支持或文件权限。“c”表示正在对配置文件进行检查。

相关内容