Fix: Auto-detect unprivileged user and use XDG_RUNTIME_DIR for default root#465
Open
sidneychang wants to merge 1 commit intourunc-dev:mainfrom
Open
Fix: Auto-detect unprivileged user and use XDG_RUNTIME_DIR for default root#465sidneychang wants to merge 1 commit intourunc-dev:mainfrom
sidneychang wants to merge 1 commit intourunc-dev:mainfrom
Conversation
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
default root Mirror runc behavior: when running as non-root (or root inside a user namespace), honor $XDG_RUNTIME_DIR for the default runtime root so callers do not need to pass --root. Signed-off-by: sidneychang <2190206983@qq.com>
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.
Description
This change mirrors runc’s behavior when running as a non-root user (or as root inside a user namespace). In these cases, the runtime now automatically falls back to using $XDG_RUNTIME_DIR as the default runtime root, instead of requiring callers to explicitly pass --root.
This adjustment resolves a common failure mode when launching urunc via Podman in non-root scenarios, including cases where a non-root user invokes Podman with sudo. Previously, urunc would attempt to create its state directory under /run/urunc, leading to permission errors such as:
By honoring $XDG_RUNTIME_DIR by default in these environments, urunc now aligns with runc’s behavior and integrates more smoothly with Podman.
Related issues
How was this tested?
Configure Podman to use urunc
Copy the default configuration and register the
uruncruntime:Edit
/etc/containers/containers.confand add:Configure urunc
Create
/etc/urunc/config.tomland set the monitorpathfor hypervisor (e.g. QEMU). See configuration for full options.Run the unikernel with Podman
Run the Nginx Unikraft unikernel:
Inspect and verify (replace the container ID with yours):
LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).