32

Is there a standard procedure to 'unit test' an Ubuntu system against the deb packages?

Assume, a system has ubuntu-desktop installed according to the package manager. Can I find out, whether the file system has all the files in ubuntu-desktop and dependencies?

related question: Find packages with corrupted files

David Foerster
  • 36,264
  • 56
  • 94
  • 147
Jan
  • 3,598

1 Answers1

32

For the most part, deb packages come with a md5 file containing signatures of all files in the package. These files are located at /var/lib/dpkg/info/$pkg.md5sums.

To simplify the periodic check of all installed packages, the debsums package can be of help. Install it, clean the cache with:

sudo apt-get clean

then run sudo debsums_init to generate md5 sums for packages that do not provide them (the packages are downloaded to generate such sums).

Next, edit the file /etc/default/debsums and set CRON_CHECK=weekly to configure a cron weekly job for the check of debsums.

You can run the check manually with the command:

sudo debsums -cs

Regarding the integrity of the dependencies, I suppose that the command:

sudo apt-get -f install

should signal and try to resolve any problem it finds relative to installed packages, but the Debian/Ubuntu package management system is a very complex object, and could be very difficult to find and resolve its problems.

slm
  • 3,035
enzotib
  • 93,831
  • 1
    If sudo debsums -cs says nothing, does it mean that everything alright ? – R S Dec 04 '18 at 05:48
  • sudo apt-get -f install gives "post-installation script subprocess returned error" about. "[some file] not found". What to do? – Mark Jeronimus Feb 13 '19 at 08:23
  • if there is an error, reinstall the package: dpkg --search /some/fqpn/some.file; apt-get --reinstall install package; – rjt Jul 26 '19 at 00:10