You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a race condition here during chowning. The above function platformLChown gets called in pwalk.walk, which spawns many go routines to chown in parallel.
fmt.Fprintf(os.Stderr, "error during chown: %v", err)
os.Exit(1)
}
If there are hard linked files, they might be chowned many times. After the first chown, the second chown will fail to map its uid/gid, which causes the Host ID ${HOSTID} cannot be mapped to a container ID error.
Steps to reproduce:
We can use busybox as example image, because there are 400 hard links in /bin/*, all files linking to /bin/busybox.
launch new busybox container with --uidmap=2200000
$ sudo podman run --rm -it --uidmap=0:2200000:65536 --gidmap=0:2200000:65536 docker.io/library/busybox true
Error: error creating container storage: error creating an ID-mapped copy of layer "d31505fd5050f6b96ca3268d1db58fc91ae561ddf14eaabc41d63ea2ef8c1c6d": exit status 1: error during chown: error mapping host ID pair idtools.IDPair{UID:2200000, GID:2200000} for "bin/adduser" to container: Host ID 2200000 cannot be mapped to a container ID
/bin/adduser's uid was formerly chowned by other /bin/* files to 2200000, but the expected uid is 2100000 which is the default subuid range for podman user in step 2.
The text was updated successfully, but these errors were encountered:
make sure the same inode is not chowned twice. Track all the inodes
that are chowned and skip the same inode if it is encountered multiple
times.
Closes: containers#1143
Signed-off-by: Giuseppe Scrivano <[email protected]>
giuseppe
added a commit
to giuseppe/storage
that referenced
this issue
Feb 21, 2022
make sure the same inode is not chowned twice. Track all the inodes
that are chowned and skip the same inode if it is encountered multiple
times.
Closes: containers#1143
Signed-off-by: Giuseppe Scrivano <[email protected]>
make sure the same inode is not chowned twice. Track all the inodes
that are chowned and skip the same inode if it is encountered multiple
times.
Closes: containers#1143
Signed-off-by: Giuseppe Scrivano <[email protected]>
Description:
If we specify
--uidmap
options to create container, the storage driver willchown
files in container image filesystem to the specified uid/gid range.storage/drivers/chown_unix.go
Lines 15 to 31 in 3db6883
There is a race condition here during
chown
ing. The above functionplatformLChown
gets called inpwalk.walk
, which spawns many go routines tochown
in parallel.storage/drivers/chown.go
Lines 53 to 62 in 3db6883
If there are hard linked files, they might be
chown
ed many times. After the firstchown
, the secondchown
will fail to map its uid/gid, which causes theHost ID ${HOSTID} cannot be mapped to a container ID
error.Steps to reproduce:
We can use
busybox
as example image, because there are 400 hard links in/bin/*
, all files linking to/bin/busybox
.remove
busybox:latest
imagesetup podman subuid/subgid range
launch new busybox container with
--uidmap=2200000
/bin/adduser
's uid was formerlychown
ed by other/bin/*
files to2200000
, but the expected uid is2100000
which is the default subuid range forpodman
user in step 2.The text was updated successfully, but these errors were encountered: