Skip to content

Commit 9db534e

Browse files
committed
[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 <[email protected]>
1 parent e50e0da commit 9db534e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libpod/container_internal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
15351535
// If /etc/mtab does not exist in container image, then we need to
15361536
// create it, so that mount command within the container will work.
15371537
mtab := filepath.Join(mountPoint, "/etc/mtab")
1538-
if err := os.MkdirAll(filepath.Dir(mtab), 0755); err != nil {
1538+
if err := idtools.MkdirAllAs(filepath.Dir(mtab), 0755, c.RootUID(), c.RootGID()); err != nil {
15391539
return "", errors.Wrap(err, "error creating mtab directory")
15401540
}
15411541
if err = os.Symlink("/proc/mounts", mtab); err != nil && !os.IsExist(err) {

0 commit comments

Comments
 (0)