Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI tests: userns auto tests are skipped as root due missing subuid setup #23383

Closed
Luap99 opened this issue Jul 24, 2024 · 2 comments · Fixed by #23384
Closed

CI tests: userns auto tests are skipped as root due missing subuid setup #23383

Luap99 opened this issue Jul 24, 2024 · 2 comments · Fixed by #23384
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@Luap99
Copy link
Member

Luap99 commented Jul 24, 2024

May CI tests are skipped because there is no containers entry in /etc/sub{u,g}id setup. This means we are not testing it properly

i.e.

[+0692s] ok 338 [170] podman userns=auto in config file in 192ms # skip no IDs allocated for user 'containers'

https://api.cirrus-ci.com/v1/artifact/task/6480607260180480/html/sys-podman-fedora-40-root-host-sqlite.log.html

Same in the e2e tests

→ Enter [It] podman build with --userns=auto - /var/tmp/go/src/github.com/containers/podman/test/e2e/run_userns_test.go:45 @ 07/11/24 15:35:12.569
       [SKIPPED] cannot find mappings for the current user

https://api.cirrus-ci.com/v1/artifact/task/5904463167225856/html/int-podman-fedora-40-root-host-sqlite.log.html

@Luap99 Luap99 changed the title CI tests: userns auto test are skipeed as root due missing subuid setup CI tests: userns auto tests are skipped as root due missing subuid setup Jul 24, 2024
@edsantiago
Copy link
Member

Would something like this be a fix? I don't like the hardcoded uid but don't really see a way to autoallocate one.

diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index 420819ffdd..3c5ebf0f5f 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -285,6 +285,13 @@ case "$PRIV_NAME" in
     *) die_unknown PRIV_NAME
 esac
 
+# Root user namespace
+for which in uid gid;do
+    if ! grep -qE '^containers:' /etc/sub$which; then
+        echo 'containers:200000:65536' >>/etc/sub$which
+    fi
+done
+
 # FIXME! experimental workaround for #16973, the "lookup cdn03.quay.io" flake.
 #
 # If you are reading this on or after April 2023:

@Luap99
Copy link
Member Author

Luap99 commented Jul 24, 2024

yes, although given it is used for userns=auto we may need to allocate a bigger range than 65536, i.e. 1048576 (there plenty of free ids). Reason userns=auto tries to pick a unique free range according from that for each container. And as we think about running sys tests in parallel we have to make sure there are enough ids for podman to use in that case.

@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Oct 31, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants