[Install] for static systemd unit file?

Patrick Schleizer patrick-mailinglists at whonix.org
Wed Mar 1 20:35:00 GMT 2017


Hi!

TLDR:

How should the [Install] section for static systemd unit file look like?

Long:

Getting a lintian warning if using [Install] section.

I: qubes-whonix: systemd-service-file-missing-install-key
lib/systemd/system/qubes-whonix-redirect-9050.service
N:
N:    The systemd service file does not contain a WantedBy= or
RequiredBy= key
N:    in its [Install] section.
N:
N:    Forgetting to add such a line (e.g. WantedBy=multi-user.target)
results
N:    in the service file not being started by default.
N:
N:    Refer to the systemd.unit(5) manual page for details.
N:
N:    Severity: normal, Certainty: wild-guess
N:
N:    Check: systemd, Type: binary

Should it be considered a lintian false positive?

Or do you suggest something like
[Install]
WantedBy=none.target
?

How to get rid of that output? (It will certainly generate a usability
issue, users being concerned about this.)

Setting up qubes-whonix (1:6.6-1) ...
qubes-whonix-redirect-9050.service is a disabled or a static unit, not
starting it.

In this case, I guess the systemd unit service file related to the
systemd unit socket file rightfully should not get a [Install] section
since the server gets started by systemd socket activation and has no
reason to be pulled in my a target such as multi-user.target.

"WantedBy=multi-user.target" even generates noise in journal, since no
socket was passed, systemd-socket-proxyd exiting non-zero and systemd
regarding the service as failed.

Example:

/lib/systemd/system/qubes-whonix-redirect-9050.socket
##########
[Unit]
Description=redirect 9050 to Whonix-Gateway in Qubes TemplateVM socket
Documentation=https://github.com/Whonix/qubes-whonix
ConditionPathExists=/var/run/qubes/this-is-templatevm
After=qubes-sysinit.service

[Socket]
ListenStream=127.0.0.1:9050

[Install]
WantedBy=sockets.target
##########

/lib/systemd/system/qubes-whonix-redirect-9050.service
##########
[Unit]
Description=redirect 9050 to Whonix-Gateway in Qubes TemplateVM service
Documentation=https://github.com/Whonix/qubes-whonix
ConditionPathExists=/var/run/qubes/this-is-templatevm
After=qubes-sysinit.service
After=qubes-whonix-redirect-9050.socket

[Service]
ExecStart=/lib/systemd/systemd-socket-proxyd 10.152.152.10:9050
PrivateTmp=yes

[Install]
## Fix lintian warning.
## qubes-whonix: systemd-service-file-missing-install-key
lib/systemd/system/qubes-whonix-redirect-9050.service
WantedBy=none.target
##########

Best regards,
Patrick




More information about the Pkg-systemd-maintainers mailing list