On Sat, Jul 26, 2025, at 13:07, Maximilian Bosch wrote: > Now, my plan is to actually contribute a fix for this, but upon starting > I realized, that I need some pointers: > > * This seems like a little bit of a special case: you need bidirectional > dependencies and at least one unit involved needs `BindsTo`. Does it make > sense to add as another paragraph to `systemd.unit(5)`? Is there a > better-suited place for this? Or even a reason that speaks for the > status-quo, i.e. not documenting potential implementation details? > > * Am I on the right track with my observations? As mentioned above, > I noticed today that this is reliably reproducible on an idle VM, but > not on my workstation.
I've struggled with something very similar. I've got PostgreSQL and a number of services which depend on it. I want: * Services to not start until PostgreSQL is available (not just 'start job' queued). * Services to automatically stop before PostgreSQL if a 'stop job' for PostgreSQL is queued. * Services to automatically stop before PostgreSQL, and automatically start after it is available, if a 'restart job' for PostgresSQL is queued and completes. * Services to automatically start after PostgreSQL is available if they were running when a 'stop job' for PostgreSQL completed and then a 'start job' also completes. In essence I want to ensure that the services get restarted if PostgreSQL gets restarted for any reason, including package upgrades. Some of them can tolerate the database restarting themselves, but others cannot, and in any case they can't do anything useful if they are running while the database is unavailable. I don't know of a practical way to construct unit dependencies today which can achieve this.