From 9873901469bd5a4e435132cbb65aa6bacf798c2a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 14 Aug 2019 11:21:26 +0200 Subject: pkg/cgroups: use DBUS session when rootless use the DBUS user session when running in rootless mode. Closes: https://github.com/containers/libpod/issues/3801 Signed-off-by: Giuseppe Scrivano --- libpod/util_linux.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libpod/util_linux.go') diff --git a/libpod/util_linux.go b/libpod/util_linux.go index 78cbc75a7..d5c113daf 100644 --- a/libpod/util_linux.go +++ b/libpod/util_linux.go @@ -48,6 +48,9 @@ func makeSystemdCgroup(path string) error { return err } + if rootless.IsRootless() { + return controller.CreateSystemdUserUnit(path, rootless.GetRootlessUID()) + } return controller.CreateSystemdUnit(path) } @@ -57,6 +60,14 @@ func deleteSystemdCgroup(path string) error { if err != nil { return err } + if rootless.IsRootless() { + conn, err := cgroups.GetUserConnection(rootless.GetRootlessUID()) + if err != nil { + return err + } + defer conn.Close() + return controller.DeleteByPathConn(path, conn) + } return controller.DeleteByPath(path) } -- cgit v1.2.3-54-g00ecf