opencontainers / opencontainers/runc
Rootless runc in the Nix sandbox
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 13.5k
- Forks
- 2.3k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 30
Description
I'm trying to run runc --rootless in the Nix sandbox [1]. The container I'm using can be run outside of the sandbox, with my current user and with the same runc binary. In the Nix sandbox, I'm facing several issues that I describe in the following:
- By default, the Nix sandbox environment doesn't have any cgroup fs in
/sys/fs/cgroup. It fails with
container_linux.go:344: starting container process caused "process_linux.go:275: applying cgroup configuration for process caused \"mountpoint for cgroup not found\""
I need to bind mount /sys/fs/cgroup/devices in the Nix sandbox to go further.
- With
/sys/fs/cgroup/devicesbind mounted,runcthen fails with
container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"\""
Well, this is now a little bit more complex to understand:/ It seems to be related to the readOnlyPaths and maskPaths calls [2]. The parent process gets an EOF on the sync pipe but I don't know what is happening on the child side (actually, I don't know how to debug this part).
For testing purposes, I've removed the readOnlyPaths and maskPaths section in the config.json file.
- Without any
readOnlyPathsandmaskPathsin theconfig.jsonfile,runcfails with
container_linux.go:344: starting container process caused "read init-p: connection reset by peer"
Here some questions:
- How do you debug the init process? Are you able to print debug message?
- Is
/sys/fs/cgroup/*required for rootless container? - Why I don't get a better message in the step
2., ie. whenreadOnlyPathsare mounted? Is it because the child process is killed by something? - And, of course, any idea on what is happening?
Thx.
[1] https://nixos.org/nix/manual/ grep sandbox :/
[2] https://github.com/opencontainers/runc/blob/master/libcontainer/standard_init_linux.go#L120-L129
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the rootless runc failure in the Nix sandbox, starting with the cgroup setup and the readOnlyPaths and maskPaths handling in libcontainer/standard_init_linux.go. Use the reported sync-pipe and connection-reset errors to investigate the init process and determine whether cgroups or path mounts cause the failure. Done means identifying the cause and documenting or fixing the failure with clearer diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100