diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2021-08-17 21:12:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-17 21:12:51 +0000 |
commit | a3d8b48fd56a722642f7cbcad52b2fa88f12b656 (patch) | |
tree | 13e57c537ac96c33426dcd262f1e6dbe2d08f86a /libpod | |
parent | d7f0d1f17cf7fa53b4b87603e43d97b337394547 (diff) | |
parent | e7ee15f8c39122e0d2b343ce9a3c0b577af45f40 (diff) | |
download | podman-a3d8b48fd56a722642f7cbcad52b2fa88f12b656.tar.gz podman-a3d8b48fd56a722642f7cbcad52b2fa88f12b656.tar.bz2 podman-a3d8b48fd56a722642f7cbcad52b2fa88f12b656.zip |
Merge pull request #11212 from flouthoc/check-valid-systemd-session
cgroup-manager-systemd: Warn early if user is rootless and no relevent user session is present.
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/runtime.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 30659a3d4..1f403790f 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -30,6 +30,7 @@ import ( "github.com/containers/podman/v3/libpod/shutdown" "github.com/containers/podman/v3/pkg/cgroups" "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/systemd" "github.com/containers/podman/v3/pkg/util" "github.com/containers/storage" "github.com/containers/storage/pkg/unshare" @@ -500,6 +501,15 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) { // no containers running. Create immediately a namespace, as // we will need to access the storage. if needsUserns { + // warn users if mode is rootless and cgroup manager is systemd + // and no valid systemd session is present + // warn only whenever new namespace is created + if runtime.config.Engine.CgroupManager == config.SystemdCgroupsManager { + unified, _ := cgroups.IsCgroup2UnifiedMode() + if unified && rootless.IsRootless() && !systemd.IsSystemdSessionValid(rootless.GetRootlessUID()) { + logrus.Debug("Invalid systemd user session for current user") + } + } aliveLock.Unlock() // Unlock to avoid deadlock as BecomeRootInUserNS will reexec. pausePid, err := util.GetRootlessPauseProcessPidPathGivenDir(runtime.config.Engine.TmpDir) if err != nil { |