Skip to content

Commit

Permalink
Ensure that rootless cgroupsv1 will select cgroupfs
Browse files Browse the repository at this point in the history
The current logic is that, if Podman was built with the systemd
build flag, we will always select systemd cgroups by default.
Then, if we detect no systemd dbus session, we will swap to
cgroupfs. Problem: there are cases where a systemd dbus session
is available, but systemd cgroups don't work - most notably,
rootless mode on cgroups v1 systems. Special-case this so that we
will not try to force systemd mode and break rootless containers.

Fixes containers/podman#6982

Signed-off-by: Matthew Heon <[email protected]>
  • Loading branch information
mheon committed Jul 21, 2020
1 parent 58321b9 commit a61c5e2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/config/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

package config

import (
"github.com/containers/common/pkg/cgroupv2"
"github.com/containers/storage/pkg/unshare"
)

func defaultCgroupManager() string {
enabled, err := cgroupv2.Enabled()
if err == nil && !enabled && unshare.IsRootless() {
return CgroupfsCgroupsManager
}

return SystemdCgroupsManager
}
func defaultEventsLogger() string {
Expand Down

0 comments on commit a61c5e2

Please sign in to comment.