-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
runsc doesn't work with rootless podman #311
Comments
I don't have experience with podman, so I don't really know what podman rootless is doing. The code above joined the network namespace to configure the network and it's trying to restore back to the original namespace, which should be allowed. Not sure why it's failing. Having said that, runsc requires the caller to be root right now. It would be nice to make runsc work rootless under a flag, especially for @avagin has poked around this recently. |
I don't think we require the caller to be root, we just create new namespaces by default. I think there's an explicit test for this behavior with Maybe there would be a way to detect sufficient namespaces that we skip it? Versus having to pass --netns=none. |
@fvoznika, thanks for taking a look at the bug. If there is nothing fundamentally blocking runsc from running in rootless mode I would be interested in helping out resolving this bug. Let me spend some time with the code so I have relevant questions to ask you. Thanks again! |
Ideally we would be able to run In summary, runsc enters/creates namespaces, maps user/groups in the new namespace, calls pivot_root and chroot, and mounts I think we can remove |
@prattmic runsc create requires to set uid and gid mappings which has to be set via newuidmap. |
Am 13.09.2019 22:56 schrieb Andrei Vagin <[email protected]>:@prattmic runsc create requires to set uid and gid mappings which has to be set via newuidmap.
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.
|
@giuseppe PTAL |
AFAICS, the issue seems to be in the function https://github.com/google/gvisor/blob/master/runsc/specutils/namespace.go#L143-L149
A possible solution is to let the code run in a goroutine and on error, keep the OS thread locked, so that the Go Runtime will destroy the underlying thread when the go routine ends. From: https://golang.org/pkg/runtime/#LockOSThread
so there is no risk another goroutine will run in the wrong namespace |
yeah, rootless here is not the same rootless that we think about. podman creates a user namespace, sets user and group mappings, and executes gvisor there under the root user with all capabilities. The idea with LockOSThread is good, but we fork gofer and sandbox processes with pdeathsig and it means that they die when their parent thread exits. We can block the current system thread if one of namespaces can't be restored. With the following changes, I was able to start a podman rootless container: avagin@db868af I used this wrapper for runsc to set custom options:
And now, we are ready to run a container:
|
Should the thread be locked in any case? I had to troubleshoot a similar error in the past: containers/storage#530 It turned out that the Go runtime can terminate threads at its will without any way of controlling it from the application (at least I didn't find it). |
I have never seen that goruntime destroys system threads, except a case when goroutine locked to a system thread exits. |
* support podmand rootless containers * support docker rootless containers Fixes #311 PiperOrigin-RevId: 458573377
* support podmand rootless containers * support docker rootless containers Fixes #311 PiperOrigin-RevId: 458573377
* support podmand rootless containers * support docker rootless containers Fixes #311 PiperOrigin-RevId: 458573377
The wrapper provided in #311 (comment) worked for me to use runsc in rootless podman, but it's broken again recently (in
so I think there's a regression in a recent change? |
I am trying to evaluate the use of
gVisor
via[podman](https://github.com/containers/libpod)
that allows container creation in rootless mode.gVisor
works fine viasudo
but panics when in rootless mode. Below is stack trace and other relevant info.system info:
permissions on runsc
works fine when sudo
sudo podman --runtime=runsc run --rm -it docker.io/library/ubuntu:latest bash
runc works fine in both root and rootless modes
panics when running in podman/rootless mode
stack trace:
The text was updated successfully, but these errors were encountered: