Skip to content
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 fails on macOS (Mojave) during creating /Users/nixbld1 #2542

Open
DzmitrySudnik opened this issue Nov 15, 2018 · 12 comments
Open
Labels

Comments

@DzmitrySudnik
Copy link

DzmitrySudnik commented Nov 15, 2018

After upgrading from High Sierra to Mojave I had issues with nix (it's disappeared, but it's a separate topic) and I decided to reinstall it. I ran

sh <(curl https://nixos.org/nix/install) --daemon

it failed telling me that I already have nix and gave me instructions how to remove it:

sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist  sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist  sudo mv /etc/bashrc.backup-before-nix /etc/bashrc  *reopen terminal  sudo mv /etc/zshrc.backup-before-nix /etc/zshrc  *reopen terminal  sudo rm -rf /etc/nix /nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels /Users/$USER/.nix-profile /Users/$USER/.nix-defexpr /Users/$USER/.nix-channels

I followed them and ran installation again which failed less gracefully with the error below without any instructions what to do next:

---- sudo execution ------------------------------------------------------------
I am executing:
$ sudo /usr/bin/dscl . -create /Users/nixbld1 NFSHomeDirectory /var/empty
in order to give nixbld1 a safe home directory
<main> attribute status: eDSPermissionError
<dscl_cmd> DS Error: -14120 (eDSPermissionError)

After some research I found instructions here #1551 which also covers deleting nix users.

So I'm wondering if it's possible to make the installation script smart enough and take care of that issue or at least teach it to inform user how to delete these users manually.

Thanks

@jgreen210
Copy link

This says Mojave further restricts what the root user can do:

https://groups.google.com/forum/?nomobile=true#!topic/macenterprise/xL114KoBRPg

@kaii-zen
Copy link
Contributor

kaii-zen commented Jan 3, 2019

Hitting this too. Big face palm.

@kaii-zen
Copy link
Contributor

kaii-zen commented Jan 3, 2019

If anyone lands here, this seems to only affect iTerm2 (at least for me...). The workaround was to run the installer from Terminal.app (the default terminal that comes with macOS) instead. You would then just get a popup warning that Terminal wants to administer your mac (or something to that effect...) to which you simply click ok and then it hums along fine.

@wadejensen
Copy link

Cheers @kreisys you're a bloody legend!

image

@RumataEstor
Copy link

I created an issue for that in iTerm2 https://gitlab.com/gnachman/iterm2/issues/7545 and it's reported to be already fixed in nightly builds.

@LnL7
Copy link
Member

LnL7 commented Feb 19, 2019

Can we close this, since it's an iTerm2 issue?

@domenkozar
Copy link
Member

I'm getting the same error on Mojave, but I'm ssh-ed into Remote Login.

@domenkozar
Copy link
Member

domenkozar commented May 15, 2019

After a bit more digging:

if [ "$(poly_user_home_get "$username")" = "/var/empty" ]; then
row " Home Directory" "/var/empty"
else
poly_user_home_set "$username" "/var/empty"
row " Home Directory" "/var/empty"
fi
will set home only if it already doesn't point to /var/empty

but on Mojave it's set to:

$ sudo /usr/bin/dscl . -read /Users/nixbld1 NFSHomeDirectory          
NFSHomeDirectory:
 /private/var/empty 1

Seems like the best fix is to allow that as a default too. Maybe this bug existed from before, but just default home changes in Mojave?

@domenkozar
Copy link
Member

Ugh parsing that output with a new line is just insane.

Why do we need to set the home anyway? macOS will default to /var/empty and even if it does to /Users/nixbld1 what's the harm?

It seems on Mojave there's no way to set user home anymore I'm afraid.

@domenkozar
Copy link
Member

domenkozar commented May 17, 2019

Proposal: use eval echo "~$username" and include /private/var/empty 1 as possible default. Bonus points if we could understand where 1 comes from and do inode equality check rather than string equality.

@abathur
Copy link
Member

abathur commented Feb 12, 2021

Proposal: use eval echo "~$username" and include /private/var/empty 1 as possible default. Bonus points if we could understand where 1 comes from and do inode equality check rather than string equality.

I'm not certain, but in the course of working on #4532 I've come to suspect that /private/var/empty 1 or /private/var/empty_1 may be a byproduct of installing macOS updates (i.e., I suspect these are correct after install, and go awry at the next update, at least as the users are currently set up).

@stale
Copy link

stale bot commented Aug 17, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants