Skip to content

Commit

Permalink
Merge pull request #7339 from giuseppe/change-systemd-detection
Browse files Browse the repository at this point in the history
abi: fix detection for systemd
  • Loading branch information
openshift-merge-robot committed Aug 18, 2020
2 parents 13b307e + b3f5c93 commit 7995f85
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/domain/infra/abi/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 7995f85

Please sign in to comment.