unshare(): Operation not permitted
rvolosatovs opened this issue · comments
Roman Volosatovs commented
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
I encountered the same issue. User NS are disabled by default on Debian.
A solution is here.
Jörg Thalheim commented
I also documented this switch in: https://github.com/nix-community/nix-user-chroot