There are two suggested configuration options to install post-install hooks into Debian's apt/dpkg system: DPkg::post-invoke(1) and DPkg::post-invoke-success(2).

For me, only post-invoke seems to work and I could not find any documentation about post-invoke-success. Can someone enlighten me about differences, if they exist, and maybe which alternative should be used?


There are three different hooks called Post-Invoke or Post-Invoke-Success, all managed by the apt tools:

  • DPkg::Post-Invoke, which is invoked after every execution of dpkg (by an apt tool, not manually);
  • APT::Update::Post-Invoke-Success, which is invoked after successful updates (i.e. package information updates, not upgrades);
  • APT::Update::Post-Invoke, which is invoked after updates, successful or otherwise (after the previous hook in the former case).

These are handled respectively in apt-pkg/deb/dpkgpm.cc, line 1509 and apt-pkg/update.cc, lines 111 and 114. There is no DPkg::Post-Invoke-Success hook that I can find.

If you want to add a hook to all dpkg invocations, you should look at the post-invoke hook in /etc/dpkg/dpkg.cfg, which is equivalent to DPkg::Post-Invoke above but is applied in all cases, not just apt-based executions of dpkg. To see examples of all the apt configuration options, look at /usr/share/doc/apt/examples/configure-index.gz.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.