From 7c5c60bc39300e18c0dabf7bd42ee96f2e71476f Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 4 Jun 2024 17:51:16 +0200 Subject: [PATCH] pkg/rootless: set _CONTAINERS_USERNS_CONFIGURED correctly This is a bit weird and I admit I don't understand exactly how the init value is used but this seems wrong. When podman reexec itself it then gets the wrong init value and because rootless_uid() will be 0 the init() function in rootless_linux.go will not set it either because of that. Thus the first reexec has the wrong env. Now that I make use of it in c/common[1] this turns out top be a real issue and is failing all first podman commands. To reproduce make sure to kill the pause process then just run any podman command with the new c/common vendor and without this patch. [1] https://github.com/containers/common/pull/2020 Signed-off-by: Paul Holzinger --- pkg/rootless/rootless_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/rootless/rootless_linux.c b/pkg/rootless/rootless_linux.c index 2ddfdb02d3..6e4702946b 100644 --- a/pkg/rootless/rootless_linux.c +++ b/pkg/rootless/rootless_linux.c @@ -880,7 +880,7 @@ reexec_userns_join (int pid_to_join, char *pause_pid_file_path) setenv ("LISTEN_FDNAMES", saved_systemd_listen_fdnames, true); } - setenv ("_CONTAINERS_USERNS_CONFIGURED", "init", 1); + setenv ("_CONTAINERS_USERNS_CONFIGURED", "done", 1); setenv ("_CONTAINERS_ROOTLESS_UID", uid, 1); setenv ("_CONTAINERS_ROOTLESS_GID", gid, 1); @@ -1081,7 +1081,7 @@ reexec_in_user_namespace (int ready, char *pause_pid_file_path, char *file_to_re setenv ("LISTEN_FDNAMES", saved_systemd_listen_fdnames, true); } - setenv ("_CONTAINERS_USERNS_CONFIGURED", "init", 1); + setenv ("_CONTAINERS_USERNS_CONFIGURED", "done", 1); setenv ("_CONTAINERS_ROOTLESS_UID", uid, 1); setenv ("_CONTAINERS_ROOTLESS_GID", gid, 1);