spiegel_podman/pkg
dvorst 84eff9ef3b Fix: Rootless Podman-in-Podman on WSL
closes: #27411

Adjust SUB_UID and SUB_GID ranges to support running rootless Podman inside a rootless run Podman container.
Also add a test to verify the change and prevent regression.

By default, a new user is assigned the following sub-ID ranges:
  SUB_UID_MIN=100000, SUB_GID_MIN=100000, SUB_UID_COUNT=65536, SUB_GID_COUNT=65536
This means the user’s sub-UID and sub-GID ranges are 100000–165535.

When the container is run rootless with the user defined below, ID mappings occur as follows:
- Container ID 0 (root) maps to user ID 1000 on the host (which is the user created below).
- Container IDs 1–65536 map to IDs 100000–165535 on host (the subid range previously mentioned).

If a new user is created inside this container (to build containers for example), it will
attempt to use the default sub-ID range (100000–165535). However, this exceeds the container’s
available ID mapping, since only IDs up to 65536 are mapped. This causes nested rootless Podman
to fail.

To enable container-in-container builds, the sub-ID ranges for the user must be large enough
to provide at least 65536 usable IDs. A minimum SUB_UID_COUNT and SUB_GID_COUNT of 165536 is
required, but 1,000,000 is used here to provide additional margin.

1,000,000 matches the subid range other machines are using, defined in [ignition.go](69b397af49/pkg/machine/ignition/ignition.go (L284-L289)).
The script of other machines modify the subid files directly for 1 user, the `sed` command used in
this fix mimics that.

The test is added as en extension to the 'simple init with username' test case, to prevent having
to create a new VM.

Signed-off-by: dvorst <87502756+dvorst@users.noreply.github.com>
2026-02-27 10:52:14 +01:00
..
annotations enable gofumpt formatter 2025-11-11 12:32:46 +01:00
api build: connect --source-policy-file, --mount for remote builds 2026-02-18 14:11:12 +01:00
auth Ignore auth header with empty JSON object 2025-11-06 17:39:56 +01:00
autoupdate enable gofumpt formatter 2025-11-11 12:32:46 +01:00
bindings bindings: do not validate source policy on the client 2026-02-18 14:18:44 +01:00
channel bump golangci-lint to v1.50.1 2022-12-15 13:39:56 +01:00
checkpoint Don't use append if not necessary 2026-02-11 11:41:10 -08:00
copy enable gofumpt formatter 2025-11-11 12:32:46 +01:00
criu lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00
ctime update golangci/golangci-lint to v1.63.4 2025-01-07 15:48:53 +01:00
domain Merge pull request #28138 from Luap99/golangci-lint 2026-02-25 13:53:59 +01:00
emulation pkg/emulation: remove slice copying 2026-02-11 11:41:10 -08:00
env run modernize -fix ./... 2025-09-10 16:17:04 +02:00
errorhandling pkg/errorhandling: remove deadcode 2025-06-26 19:37:14 +02:00
farm build: handle --iidfile-raw and --metadata-file flags 2026-02-03 09:18:29 +05:30
fileserver Bump Go version to v6 2025-10-23 11:00:15 -04:00
inspect Bump Go version to v6 2025-10-23 11:00:15 -04:00
k8s.io Fix deprecation notice to make gocritic happy. 2025-11-12 15:35:29 -05:00
logiface run modernize -fix ./... 2025-09-10 16:17:04 +02:00
lookup Cease using deprecated runc userlookup 2024-02-02 11:02:43 -05:00
machine Fix: Rootless Podman-in-Podman on WSL 2026-02-27 10:52:14 +01:00
namespaces use strings.SplitSeq where possible 2025-09-10 16:17:04 +02:00
parallel enable gofumpt formatter 2025-11-11 12:32:46 +01:00
pidhandle lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00
ps enable gofumpt formatter 2025-11-11 12:32:46 +01:00
rctl use strings.SplitSeq where possible 2025-09-10 16:17:04 +02:00
rootless rootless: use nsfs file handles to persist namespaces 2026-01-20 18:41:59 +01:00
seccomp pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
selinux Fix SELinux functions names to not be repetitive 2020-04-23 15:57:34 -04:00
signal enable gofumpt formatter 2025-11-11 12:32:46 +01:00
specgen Merge pull request #28008 from shiv-tyagi/vendor-detection 2026-02-12 18:54:34 +01:00
specgenutil Merge pull request #28008 from shiv-tyagi/vendor-detection 2026-02-12 18:54:34 +01:00
specgenutilexternal enable gofumpt formatter 2025-11-11 12:32:46 +01:00
syncmap Add syncmap package and use it for graph stop/remove 2025-02-17 14:32:34 -05:00
systemd fix new staticcheck warnings 2026-02-23 10:00:51 +01:00
terminal Fix Lint on Windows and enable the job 2024-02-20 08:06:18 -05:00
trust Preallocate a slice 2026-02-11 11:41:10 -08:00
util Preallocate a slice 2026-02-11 11:41:10 -08:00