Skip to content

nsjail should create parent directories #242

@EyitopeIOn

Description

@EyitopeIOn

Using nsjail in an OpenWRT 24 lxc container environment (I know...nsjail in a container), I had to update one of our startup scripts to create /sys/fs/cgroup/pids/NSJAIL and /sys/fs/cgroups/memory/NSJAIL, otherwrise an error like below happens.

I occassionally have to migrate our software accross platforms. We are using nsjail from commit b07e069

The error

[I][2025-05-30T11:26:23+0100] Uid map: inside_uid:1000 outside_uid:0 count:1 newuidmap:false
[W][2025-05-30T11:26:23+0100][11152] logParams():313 Process will be UID/EUID=0 in the global user namespace, and will have user root-level access to files
[I][2025-05-30T11:26:23+0100] Gid map: inside_gid:1000 outside_gid:0 count:1 newgidmap:false
[W][2025-05-30T11:26:23+0100][11152] logParams():323 Process will be GID/EGID=0 in the global user namespace, and will have group root-level access to files
[I][2025-05-30T11:26:23+0100] Detected cgroups version: 1
[W][2025-05-30T11:26:23+0100][11152] createCgroup():43 mkdir('/sys/fs/cgroup/memory/NSJAIL/NSJAIL.11162', 0700) failed: No such file or directory
[E][2025-05-30T11:26:23+0100][11152] initParent():432 Couldn't initialize cgroup user namespace for pid=11162
[F][2025-05-30T11:26:23+0100][1] runChild():486 Launching child process failed
[WARNING]: speedtest proc exited early
[INFO]: test failed
[INFO]: uninstalled forward drop rule
[INFO]: erase test runner, 

From the error above, I see nsjail breaks when the directories are created. I would have thought that since the parent directory for pid and memory is already defined , then it would make sense to create the full path, especially because you create the PID subdirectories inside the parent.

Just checking what would be a worthy PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions