[systemd-devel] Q: Wants and WantedBy links in generated units and circular dependencies

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Thu May 23 08:56:03 UTC 2019


After seeing that systemd generators are run as the very first step in
systemd's life (deduced from the timestamps), I quit the idea of using them,
and started to use another sort of generator:

I have a generator target, that creates another target and a few service
The interesting point is circular dependencies for the generated units, and
I'd like to ask if the following would work:

I need to enable a generated target to get ist wants-links installed; likewise
the generated service units need to be enabled to get the wants link from the
target to the service.
As my generator created the service units first, then the target unit which
"Wants" the service units.
The idea is that starting the soingle target unit will start all depending
service units.

So far that is without enabling. I wonder whether I can enable the service
units that are "WantedBy" the target unit _before_ the target unit was actually
If that doesn't work, I'll need a two-pass approach.

For history, one of the odd things in systemd v228 is this:
 # systemctl status iotwatch.target
● iotwatch.target
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
# systemctl enable iotwatch.target   ### thios command must do something
# systemctl status iotwatch.target
● iotwatch.target - iotwatch I/O performance monitor
   Loaded: loaded (/run/systemd/system/iotwatch.target; enabled; vendor
preset: disabled)
   Active: inactive (dead)
     Docs: man:iotwatch at .service(8)

So it seems I must enable units just to be able to query whether they are


More information about the systemd-devel mailing list