Repository navigation
fix: drop the client's XDG_RUNTIME_DIR from rootful OCI hook env - #5380
Open
sapnasingh4852-source wants to merge 1 commit into
Open
sapnasingh4852-source wants to merge 1 commit into
sapnasingh4852-source wants to merge 1 commit into
Conversation
Rootful containers created over SSH inherit the client's XDG_RUNTIME_DIR. After a reboot that path does not exist until the user logs in, so the createRuntime hook's AppArmor loader fails to create its temp file and restart-policy containers loop until the user logs in. Rootless containers keep XDG_RUNTIME_DIR since the rootless runtime directory lives there. Signed-off-by: sapna singh <sapnaghato4852@gmail.com>
Member
Why? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Stops rootful OCI hooks from inheriting the client's
XDG_RUNTIME_DIR.withNerdctlOCIHookpasses the wholeos.Environ()to the hook. When the container is created over SSH,XDG_RUNTIME_DIRpoints at/run/user/<uid>. After a reboot that path does not exist until the user logs in, so containerd'sLoadDefaultProfilecannot create its temp file, thecreateRuntimehook fails withunable to apply apparmor profile, and restart-policy containers loop until the user logs in.The new
ociHookEnvhelper dropsXDG_RUNTIME_DIRwhen not rootless, so the loader falls back to the system temp directory. Rootless containers keep the variable because the rootless runtime directory lives there.PATH=/usr/sbin:/sbinis still appended for iptables (#1536).Test
TestOCIHookEnvasserts the variable is dropped for rootful, kept for rootless, and that the sbinPATHentry is present.I did not re-run the full reboot repro from #5377. The fix targets the failing line directly: with
XDG_RUNTIME_DIRabsent from the hook env,os.CreateTemp(os.Getenv("XDG_RUNTIME_DIR"), ...)uses the system temp directory, as the issue suggests.Fixes #5377.
Signed-off-by: sapna singh sapnaghato4852@gmail.com