6

I use Arch Linux 4.19.15-1-lts #1 SMP Sun Jan 13 13:53:52 CET 2019 x86_64 GNU/Linux. I do also have Nix installed: nix-env (Nix) 2.2.

I've never had any problems until the recent update to version 2.2. I always do the upgrades/updates with these two steps:

$ nix-channel --update
...
$ nix-env --upgrade
...

...but after the recent 2.2 update I can't find a way to make nix-channel --update work anymore. I'm always getting these errors:

error: cloning builder process: Operation not permitted
error: unable to start build process
error: program '/nix/store/876x7a35qbn3q062b6zcz6va88m0990d-nix-2.2/bin/nix-env' failed with exit code 1

...even if I do rollback the previous operation(s):

$ nix-channel --update 
unpacking channels...
error: cloning builder process: Operation not permitted
error: unable to start build process
error: program '/nix/store/876x7a35qbn3q062b6zcz6va88m0990d-nix-2.2/bin/nix-env' failed with exit code 1
$ nix-channel --rollback 
switching from generation 40 to 39
$ nix-channel --update 
unpacking channels...
error: cloning builder process: Operation not permitted
error: unable to start build process
error: program '/nix/store/876x7a35qbn3q062b6zcz6va88m0990d-nix-2.2/bin/nix-env' failed with exit code 1

This is what I have in the update list:

$ nix-channel --list 
nixpkgs https://nixos.org/channels/nixpkgs-unstable

...and eventually I can't even delete that:

$ nix-channel --remove nixpkgs 
uninstalling 'nixpkgs-19.03pre165281.7d864c6bd63'
error: cloning builder process: Operation not permitted
error: unable to start build process
error: program '/nix/store/876x7a35qbn3q062b6zcz6va88m0990d-nix-2.2/bin/nix-env' failed with exit code 1

I would like to avoid a reinstall.


UPDATE

I couldn't wait! O:)

I went ahead and removed the current installation...and when I do a fresh install I basically got the same result:

$ sh <(curl https://nixos.org/nix/install) --no-daemon 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2476  100  2476    0     0   5417      0 --:--:-- --:--:-- --:--:--  5406
downloading Nix 2.2.1 binary tarball for x86_64-linux from 'https://nixos.org/releases/nix/nix-2.2.1/nix-2.2.1-x86_64-linux.tar.bz2' to '/tmp/nix-binary-tarball-unpack.n5vqvsi4Uq'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 22.5M  100 22.5M    0     0  4016k      0  0:00:05  0:00:05 --:--:-- 4377k
Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation
performing a single-user installation of Nix...
directory /nix does not exist; creating it by running 'mkdir -m 0755 /nix && chown x80486 /nix' using sudo
[sudo] password for x80486: 
copying Nix to /nix/store.................................
initialising Nix database...
Nix: creating /home/x80486/.nix-profile
installing 'nix-2.2.1'
error: cloning builder process: Operation not permitted
error: unable to start build process
/tmp/nix-binary-tarball-unpack.n5vqvsi4Uq/unpack/nix-2.2.1-x86_64-linux/install: unable to install Nix into your default profile

...so looks like there is, in general, something going on with Linux (or specifically the distro that use) and Nix.

  • 1
    I'm seeing the same problem with a fresh install on a different distro. When I switch to the previous version of nix ( curl nixos.org/releases/nix/nix-2.1.3/install | sh ) the problem goes away. So I think it might be more accurate to say there's something going on with nix-2.2.1 – Dave Compton Jan 21 at 20:36
  • Interesting; I didn't think about it. I think I'll stick with a lower version for a while then. Thanks for the tip! – x80486 Jan 21 at 22:04
7

Following the suggestion in this comment resolves the problem:

sysctl kernel.unprivileged_userns_clone=1
  • That didn't do it for me. What kernel do you have installed? I have now uplink 4.19.16-1-lts #1 SMP Thu Jan 17 07:35:45 CET 2019 x86_64 GNU/Linux...and still have the same problem when I try to install Nix via: sh <(curl https://nixos.org/nix/install) --no-daemon. – x80486 Jan 20 at 23:39
  • I have ➜ ~ uname -a: Linux morpork 4.20.3-arch1-1-ARCH #1 SMP PREEMPT Wed Jan 16 22:38:58 UTC 2019 x86_64 GNU/Linux – Asad Saeeduddin Jan 21 at 10:28
3

Nix uses quite a lot of flags for the clone, mainly to detach some linux namespaces. I expect your system doesn't support some of these for unprivileged processes. IIRC some distros chose that because of security concerns.

  • I truly think that's the case. I opened up an Issue in their GitHub repository but so far I haven't received any feedback. If they concur with this, I'll accept your answer. – x80486 Jan 17 at 18:32
  • @x80486 Could you provide a link to the issue please? – Asad Saeeduddin Jan 19 at 20:40
  • 1
    It's filed under NixOS/nix – x80486 Jan 20 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.