-
-
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 #10421
Comments
Apologies, I forgot to include:
I believe that is, in fact, mode 755 already |
I imagine you're falling into what IIRC is an unresolved hole around trouble with external disks on macOS. Hopefully we'll finally be able to run at least one cause of this to ground. It sounds like you've probably already seen it, but I'll go ahead and cross-link what I think is the most-commented issue on this for discoverability later (even though it also includes linux users running into the same message): For now I'll just pepper you with questions:
|
Yes, but I haven't tried the
If you need, it's just ten minutes to uninstall / re-install.
... I was incorrect, I believe this was a 2018 machine. Sorry about that. Machine info:
Not yet. Is there a way to set that as the install target for Nix? I'd be more than happy to do that, beyond the part where it's a mechanical HDD.
Gladly. Files attached. Oh. Well. I forgot about that:
Continue to salt the discussion with a peppering of questions! |
The plot thickens:
so, that foes function as a work-around for the problem not elegant, but it is a work-around. |
I'm not sure if it's related to the issue that brought you here, but nix-info shouldn't be reporting I imagine that's a sign that the daemon isn't running. Occasionally it won't start right (most often if it's been disabled at some point and then removed without cleaning up the launchd state that tracks what is/isn't disabled, but I think there are some other cases). I guess the simple way to check is to run FWIW, a problem like this during install is exactly the kind of thing I'd be looking for in the full install output :) |
Ok, I've got something else I need to sort out first, and then I'll do the uninstall / re-install cycle and post the log. |
given:
then ... which gives ...
Let me know if you need anything else, or if there is a way to move the Nix store partition to my internal mechanical. |
I just found https://nixos.wiki/wiki/Storage_optimization#Moving_the_store but I'm not going to play with that until I'm sure you don't have any further questions with the current install |
Did it emit any errors/warnings? (stderr wouldn't go through the pipe, and I don't see anything obvious in the log.) Is the daemon service running? If not, can you run Can you see what these output?
Those instructions probably assume linux. You can inevitably do something similar on macOS, but the read-only root in Catalina+ requires a bit of hoopjumping. The most ~humane way to do this is to set the envs below to tell it which disk to use (by default it'll glom on to whatever disk nix/scripts/create-darwin-volume.sh Lines 69 to 70 in 2dc06b3
That said, I'm not sure it'll fix your issue (and having /nix on spinning rust will obviously be suboptimal), but it should clarify whether that's the source of the problem. (We know external drives are a common theme with people hitting this, and we know macOS treats the primary/internal volume a little differently, but we haven't shaken something preventive out of that knowledge.) |
All green. Nothing red / fail at any stage. |
|
Yes, it is. |
|
Okay. Going to have supper then I'll do the uninstall cycle and install after setting :
|
So, I likely did something wrong, but here we go: given
and
I'm guessing the target is just "disk0", but please confirm that. |
NM. I realized what I was doing wrong. Should have used Disk1.
So I created the Vol from the GUI side of Disk Util as you see above. Ran the install and got:
So that's a no go. |
Success! Given
and
then during install we see
and in a new session we can sucessfully
So it's a slow as a three turtles in a trench coat, but yes, it runs just fine.
So it works just fine indeed if it's installed on the "internal" hard disk instead of the external boot disk. |
Issue was closed by my cat, who was sure they were being helpful. :D Re-opened by me, who is less convinced of that. |
Thanks for confirming the internal disk works. Since we're pretty confident it's the internal/external thing, here's my thesis:
If that thesis is right, I'm not aware of a way around that doesn't involve adding a Full Disk Access permission/exemption. If you switch back to the "normal" install (not overriding the disk), can you check Preferences > Security & Privacy > Privacy > Full Disk Access and see if If it isn't an option, you can probably get the same result by adding the FDA for /bin/sh (because the service invokes this first). I'll stop short of telling you to do that, since it comes with some risk (anything running under /bin/sh will have access to the locations Full Disk Access). Unless/until we find some way around this that doesn't involve FDA, there isn't anything we can do to pre-fix this in the installer (macOS won't let us add this permission), but we could/should probably try to detect external volumes and either throw a fit or notify the user that they'll need to take remedial steps. |
If I have time tomorrow, I'll do that test for you. Now, I can tell you that it's possible to run an exe from an external, because that's where I have Chrome installed and a couple of other self-updating apps that launch and run background tasks. So it's going to be a secret sauce issue to figure out how the installer should be launching to let this work right. |
ok. finally able to work on this. Just getting my environment uninstalled |
okay. 2m30s, and done a "standard" install 100% to the external drive, which results in the problem as expected: ❯ 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 Checking Full Disk Access shows: So, it's the daemon isn't present, as you expected. I've now just tried to add it, however, I'm having trouble finding the full path to the silly thing. Hunting for it now |
There are days I'm frightened that they let me have a driver's licence. I just realized that the "nix" in the list there didn't stand for *nix, like I'm used to thinking. It's literally the entire Nix-Shell environment. ... and now it works just fine: ❯ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-darwin"`
- host os: `Darwin 22.6.0, macOS 10.16`
- multi-user?: `yes`
- sandbox: `no`
- version: `nix-env (Nix) 2.21.1`
- channels(root): `"nixpkgs"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs` I'm going to keep experimenting here, and I'll let you know if anything crops up. |
That's a good sign. In some other contexts people haven't had luck with exempting the nix executable, or i would have explicitly suggested it. |
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. |
I solved this issue by creating an image of the volume containing the Nix store right after the initial Nix installation, then transferring it to an external hard drive using Carbon Copy Cloner, formatted as APFS. (When formatting APFS, I chose the regular APFS option, not case-sensitive.) After that, I followed the steps you explained by replacing the entries in /etc/fstab and /Library/Launch... with the new APFS-formatted volume. Then, after rebooting and enabling the permissions for Nix and various Nix-related programs that run in the terminal (like nix sh), the issue with the daemon, file permissions, and Nix breaking was completely resolved. During the resolution process, especially when building the system profile, it’s crucial to preemptively enable all permissions for Nix and Nix-related sh and bash processes to prevent Nix from breaking. https://discourse.nixos.org/t/how-to-move-nix-store-to-external-drive-on-macos/19592/3 Thank you for writing this guide. |
Platform
Additional information
iMac 21" Intel 2012. Reinstalled the system today, wiped all drives. Installed XCode, Hyper, VSCode, then ran the Nix "Multi-user installation" per the website with the
--yes
flag.Opened new terminal, ran
nix-shell -p nix-info --run "nix-info -m"
and it errors out witherror: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted
Reviewed other issues such as #6667 with similar error message, but solutions did not seem to apply.
Output
Output
Have repeatedly uninstalled per https://nixos.org/manual/nix/stable/installation/uninstall.html#macos ensuring that all steps are followed, and even rebooted twice for good measure. All install attempts result in the same behaviour.
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: