aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-18 20:49:45 +0200
committerGitHub <noreply@github.com>2020-08-18 20:49:45 +0200
commit7995f85f7559af9d69adaaa9061bd5c0c7f0d974 (patch)
tree55f0fc65cdd852f9bf761125ee55d2d7180674a8 /pkg
parent13b307e7cc6da25a1831ae6a69888ca10ecedf26 (diff)
parentb3f5c93ecc7ad6f013a087c43f7e91ae33a1efae (diff)
downloadpodman-7995f85f7559af9d69adaaa9061bd5c0c7f0d974.tar.gz
podman-7995f85f7559af9d69adaaa9061bd5c0c7f0d974.tar.bz2
podman-7995f85f7559af9d69adaaa9061bd5c0c7f0d974.zip
Merge pull request #7339 from giuseppe/change-systemd-detection
abi: fix detection for systemd
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/infra/abi/system.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 71fe478fd..478fac1d5 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -70,8 +70,13 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command)
if err != nil {
return err
}
+
+ initCommand, err := ioutil.ReadFile("/proc/1/comm")
+ // On errors, default to systemd
+ runsUnderSystemd := err != nil || string(initCommand) == "systemd"
+
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
- if conf.Engine.CgroupManager == config.SystemdCgroupsManager {
+ if runsUnderSystemd || conf.Engine.CgroupManager == config.SystemdCgroupsManager {
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err)
}