[systemd-devel] Passive vs Active targets

Thomas HUMMEL thomas.hummel at pasteur.fr
Mon Jan 31 19:13:24 UTC 2022


Hello,

I'm successully using systemd with some non trivial (for me!) unit 
dependencies including some performing:

   custom local disk formatting and mounting at boot
   additionnal nics configuration by running postscripts fetched from 
the network
   Infiniband initialisation
   NFS remote mounts
   Infiniband remote mounts
   HPC scheduler and its side services activation

and I've read 
https://www.freedesktop.org/software/systemd/man/systemd.special.html

Still I do not fully (or at all ?) understand the concept of passive vs 
active targets and some related points:

The link above states :

"Note specifically that these passive target units are generally not 
pulled in by the consumer of a service, but by the provider of the 
service. This means: a consuming service should order itself after these 
targets (as appropriate), but not pull it in. A providing service should 
order itself before these targets (as appropriate) and pull it in (via a 
Wants= type dependency)."

nd also :

"Note that these passive units cannot be started manually, i.e. 
"systemctl start time-sync.target" will fail with an error. They can 
only be pulled in by dependency."

Since my first look at a passive dependency was network.target which I 
indeed saw was pulled in by NetworkManager.service which ordered itself 
Before it and which I compared with the active network-online.target 
which pulls in the NetworkManager-wait-online.service I first deduced 
the following:

a) a passive target "does" nothing and serves only as an ordering checkpoint
b) an active target "does" actually something

I thought that a passive target could be seen as "published" by the 
corresponding provider
But this does not seems as simple as that:

For one I see on my system that rsyslog.service also pulls in 
network.target (but orders itself After it and thus does not seeems to 
be the actual "publisher" of it as opposed the NetworkManager.service)

Then rpcbind.target seems to auto pull itself so without the Before 
ordering we see in the NetworkManager.service pulling network.target example

Also, it seems that there are more than one way to pull in a passive 
dependency (or maybe several providers which can "publish" it). Like for 
instance network-pre.target wich is pulled in by both nftables.service 
and/or rdma-ndd.service.

Finally, my understanding is some passive targets are not to be taken 
for granted, i.e. they may not be pulled in at all and it is to the user 
to check it if actually is the case if he want to order a unit againt 
it. I'm not talking here about obvious targets we don't have because out 
of our scope (like not having remote mounts related targets if system is 
purely local) but some we could think we have but maybe not. For 
instance on my system I see remote-fs-pre.target pulled in by 
nfs-client.target but would be remote-fs-pre-target be pulled in (by 
who?) if I had only Infiniband remote mounts ?

So my question would revolve around the above points

Can you help me figuring out the correct way to see those concepts ?

Thanks for your help

--
Thomas HUMMEL



More information about the systemd-devel mailing list