From 53c3720de940ace048ca888caa3ab50d82b2f178 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 14 Jun 2019 09:21:51 -0400 Subject: Correctly identify the defaults for cgroup-manager Currently we report cgroupmanager default as systemd, even if the user modified the libpod.conf. Also cgroupmanager does not work in rootless mode. This PR correctly identifies the default cgroup manager or reports it is not supported. Also add homeDir to correctly get the homedir if the $HOME is not set. Will attempt to get Homedir out of /etc/passwd. Signed-off-by: Daniel J Walsh --- libpod/oci_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libpod/oci_linux.go') diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go index 9bbefdb06..be7210bd2 100644 --- a/libpod/oci_linux.go +++ b/libpod/oci_linux.go @@ -294,7 +294,11 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res cmd.Env = append(cmd.Env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", runtimeDir)) cmd.Env = append(cmd.Env, fmt.Sprintf("_CONTAINERS_USERNS_CONFIGURED=%s", os.Getenv("_CONTAINERS_USERNS_CONFIGURED"))) cmd.Env = append(cmd.Env, fmt.Sprintf("_CONTAINERS_ROOTLESS_UID=%s", os.Getenv("_CONTAINERS_ROOTLESS_UID"))) - cmd.Env = append(cmd.Env, fmt.Sprintf("HOME=%s", os.Getenv("HOME"))) + home, err := homeDir() + if err != nil { + return err + } + cmd.Env = append(cmd.Env, fmt.Sprintf("HOME=%s", home)) if r.reservePorts && !ctr.config.NetMode.IsSlirp4netns() { ports, err := bindPorts(ctr.config.PortMappings) -- cgit v1.2.3-54-g00ecf