summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/systemdgen_test.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-03-09 11:56:44 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-03-09 13:33:09 +0100
commit220f9a71e47d1fff893114a025960c2d9c3c16fb (patch)
tree1b71714061fbf9da6b0067dd5bedad4e0f898a51 /pkg/systemd/generate/systemdgen_test.go
parentf378e82e2d57ee60e5b0f973eb1ea2ee3a760428 (diff)
downloadpodman-220f9a71e47d1fff893114a025960c2d9c3c16fb.tar.gz
podman-220f9a71e47d1fff893114a025960c2d9c3c16fb.tar.bz2
podman-220f9a71e47d1fff893114a025960c2d9c3c16fb.zip
generate systemd: add `default.target` to INSTALL
When enabling a systemd service we can specify which target will start it by specifying it in the `[INSTALL]` section. In case of root, this is commonly set to `multi-user.target` which is used to start other essential system services such as the network manager, D-BUS and more. However, the `multi-user.target` is not enough on all systems, especially when running rootless and enabling user services. Multiple users have reported issues that there isn't even an attempt to start the service. Setting the INSTALL target to `default.target` will fix the rootless case. However, `default.target` may vary among systems. Fedora Workstation, for instance, sets the `default.target` to the graphical target (i.e., runlevel 5) while Fedora Server sets it to `multi-user.target` which is on runlevel 2 and hence way earlier in the startup sequence. As INSTALL allows for specifying multiple INSTALL targets, we can set it to `multi-user.target` to continue supporting existing workloads AND to `default.target` which MAY redundantly attempt to start it at a later point; effectively a NOP for the root case and essential for rootless. Fixes: #5423 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/systemd/generate/systemdgen_test.go')
-rw-r--r--pkg/systemd/generate/systemdgen_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/systemd/generate/systemdgen_test.go b/pkg/systemd/generate/systemdgen_test.go
index 145296ea9..3749d89ce 100644
--- a/pkg/systemd/generate/systemdgen_test.go
+++ b/pkg/systemd/generate/systemdgen_test.go
@@ -52,7 +52,7 @@ KillMode=none
Type=forking
[Install]
-WantedBy=multi-user.target`
+WantedBy=multi-user.target default.target`
goodName := `# container-foobar.service
# autogenerated by Podman CI
@@ -72,7 +72,7 @@ KillMode=none
Type=forking
[Install]
-WantedBy=multi-user.target`
+WantedBy=multi-user.target default.target`
goodNameBoundTo := `# container-foobar.service
# autogenerated by Podman CI
@@ -96,7 +96,7 @@ KillMode=none
Type=forking
[Install]
-WantedBy=multi-user.target`
+WantedBy=multi-user.target default.target`
podGoodName := `# pod-123abc.service
# autogenerated by Podman CI
@@ -118,7 +118,7 @@ KillMode=none
Type=forking
[Install]
-WantedBy=multi-user.target`
+WantedBy=multi-user.target default.target`
goodNameNew := `# jadda-jadda.service
# autogenerated by Podman CI
@@ -140,7 +140,7 @@ KillMode=none
Type=forking
[Install]
-WantedBy=multi-user.target`
+WantedBy=multi-user.target default.target`
tests := []struct {
name string