lucabrunox / nix-user-chroot

Run nix in a lightweight chroot container
80 stars 17 forks source link

unshare(): Operation not permitted #10

Open rvolosatovs opened 7 years ago

rvolosatovs commented 7 years ago

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
pacien commented 6 years ago

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

Mic92 commented 5 years ago

I also documented this switch in: https://github.com/nix-community/nix-user-chroot