opencontainers / opencontainers/runc

Rootless runc in the Nix sandbox

Open
#1,977 2 comments 0 reactions 0 assignees View on GitHub

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:

  1. 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.

  1. With /sys/fs/cgroup/devices bind mounted, runc then 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.

  1. Without any readOnlyPaths and maskPaths in the config.json file, runc fails 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. when readOnlyPaths are 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.