lucabrunox / nix-user-chroot

Run nix in a lightweight chroot container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unshare(): Operation not permitted

rvolosatovs opened this issue · comments

Debian stretch:

git clone https://github.com/lethalman/nix-user-chroot.git &&\
cd nix-user-chroot &&\
make &&\
cd .. &&\
mkdir -p -m 0755 ~/.nix &&\
chown `whoami` ~/.nix &&\
./nix-user-chroot/nix-user-chroot ~/.nix sh

Cloning into 'nix-user-chroot'...
remote: Counting objects: 44, done.
remote: Total 44 (delta 0), reused 0 (delta 0), pack-reused 44
Unpacking objects: 100% (44/44), done.
gcc -o nix-user-chroot main.c
unshare(): Operation not permitted

Output of grep CONFIG_USER_NS /boot/config-$(uname -r):

CONFIG_USER_NS=y

Output of unshare --user --pid echo YES:

unshare: unshare failed: Operation not permitted

I encountered the same issue. User NS are disabled by default on Debian.
A solution is here.