Fix detach-netns permission error on Ubuntu 25.04#495
Closed
AkihiroSuda wants to merge 2 commits intorootless-containers:masterfrom
Closed
Fix detach-netns permission error on Ubuntu 25.04#495AkihiroSuda wants to merge 2 commits intorootless-containers:masterfrom
AkihiroSuda wants to merge 2 commits intorootless-containers:masterfrom
Conversation
This flag will be internally used to replace `exec("unshare -n")` in the follow-up commit.
This flag should never be used manually.
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
On Ubuntu 25.04, `unshare` is subject to `/etc/apparmor.d/unshare-userns-restrict` that disables mounting. ``` $ rootlesskit --detach-netns bash [rootlesskit:child ] error: failed to create a detached netns on "/tmp/rootlesskit2294453251/netns": failed to execute [unshare -n mount --bind /proc/self/ns/net /tmp/rootlesskit2294453251/netns]: exit status 32 (out="mount: /tmp/rootlesskit2294453251/netns: permission denied.\n dmesg(1) may have more information after failed mount system call.\n") ``` Fix issue 494 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda
commented
Mar 9, 2025
| if err != nil { | ||
| return err | ||
| } | ||
| cmd := exec.Command(selfExe, "--userns=false", "--net=none", "--", "mount", "--bind", "/proc/self/ns/net", p) |
Member
Author
There was a problem hiding this comment.
This seems to hang, possibly the nested rootlesskit is confused for file descriptors, env vars, etc.
Member
Author
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.
On Ubuntu 25.04,
unshareis subject to/etc/apparmor.d/unshare-userns-restrictthat disables mounting.Fix #494