summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-08-26 10:29:00 +0200
committerBrent Baude <bbaude@redhat.com>2020-08-27 10:38:56 -0500
commit4da3677e3f243de1cedca11976f156f980e132dc (patch)
treec2a9242cb0a4ec8de449f5ed60ed9238ff9265df
parent679da6c61b0ca56ba8d67507b3f81c6d730afeba (diff)
downloadpodman-4da3677e3f243de1cedca11976f156f980e132dc.tar.gz
podman-4da3677e3f243de1cedca11976f156f980e132dc.tar.bz2
podman-4da3677e3f243de1cedca11976f156f980e132dc.zip
abi: trim init command
without it the systemd detection fails. Closes: https://github.com/containers/podman/issues/7441 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--pkg/domain/infra/abi/system.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 043dfe49e..4f95588a9 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -8,6 +8,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
+ "strings"
"github.com/containers/common/pkg/config"
"github.com/containers/libpod/v2/libpod/define"
@@ -73,7 +74,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command)
initCommand, err := ioutil.ReadFile("/proc/1/comm")
// On errors, default to systemd
- runsUnderSystemd := err != nil || string(initCommand) == "systemd"
+ runsUnderSystemd := err != nil || strings.TrimRight(string(initCommand), "\n") == "systemd"
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
if runsUnderSystemd || conf.Engine.CgroupManager == config.SystemdCgroupsManager {