-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted #3435
Comments
Having same issue since upgrading to osx 10.15.4 It broke my nix installation and I tried full reinstall, having this issue now. Followed the workaround here: |
Weird thing is, it's already 755:
|
Is this also a multi-user install right? What's the output of |
Unfortunately, I just binned and it did a single-user install, which doesn't seem to suffer the same issue, so I can't assist further. But seems to be the latest Catalina update that was pushed out today that's done it, so I'm sure you'll be seeing plenty more soon. |
If you're referring to |
I think this happens in multi-user installation if nix-daemon is not running (for example during a boot, restart, etc). |
To reproduce on darwin:
Explanation: at step 3, nix-daemon is not yet up (takes a few seconds) and nix-build will fallback to client and try to ensure those directories are created, but fails to do so since it doesn't have permissions |
I am wondering why it should change permissions on |
I had this issue as well, though it really did turn out to be that the The |
When/if it lands, I think #4289 will fix enough of this that I'm going to mark it as closing this one (but I'll explain how and un-mark it if there's disagreement). In the process of working on that PR and it's predecessor (#4181), which further complicate the install process, feedback made it (even more) obvious that the installer needs to carry more of the weight of smoothing out previous-install cruft. While working on that functionality, I did a lot of uninstall/reinstall testing and ran into this issue occasionally. I made this change to try to fix it. My confidence in making the fix wasn't terribly high, but I haven't seen the issue recur since. |
I am still facing this issue |
I'm still getting this issue when inside
I'm running the 21.05 minimal ISO in virtualbox. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/cant-run-nix-channel-update-in-nixos-enter-session/13551/1 |
I am running into the original issue, where none of the nix-commands work on MacOS nix-shell -p nix-info --run "nix-info -m"
error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted I guess I am in a bit of a special situation since I did have nix installed previously in single user mode, however I tried everything the installer tells you uninstall nix, before starting with the multi-user installation Situation prior to the upgrade How I tried switching to multi-user mode
sh <(curl -L https://nixos.org/nix/install) --daemon
sudo rm -rf /etc/nix /nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels /Users/simonbein/.nix-profile /Users/simonbein/.nix-defexpr /Users/simonbein/.nix-channels
/usr/bin/sudo /bin/mv /etc/bashrc.backup-before-nix /etc/bashrc
/usr/bin/sudo /bin/mv /etc/zshrc.backup-before-nix /etc/zshrc
I also repeated steps 1-4 running Additional info:
|
@SimonTheLeg Can you try the removal steps again, and then use the ~test installer mentioned in the Try it out section of #4289? (4289, which sands down a few of the sharp corners here, is merged but not yet released) |
That worked like a charm! Thank you so much for that change. Also the installer is really pleasant to use!
nix-channel --add https://channels.nixos.org/nixpkgs-unstable nixpkgs
nix-channel --update and then you can do the normal home-manager install |
I fixed this the wasteful way by deleting |
I'm facing this issue too at the end of install, and when I try to run
I have a MacBook 2017 updated to MacOs Monterey (V. 12.1) Any idea on how to fix this problem? |
For anyone hitting this on darwin even after a full reinstall, try to unmount and delete the partition in Disk Utility and reboot before the reinstall. The reboot was the crucial step for me. |
I have installed it on Linux Mint, and I needed to completely remove Nix and reinstall it with the single user no-deamon version. # Install Nix
sh <(curl -L https://nixos.org/nix/install) --no-daemon |
I just encountered this issue again. This time on Ubuntu 18.04.6 after un-installing and re-installing Nix. |
Reboot fixed it for me 🤷 |
Just an anecdote that may help someone. I was experiencing this error when running macOS Monterey on an external drive. My macbook pro still had its internal factory SSD with Monterey also. On bootup, I was prompted to enter my password for the "Macintosh HD - Data" (internal) partition, which I provided. When I removed the factory SSD and moved my formerly external SSD to the macbook pro's motherboard, the command (nix-shell -p nix-info --run "nix-info -m") started working. So in my case, the special nix volume and mounting may have been confused by the existence of additional APFS volumes mounted. |
Folks are still hitting this issue: https://fosstodon.org/@[email protected]/109552234396262605 |
Just chiming in to say that I also experienced this issue, and have 2 additional APFS volumes on my laptop - one for Docker, and a case-sensitive volume that I do my coding work in. After rebooting, both the |
I just got this, three years hence.
|
On |
I've had the same issue. I lazily re-installed nix (as I've only just started using it, started 'fresh') which meant removing I notably didn't remove the systemd services (hence lazily). Reinstalled using multi-user script, and started receiving same error for non-root users. Came here, read comments etc and issued I think it's due to the nix-daemon.service file which includes a line similar to:
Which I'm assuming can change on a reinstall (like mine) as that path may not exist and not be loaded with a simple Then again I have nfi how nix-daemon interacts, though I'm assuming as it's a requirement for multi-user, users probably depend on it whereas root user doesn't (as they have global perms). I didn't try TLDR: TLDR2: you may have to |
Perhaps we should split this issue out into separate linux/macOS versions? I've personally encountered this error on both. Not sure if the pathogenesis is the same between them however? |
FWIW I'm also not convinced that this error is caused by nix-daemon being inactive. I have found that eg
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/install-not-working-on-fresh-ubuntu-20-04-machine/30662/1 |
Not sure if this is kosher but I hacked my way around this with
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/install-not-working-on-fresh-ubuntu-20-04-machine/30662/6 |
This will fix it for both you and root, however no other user in a multi-user environment (and possibly not allow other users to use Nix at all, without knowledge of how Nix works behind the scenes). If this solution works for you, that's great but wouldn't installing for a single user be a better option? Permission errors are probably one of the most common issues when it comes to any application (especially in linux). I wouldn't be surprised if this issue contains multiple variants, possibly caused by completely separate issues! I'm just gonna give a simple possible solution to the issue I described here:
|
I tried doing a single-user install, but found that didn't work successfully either :/ |
I get this when trying to use an alternative ❯ nix build --eval-store local --store $PWD/tmpstore
error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted Interestingly it goes away with |
Got the same issue while working in a Coder environment, fixed by doing |
I get the same error when running Nix in single-user mode inside a Gitlab job where only non-root access/user is allowed. The issue in Gitlab is that a user id is chosen randomly per job so you cannot prepare the rights for a single user. So |
If you are using macOS server with no GUI, refer to this post to set VNC remote desktop to allow full disk access in settings. I did not figure out how to do this via ssh session (if you know the way, let me know). The problem arises from macOS launchd daemons' restrictions. Since nix-daemon is one of them, it is subject to sandboxing. If you check the logs ( sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo /nix/var/nix/profiles/default/bin/nix-daemon to make sure the issue is gone and |
Is there a way to install macOS and the Nix daemon on the Mac’s original hard drive as usual, but install all additional Nix stores on an external hard drive? On Linux systems other than NixOS, I’ve been solving this issue by moving the Nix store to another location and running the following script at every reboot: mkdir -pv /nix
mount --bind /home/user/new-nix-store /nix I hope that a similar solution could resolve the multi-user issue on macOS. To achieve this, we might need a way to bypass mounting /nix on a new volume of APFS. Does anyone know how to do this? If such an option is added to the Nix installer for macOS, it would perfectly solve the issue. |
FYI: The
For more info see: nix-community/nix-direnv#327 (comment) You may also see errors like the ones below, highlighted with
|
solved |
this solve my problem. Thanks much |
FWIW, I hit this issue on Linux after I deliberately killed the nix-daemon because I was trying to test my own hand-compiled nix, and I couldn't figure out any other way to get it to stop using the daemon. I think it's basically quite reasonable that I have to use nix commands with sudo in this case, but it's still odd to get an error message about setting these permissions when they are already set that way. |
After installing multi-user nix, the following error occurs when running nix-shell:
The text was updated successfully, but these errors were encountered: