Skip to content

Commit

Permalink
rootless: make cgroup ownership detection not fatal
Browse files Browse the repository at this point in the history
do not fail if we cannot detect the cgroup ownership.  The detection
fails when running in a container, since the cgroup showed in
/proc/self/cgroup is not accessible, due to the runtime mounting it
directly as the cgroup root.

Closes: containers#5488

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Mar 30, 2020
1 parent 598bb53 commit f59c948
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/podman/main_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ func setupRootless(cmd *cobra.Command, args []string) error {
if os.Geteuid() == 0 {
ownsCgroup, err := cgroups.UserOwnsCurrentSystemdCgroup()
if err != nil {
return err
}
conf, err := runtime.GetConfig()
if err != nil {
return err
logrus.Warnf("Failed to detect the owner for the current cgroup: %v", err)
}
if !ownsCgroup {
conf, err := runtime.GetConfig()
if err != nil {
return err
}
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
if conf.Engine.CgroupManager == config.SystemdCgroupsManager {
Expand Down

0 comments on commit f59c948

Please sign in to comment.