Systemd programming part 2: activation and language issues
Systemd programming part 2: activation and language issues
Posted Feb 11, 2014 1:51 UTC (Tue) by neilbrown (subscriber, #359)In reply to: Systemd programming part 2: activation and language issues by zuki
Parent article: Systemd programming part 2: activation and language issues
Clearly that section could have been clearer - it was even less clear before the lwn editorial team helped out.
The context was intended to imply that "systemctl enable nfs" was being run with "nfs" as a SysVinit script (/etc/init.d/nfs), which is how nfs is currently started on openSUSE-13.1. systemd can read SysVinit scripts and parse the LSB headers, but there is no way for those headers to have the equivalent of "Require=rpcbind.service". Only the "After=rpcbind.server" bit.
So yes: nfs.service would have those lines, but /etc/init.d/nfs cannot and so the compatibility between systemd and SysVinit is not as great as I originally hoped.
> There are two places where WantedBy/RequiredBy can be used.
"Citation needed". I checked the man pages, read the source code, and performed as simple test and I find that "WantedBy" is only permitted in "Install", never in "Unit".
However ... the internal implementation details of systemd involves creating reflections of some (or maybe all) relationships. When one unit "Wants" another, then the internal representation of the other gets a "WantedBy" annotation referring to the first. Similarly there is "ConsistsOf" which is a reflection of "PartOf". These are internal only and not part of the language. "ConsistsOf" is not permitted anywhere in unit files, and "WantedBy" is only permitted in the [Install] section with the meaning I outline.
I don't agree with your description of how the syslinks in the .wants directory are handled. It is best to understand them as being exactly like drop-in files - they are even handled by code in load-dropin.c. A symlink in the .wants directory is *extemely* similar to a .conf file in the ".d" drop-in directory containing "Wants=foo"
Thanks for your comments.
Posted Feb 11, 2014 21:46 UTC (Tue)
by zuki (subscriber, #41808)
[Link]
> I don't agree with your description of how the syslinks in the .wants
Systemd programming part 2: activation and language issues
> directory are handled. It is best to understand them as being exactly like
> drop-in files - they are even handled by code in load-dropin.c. A symlink
> in the .wants directory is *extemely* similar to a .conf file in the ".d"
> drop-in directory containing "Wants=foo"
I guess I wasn't very clear. You're right that the symlink is very similar and could be replaced by a drop-in. I was trying to underline the fact that you need the symlink (or the equivalent drop-in), because the configuration has to become a part of the "wanting" unit, even if is installed together with the "wanted" unit. No disagreement, just a different vantage point.
