Bug#1087031: deb-systemd-helper is-enabled returns wrong result if dependent services are disabled
Luca Boccassi
bluca at debian.org
Fri Nov 8 19:29:22 GMT 2024
Control: tags -1 moreinfo
On Fri, 8 Nov 2024 12:40:55 +0100 Marco Schmidt
<marco.schmidt at gmail.com> wrote:
> 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!
In which package's maintainer script is this a problem?
More information about the Pkg-systemd-maintainers
mailing list