Ubuntu – Dpkg install of dkms module doesn’t fail even though make does


I have a dkms module packaged as a .deb, via dkms mkdeb foo-mod-dkms/<ver> --source-only. This is being installed on the target system, as part of a build.

  • Looking at dpkg.log, it shows that the package has successfully installed.
  • dpkg -l | grep dkms shows that the package is installed.

However. It's not actually installed.

  • If I manually dpkg purge foo-mod-dkms, then dpkg -i foo-mod-dkms, I can see that the make is failing.

Leaving aside the reason that it is failing (it's because $kernelver evaluates to the wrong thing when running in the preseed environment, I've hacked dkms.conf so that it also fails when I run it manually), I'd like to find out a way to ensure that dpkg -i (or apt-get install) will actually fail when the dkms make step fails? I've read the documentation on both dkms and dpkg, and cannot find any command line flags etc. that I could pass that would ensure that a failure of the dkms make will force dpkg to fail.