summaryrefslogtreecommitdiff
path: root/systemd/cloud-init.service.tmpl
diff options
context:
space:
mode:
authorParide Legovini <paride.legovini@canonical.com>2020-08-27 19:16:13 +0200
committerGitHub <noreply@github.com>2020-08-27 13:16:13 -0400
commit20fe9da98ed69187faab80810c652fdc051b627e (patch)
treeacf865f8e4b786f7d066c8316415314461e2cf88 /systemd/cloud-init.service.tmpl
parent1f3a225af78dbfbff75c3faad28a5dc8cad0d1e3 (diff)
downloadvyos-cloud-init-20fe9da98ed69187faab80810c652fdc051b627e.tar.gz
vyos-cloud-init-20fe9da98ed69187faab80810c652fdc051b627e.zip
systemd: add Before=shutdown.target when Conflicts=shutdown.target is used (#546)
Lintian spotted the following issue: The specified systemd .service file contains both DefaultDependencies=no and Conflicts=shutdown.target directives without Before=shutdown.target. This can lead to problems during shutdown because the service may linger until the very end of shutdown sequence as nothing requests to stop it before (due to DefaultDependencies=no). There is race condition between stopping units and systemd getting a request to exit the main loop, so it may proceed with shutdown before all pending stop jobs have been processed. Please add Before=shutdown.target. [1] https://lintian.debian.org/tags/systemd-service-file-shutdown-problems.html Co-authored-by: Rick Harding <rharding@mitechie.com>
Diffstat (limited to 'systemd/cloud-init.service.tmpl')
-rw-r--r--systemd/cloud-init.service.tmpl2
1 files changed, 2 insertions, 0 deletions
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
index af6d9a8b..f140344d 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -25,9 +25,11 @@ Before=sshd-keygen.service
Before=sshd.service
{% if variant in ["ubuntu", "unknown", "debian"] %}
Before=sysinit.target
+Before=shutdown.target
Conflicts=shutdown.target
{% endif %}
{% if variant in ["suse"] %}
+Before=shutdown.target
Conflicts=shutdown.target
{% endif %}
Before=systemd-user-sessions.service