summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrvashi Mohnani <umohnani@redhat.com>2021-06-23 14:24:55 -0400
committerMatthew Heon <mheon@redhat.com>2021-06-24 13:32:06 -0400
commitb957bff8b57f6dac862bc073ba249a571a80bca6 (patch)
tree051d3b8d63f3c630a37ed84ea7bc6db48b7641c2
parent6d394f0e474417892645a4d0b4a786cd733f0e8c (diff)
downloadpodman-b957bff8b57f6dac862bc073ba249a571a80bca6.tar.gz
podman-b957bff8b57f6dac862bc073ba249a571a80bca6.tar.bz2
podman-b957bff8b57f6dac862bc073ba249a571a80bca6.zip
[NO TESTS NEEDED] Create /etc/mtab with the correct ownership
Create the /etc and /etc/mtab directories with the correct ownership based on what the UID and GID is for the container. This was causing issue when starting the infra container with userns as the /etc directory wasn't being created with the correct ownership. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
-rw-r--r--libpod/container_internal.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 8f702449a..17921fbfb 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1534,7 +1534,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
// If /etc/mtab does not exist in container image, then we need to
// create it, so that mount command within the container will work.
mtab := filepath.Join(mountPoint, "/etc/mtab")
- if err := os.MkdirAll(filepath.Dir(mtab), 0755); err != nil {
+ if err := idtools.MkdirAllAs(filepath.Dir(mtab), 0755, c.RootUID(), c.RootGID()); err != nil {
return "", errors.Wrap(err, "error creating mtab directory")
}
if err = os.Symlink("/proc/mounts", mtab); err != nil && !os.IsExist(err) {