Bug#1087031: deb-systemd-helper is-enabled returns wrong result if dependent services are disabled
Marco Schmidt
marco.schmidt at gmail.com
Fri Nov 8 11:40:55 GMT 2024
Package: init-system-helpers
Version: master branch
Hello,
Using "deb-systemd-helper is-enabled xxx.servce" answers "disabled"
even if the service is enabled.
To check if a service is enabled, the script gets all (closure)
dependent services (via Wantedby, RequiredBy, Also, Alias, ...) and
checks if the filesystem link is found in
/etc/systemd/system/xxx.wants.
Unfortunately this does not work, if a dependent (also) service is not
enabled. I know, it is strange to have dependent services not enabled.
In systemd there are several dependencies with different meanings.
https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html
Especially the "Also" option is going only in one directrection. If
the service containing the "Also" is enabled, the services under
"Also" are enabled, too. But not the other way around. The services
under "Also" are not needed.
Example:
I saw this with "systemd-networkd.service", which contains
"Also=systemd-network-generator.service" and this contains
"WantedBy=sysinit.target".
The "deb-systemd-helper" script checks if
"systemd-network-generator.service" is in
"etc/systemd/system/sysinit.target.wants/" which is not the case,
because "systemd-network-generator" is not enabled.
The "systemctl is-enabled systemd-networkd.service" returns "enabled"
as expected.
Of course "systemd-network-generator" can be enabled, but it is not
needed to have "systemd-networkd.service".
Thanks for taking the time to think about this!
Greetings ...
Marco
More information about the Pkg-systemd-maintainers
mailing list