Not sure if this is a change in Nix itself or we are doing something wrong, but since we’ve upgraded to 2.14 developers have been experiencing errors like these:
error: creating directory '/nix/var/nix/gcroots/per-user/siddarthkumar': Permission denied
error: creating directory '/nix/var/nix/gcroots/gcroots/siddarthkumar': Permission denied
Obviously the solution to this is to create those folders with correct permissions, but this seems like a regression to me. It seems to be that on Nix 2.11 we used before these folders would be created by Nix when the first package was installed in the profile.
Either I’m missing something very obvious, or this is a regression in recent Nix.
2 Likes
I have tested this with Nix 2.14.1
and it fails:
jakubgs@ubuntuvm:~/status-mobile$ nix-instantiate --attr shells.default --add-root /nix/var/nix/gcroots/per-user/${USER}/status-mobile default.nix
error: creating directory '/nix/var/nix/gcroots/per-user/jakubgs': Permission denied
But if I downgrade to 2.13.4
it works fine:
jakubgs@ubuntuvm:~/status-mobile$ nix-instantiate --attr shells.default --add-root /nix/var/nix/gcroots/per-user/${USER}/status-mobile default.nix
/nix/var/nix/gcroots/per-user/jakubgs/status-mobile
2 Likes
NobbZ
June 22, 2023, 10:07am
3
This is a known problem with 2.14 and 2.15. The issues should be fixed with 2.16.
Please either do update to the latest release or downgrade to 2.13.
1 Like
I have tried 2.16.1
and tried using nix--instantiate
but it fails the same way:
jakubgs@ubuntuvm:~/status-mobile % nix-instantiate --attr shells.default --add-root /nix/var/nix/gcroots/per-user/${USER}/status-mobile/shells.default default.nix
error: creating directory '/nix/var/nix/gcroots/per-user/jakubgs': Permission denied
jakubgs@ubuntuvm:~/status-mobile % nix-instantiate --version
nix-instantiate (Nix) 2.16.1
So it doesn’t look to me like 2.16
fixes the issue.
NobbZ
June 22, 2023, 11:57am
5
I see, this is probably a so far undiscovered side effect of the same base issue.
And it seems as if you already posted a bug because of this.
I found it when I wanted to check for the old issues with similar symptoms. As only now I see that you have a problem with GCroots, and not profiles…
opened 10:13PM - 21 Jun 23 UTC
bug
**Describe the bug**
Somewhere between `2.13.4` and `2.14.1` something about … how files in `/nix/var/nix/gcroots/per-user` are created changed.
When I'm on `2.13.4` in a multi-user setup I can use for example `nix-instantiate` in create paths under `gcroots`:
```
> nix-instantiate --attr shells.default --add-root /nix/var/nix/gcroots/per-user/${USER}/status-mobile default.nix
/nix/var/nix/gcroots/per-user/jakubgs/status-mobile
```
But when I do it on `2.14.0` it fails:
```
> nix-instantiate --attr shells.default --add-root /nix/var/nix/gcroots/per-user/${USER}/status-mobile default.nix
error: creating directory '/nix/var/nix/gcroots/per-user/jakubgs': Permission denied
```
Why is that?
**Steps To Reproduce**
1. Install Nix 2.14 or newer in multi-user mode
2. Use `nix-instantiate` with `--add-root` flag
3. See failure due to `Permission denied`
**Expected behavior**
I'd expect this to work as before.
**Additional context**
Our research issue and Discourse post:
* https://github.com/status-im/status-mobile/issues/16344
* https://discourse.nixos.org/t/upgraded-to-nix-2-14-1-and-profiles-are-not-being-created/29455/2