Skip to content

Commit 26b71ad

Browse files
committed
rootless: allow UID >= 524288
When the UID is >= 524288, newuidmap was failing. ``` [rootlesskit:parent] error: failed to setup UID/GID map: newuidmap 3326 [0 222586300 1 1 524288 1073741824] failed: newuidmap: write to uid_map failed: Invalid argument: exit status 1 ``` Fix moby/moby issue 49810 Signed-off-by: Akihiro Suda <[email protected]>
1 parent a2adc81 commit 26b71ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/cidata/cidata.TEMPLATE.d/boot/20-rootless-base.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ for f in /etc/subuid /etc/subgid; do
7171
# See userdbctl.
7272
# 1073741824 (1G) is just an arbitrary number.
7373
# 1073741825-1878982656 is left blank for additional accounts.
74-
grep -qw "${LIMA_CIDATA_USER}" $f || echo "${LIMA_CIDATA_USER}:524288:1073741824" >>$f
74+
subuid_begin=524288
75+
# https://github.com/moby/moby/issues/49810#issuecomment-2808108191
76+
[ "${LIMA_CIDATA_UID}" -ge "${subuid_begin}" ] && subuid_begin="$((LIMA_CIDATA_UID + 1))"
77+
grep -qw "${LIMA_CIDATA_USER}" $f || echo "${LIMA_CIDATA_USER}:${subuid_begin}:1073741824" >>$f
7578
done
7679

7780
# Start systemd session

0 commit comments

Comments
 (0)