spiegel_podman/pkg/machine
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
..
apple pkg/machine: make mount units hook into local-fs 2025-11-25 18:13:13 +01:00
applehv enable gofumpt formatter 2025-11-11 12:32:46 +01:00
compression fix: check err returned by newGenericDecompressor 2025-11-20 12:07:37 +03:00
connection Bump Go version to v6 2025-10-23 11:00:15 -04:00
define enable gofumpt formatter 2025-11-11 12:32:46 +01:00
e2e Fix: Rootless Podman-in-Podman on WSL 2026-02-27 10:52:14 +01:00
env Bump Go version to v6 2025-10-23 11:00:15 -04:00
hyperv Fix GOOS=windows prealloc linter warnings 2026-02-11 11:41:11 -08:00
ignition enable gofumpt formatter 2025-11-11 12:32:46 +01:00
libkrun Remove Intel MacOS support 2025-12-07 07:03:06 -06:00
lock Bump Go version to v6 2025-10-23 11:00:15 -04:00
ocipull Remove hardcoded refs from ociartifact code 2025-11-13 22:57:21 +01:00
os Autocomplete machine fixes 2026-02-02 15:19:37 -06:00
ports enable gofumpt formatter 2025-11-11 12:32:46 +01:00
provider Merge pull request #27650 from lstocchi/i27614 2025-12-09 12:17:38 +00:00
proxyenv Fix interfering escaping of commas and spaces in no_proxy variable 2026-02-02 15:49:25 +01:00
qemu Don't use append if not necessary 2026-02-11 11:41:10 -08:00
shim Ignore prompt if stdin not a tty on machine start 2025-11-19 11:50:25 -06:00
sockets Bump Go version to v6 2025-10-23 11:00:15 -04:00
stdpull enable gofumpt formatter 2025-11-11 12:32:46 +01:00
vmconfigs enable gofumpt formatter 2025-11-11 12:32:46 +01:00
windows hyperv should reuse hvsock registry entries when possible 2025-11-20 16:51:31 +01:00
wsl Fix: Rootless Podman-in-Podman on WSL 2026-02-27 10:52:14 +01:00
cleanup.go Clean up gvproxy if machine start fails 2024-02-27 13:33:43 -06:00
config.go Bump Go version to v6 2025-10-23 11:00:15 -04:00
config_test.go Bump Go version to v6 2025-10-23 11:00:15 -04:00
gvproxy.go Fix race condition in CleanupGVProxy when reading gvproxy PID file 2026-01-09 08:07:04 +01:00
gvproxy_unix.go Bump Go version to v6 2025-10-23 11:00:15 -04:00
gvproxy_windows.go Bump Go version to v6 2025-10-23 11:00:15 -04:00
keys.go fileperms: newer Go 1.13+ octal literal format 2025-10-16 14:11:29 -04:00
machine_common.go Bump Go version to v6 2025-10-23 11:00:15 -04:00
machine_unix.go lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00
machine_unsupported.go chore: delete obsolete // +build lines 2024-01-04 11:53:38 +02:00
machine_windows.go chore(machine): remove unused EvalSymlinksOrClean function and tests 2026-01-28 02:42:45 +08:00
machine_windows_test.go chore(machine): remove unused EvalSymlinksOrClean function and tests 2026-01-28 02:42:45 +08:00
qemuprovider.go podman5 machine reconfig 1 2024-02-07 08:17:43 -06:00
ssh.go machine: prepend LocalhostSSHArgs to args 2026-02-11 11:41:11 -08:00
ssh_unix.go lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00
ssh_windows.go machine: implement http proxy logic for all providers 2024-02-22 11:23:45 +01:00
update.go Bump Go version to v6 2025-10-23 11:00:15 -04:00
volumes.go Bump Go version to v6 2025-10-23 11:00:15 -04:00