The Linux Page

Verifying the md5sum of Installed Debian or Ubuntu packages

I always wondered why we couldn't just use dpkg to verify that the installed packages have not be tempered with. I know that the feature is hardly safe if the md5's are saved on the same computer, even the same hard drive...

Still, once in a while it's just a manual error that requires me to check that I did do something wrong on my computer.

Under Red Hat the rpm packager offers the -V option: Verify.

Under Debian and thus Ubuntu and other derivatives, the debsums tool has to be installed and used for that purpose.

  sudo apt-get install debsums
  debsums -s <package name>

If you're not too sure which package a file is from, use dpkg -S to find out. For example, /etc/services is part of the netbase package. Some files, however, are created on installation. dpkg -S /etc/passwd says that /etc/passwd is not found.

The -s option (silent) to debsums prevents debsums to print out one line per file installed from that package. That way you only get errors.

It is sad that there isn't such a test in the dpkg audit command line option. The audit only checks dependency coherency (which is an important matter, but it could be better.)