-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Installation error on OSX Catalina 10.15.7 (2012 iMac) (Caused by homebrew version of chmod) #6671
Comments
Since your nixbld users already existed, this may be some lingering previous-install state. I'd follow the uninstall instructions before giving it another go: https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos |
Thanks for your reply. Like I said, the first run had the exact same error but was outside my terminal buffer at the time of reporting. I had never installed nix before on this machine. |
To be sure, I uninstalled it using the steps outlined above and ran the script again. It has the same outcome:
|
If you try |
(There's not a lot of wiggle room in the routine for extraneous causes here: nix/scripts/install-multi-user.sh Lines 767 to 777 in 63df0fd
We should be seeing one of the next two messages here if this step were actually completing error-free...) |
Thanks for ponting me to the install script. That helps a lot :) When I manually execute |
I wouldn't really expect so. If the directory is missing, it'd still print the other message before exiting--bash would have to be silently choking on this line. I think the You can try to download the script locally and it'll make it easier to poke at. You can follow the steps (minus the modification step) at the beginning of my comment here #4915 (comment) |
You are right, of course. I didn't read properly. I found the problem at least. For some reason In fact, it returns 1 whenever I use it on a directory and use the recursive function. I selected a small package to use as an example. See the output below:
So I started looking at my chmod version, and it turns out I am using the Hombrew version:
The default /bin/chmod was still in place, so I commented the cleanup trap in the install script and added an echo to the last execute line: #trap cleanup EXIT INT QUIT TERM
-- SNIP --
echo "$script $@" Then gave the chmod in /var/folders/0_/1kl_p3_[random]/T/nix-binary-tarball-unpack.F3NUNlTc6q/unpack/nix-2.9.1-x86_64-darwin/install-multi-user an absolute path: _sudo "to make the new store non-writable at $NIX_ROOT/store" \
/bin/chmod -R ugo-w "$NIX_ROOT/store/" Then ran the |
If you are interested in preventing this for future users, I am happy to give you all the details you need. But I understand it is a very niche problem and is technically not yours to fix (hombrew chmod is acting unexpected here). Anyway, let me know. |
Thanks for teasing this out. I was getting pretty perplexed about what might break like that... Do you have something specific in mind, or are you just offering to be a Guinea pig? :) In the macOS-specific scripts we nail down most of the executables to absolute paths to minimize this kind of thing, though it's not quite as simple to do that in the pan-OS parts of the installer (unless |
No problem :) I meant to help out to prevent things like this for future users. I am not sure about how portable /bin/chmod is but I can spend some time to figure it out. I just moved my laptop to Nixos and I enjoy working on things like this to improve my knowledge on the inner workings of Nix (even if this is just the installer) This IMac is my work computer. I’m pretty impressed you got it working on OS X! Anyway, I am a programmer with a decent amount of knowledge about OS X, Linux and have an intermediate knowledge of shell scripting. So I’ll see where I can help out. |
If it isn't a standard, some other approaches might be:
Not sure if this is a me-you or a project-you, so I'll note that I'm not a committer or core developer (but I've PRed a number of fixes/improvements, mostly on macOS-specific issues). I triage most of the macOS install issues because I'm a bleeding heart for people running into sharp corners during install. :) |
I meant it as a project-you :) I had a look at the coreutils chmod.c history and found the relevant bug. It has been fixed about a year ago and released in Coreutils 9.1. The fix has been imported into homebrew on april 16th this year: Here is the relevant chmod.c patch: I guess I could have fixed it by updating my homebrew as well :D As this has been patched now, I don't think Nix needs to do anything but maybe point out to keep homebrew updated. |
Although.. this should break any installation on a coreutils 9.0 system. Not just OSX with Homebrew Coreutils, I have no idea how large that scope is though. I guess you would have had more reports if it was a big audience. |
I thought the same, but I don't see the same result with the Nix coreutils, at least: $ chmod --version
chmod (GNU coreutils) 9.0
Packaged by https://NixOS.org
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie and Jim Meyering.
$ sudo chmod -vR ugo-w /nix/store/bbgvjkspf749sxyvh0qlaic5g3b70xdb-xz-5.2.5/; echo $?
mode of '/nix/store/bbgvjkspf749sxyvh0qlaic5g3b70xdb-xz-5.2.5/' retained as 0555 (r-xr-xr-x)
mode of '/nix/store/bbgvjkspf749sxyvh0qlaic5g3b70xdb-xz-5.2.5/lib' retained as 0555 (r-xr-xr-x)
mode of '/nix/store/bbgvjkspf749sxyvh0qlaic5g3b70xdb-xz-5.2.5/lib/liblzma.la' retained as 0555 (r-xr-xr-x)
neither symbolic link '/nix/store/bbgvjkspf749sxyvh0qlaic5g3b70xdb-xz-5.2.5/lib/liblzma.dylib' nor referent has been changed
mode of '/nix/store/bbgvjkspf749sxyvh0qlaic5g3b70xdb-xz-5.2.5/lib/liblzma.5.dylib' retained as 0555 (r-xr-xr-x)
0 |
Sounds messy indeed :)
I was not aware of getconf PATH, very useful, but I am not aware about possible side-effects so I'm not equiped to speculate about that.
Nice! |
It seems the coreutils guys maintaining the Nix version know about this and applied the patch in the Nix package: |
It looks like the patch is a bugfix: https://github.com/NixOS/nixpkgs/blob/8b538fcb329a7bc3d153962f17c509ee49166973/pkgs/tools/misc/coreutils/fix-chmod-exit-code.patch#L20-L33 |
I take it most releases patched their coreutils package last year, else you would have seen this behaviour a lot more. |
I just wanted to chime in that I encountered this exact issue myself, and had even narrowed it down to noticing that Anywho, after a |
Describe the bug
The installation breaks after the
sudo chmod -R ugo-w /nix/store/
step without a clear error. The output below is the second run, but the first run had the same issue.When I try to manually execute
sudo chmod -R ugo-w /nix/store/
there are no issues, so I think there is some in-between check that fails.Thanks in advance for any help!
The text was updated successfully, but these errors were encountered: