There is a regression in 2.2 due to the following two commits.
a32ff2573ba4d0df4e3360c5a96398738da953f6
a0ef21262f4d5652bfb65cfacaec01d89c475a93
Reverting these two commits causes the error not to happen.
It can be reproduced by running this script.
https://github.com/mpickering/ghc-artefact-nix/blob/master/ghc-head-from.sh
wget https://github.com/mpickering/ghc-artefact-nix/blob/master/ghc-head-from.sh
nix-shell -p jq
./ghc-head-from.sh
This happens when running as root, not (so far) as other users
@tilpner says this can be reproduced with nix-shell -p hello rather than my complicated instructions.
On what system?
@edolstra We are both on NixOS.
I can reproduce this bug reliably under the following circumstances (on current NixOS unstable-small):
nix-shell is run as root.nix-shell is busy fetching derivations, a device is mounted or unmounted.@iblech Are you sure it requires 2.? Mounting/unmounting is not necessary here.
You are right! Condition 2 is not necessary. Reliably, the following happens:
nix-shell -p foo, for any value of foo I've tested, successfully fetches the required derivations and then aborts with error: restoring parent mount namespace: Invalid argument.This is on Kernel 4.20.6 on a virtual private server.
Can confirm, @volth's error-inducing approach is 100% reproducible here.
With prefetched git from all versions (no builds necessary):
NIX_REMOTE=daemon of course helps-I nixpkgs= to an https:// URL fails as reportedfile:/// URL also failsThis is caused by
EINVAL The caller is multithreaded and tried to join a new user namespace.
We need to get rid of all other threads before restoring the mount namespace.
I can reproduce this on 19.03 consistently.
it always happens on first download, and afterwards it's fine.
[root@nixos1903true-s-1vcpu-1gb-ams3-01:~]# nix run nixpkgs.hello
[1 copied (0.2 MiB), 0.0 MiB DL]
error: restoring parent mount namespace: Invalid argument
[root@nixos1903true-s-1vcpu-1gb-ams3-01:~]# nix run nixpkgs.gnumake
[1 copied (1.1 MiB), 0.2 MiB DL]
error: restoring parent mount namespace: Invalid argument
Nix version is Nix 2.2
And it only happens if you're root it seems.
Could we reopen? Or is this fix not in any tagged release yet? If it isn't. could we tag a new release and get this into 19.03? This is currently blocking me from migrating my servers to 19.03 because I use nix-shell -p in a lot of management scripts
I've created a 2.2.2 release that contains the fix.
Great!
Most helpful comment
I can reproduce this on
19.03consistently.it always happens on first download, and afterwards it's fine.
Nix version is Nix 2.2
And it only happens if you're
rootit seems.Could we reopen? Or is this fix not in any tagged release yet? If it isn't. could we tag a new release and get this into 19.03? This is currently blocking me from migrating my servers to
19.03because I usenix-shell -pin a lot of management scripts