Score:1

Deb package trigger loops

it flag

I'm having a recurrent issue with custom .deb packages and their triggers. We have made some "meta packets" for our deploys to force & check some configurations. The idea is to keep many servers with the "same" config without needing to check manually on each update. Let's call them as an example: grafana-conf and elasticsearch-conf.

In order to execute the reconfiguration scripts when the "child package" get updated we use the following triggers.

  • grafana-conf triggers:
interest /usr/share/grafana
interest grafana-reconfigure

  • elasticsearch-conf triggers:
interest /usr/share/elasticsearch/bin
interest elastic-reconfigure

From time to time, it just works as expected, but, in some scenarios dpkg says there is a trigger loop. In this case, if elasticsearch and grafana gets updated on the same transaction we get the following messages:

[...]
Processing triggers for ureadahead (0.100.0-21) ...  
Processing triggers for dbus (1.12.16-2ubuntu2.3) ...
Setting up unrelated-package (1.2.1) ...           
dpkg: cycle found while processing triggers:                    
 chain of packages whose triggers are or may be responsible:    
  elasticsearch-conf -> grafana-conf
 packages' pending triggers which are or may be unresolvable:
  grafana-conf: /usr/share/grafana
  elasticsearch-conf: /usr/share/elasticsearch/bin
  initramfs-tools: update-initramfs
dpkg: error processing package grafana-conf (--configure):
 triggers looping, abandoned
dpkg: cycle found while processing triggers:
 chain of packages whose triggers are or may be responsible:
  elasticsearch-conf -> elasticsearch-conf -> elasticsearch-conf
 packages' pending triggers which are or may be unresolvable:
  elasticsearch-conf: /usr/share/elasticsearch/bin
  initramfs-tools: update-initramfs
dpkg: error processing package elasticsearch-conf (--configure):
 triggers looping, abandoned
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
[...]
Errors were encountered while processing:
 grafana-conf
 elasticsearch-conf

We've tested many variations of the triggers but we don't understand what is going wrong there. Reading debian/deb docs says everything should work.

Can somebody help me/us to understand what (probably basic) mistake are we missing? Thanks you in advance!

Ps: The named-trigger grafana-reconfigure is being called on bottom postinst script of grafana-conf. We've tried to remove such call but the loops keep appearing. Of course dpkg-trigger is never called inside "trigger" call. Named-trigger elastic-reconfigure is not being used at all.

Ps2: In some other scenarios I've got a loop such as: grafana-conf -> grafana-conf -> grafana-conf

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.