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

Installing on MacOS fails when user UID is already in use #2242

Open
johncoder opened this issue Jun 19, 2018 · 19 comments
Open

Installing on MacOS fails when user UID is already in use #2242

johncoder opened this issue Jun 19, 2018 · 19 comments
Labels
installer macos Nix on macOS, aka OS X, aka darwin

Comments

@johncoder
Copy link

johncoder commented Jun 19, 2018

While installing nix on MacOS it fails while creating build user 5:

~~> Setting up the build user nixbld5
<main> attribute status: eDSRecordAlreadyExists
<dscl_cmd> DS Error: -14135 (eDSRecordAlreadyExists)

---- oh no! --------------------------------------------------------------------
Jeeze, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.

:(

We'd love to help if you need it.

If you can, open an issue....

After some investigation, I realized it fails because I have a _sophos user with UniqueID "30005"

dscl . -search /Users UniqueID "30005"

yields:

_sophos		UniqueID = (
	30005
)

Is there a way to work around this?

@matthewbauer
Copy link
Member

This is definitely a serious issue! We may be able to just skip user id that is taken.

/cc @grahamc

@vcunat vcunat added installer macos Nix on macOS, aka OS X, aka darwin and removed macos Nix on macOS, aka OS X, aka darwin labels Jun 24, 2018
@vcunat
Copy link
Member

vcunat commented Jun 24, 2018

I'm not sure how to approach this. Having some non-nix UIDs in the nix block would seem sub-optimal to me as well; it would seem better to just choose a different contiguous block.

@domenkozar domenkozar added the macos Nix on macOS, aka OS X, aka darwin label Apr 30, 2020
@stale
Copy link

stale bot commented Feb 16, 2021

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

@stale stale bot added the stale label Feb 16, 2021
@stale
Copy link

stale bot commented Apr 29, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this as completed Apr 29, 2022
@bjornfor
Copy link
Contributor

Duplicate(?) issue still open here: #6153

@fbettag
Copy link

fbettag commented Jun 11, 2024

on macos sequoia the uid 301 is now being used by _modelmanagerd:

dscl . -search /Users UniqueID "301"                                                                                                                      ─╯
_modelmanagerd		UniqueID = (
    301
)

resulting in

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo /usr/bin/dscl . create /Users/_nixbld1 UniqueID 301

Creating the Nix build user (#1), _nixbld1

<main> attribute status: eDSRecordAlreadyExists
<dscl_cmd> DS Error: -14135 (eDSRecordAlreadyExists)

@aarnphm
Copy link

aarnphm commented Jun 12, 2024

on macos sequoia the uid 301 is now being used by _modelmanagerd:

dscl . -search /Users UniqueID "301"                                                                                                                      ─╯
_modelmanagerd		UniqueID = (
    301
)

resulting in

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo /usr/bin/dscl . create /Users/_nixbld1 UniqueID 301

Creating the Nix build user (#1), _nixbld1

<main> attribute status: eDSRecordAlreadyExists
<dscl_cmd> DS Error: -14135 (eDSRecordAlreadyExists)

Hi there, just upgraded to sequoia to day, would recommend https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file and set the following

NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=400 curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Though I do think build user id should just start at 400 since Apple might add new build users in the future

@stale stale bot removed the stale label Jun 12, 2024
@slice
Copy link

slice commented Jun 22, 2024

I woke up today to see that _nixbld1 through _nixbld4 were suddenly missing on macOS Sequoia Seed 1 AKA 15.0 Beta (24A5264n), so I'll drop the other users for posterity. dscacheutil -q user outputs:

name: _modelmanagerd
password: *
uid: 301
gid: 301
dir: /var/db/modelmanagerd
shell: /usr/bin/false
gecos: Model Manager

name: _reportsystemmemory
password: *
uid: 302
gid: 302
dir: /var/empty
shell: /usr/bin/false
gecos: ReportSystemMemory

name: _swtransparencyd
password: *
uid: 303
gid: 303
dir: /var/db/swtransparencyd
shell: /usr/bin/false
gecos: Software Transparency Services

name: _naturallanguaged
password: *
uid: 304
gid: 304
dir: /var/db/com.apple.naturallanguaged
shell: /usr/bin/false
gecos: Natural Language Services

These users overwrote the Nix build users overnight. Maybe the default user ID base should be bumped?

@Eveeifyeve
Copy link

I have noticed this issue on MacOS Sequoia read my issue that linked this one.

@abhillman
Copy link

abhillman commented Jul 13, 2024

on macos sequoia the uid 301 is now being used by _modelmanagerd:

dscl . -search /Users UniqueID "301"                                                                                                                      ─╯
_modelmanagerd		UniqueID = (
    301
)

resulting in

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo /usr/bin/dscl . create /Users/_nixbld1 UniqueID 301

Creating the Nix build user (#1), _nixbld1

<main> attribute status: eDSRecordAlreadyExists
<dscl_cmd> DS Error: -14135 (eDSRecordAlreadyExists)

Hi there, just upgraded to sequoia to day, would recommend https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file and set the following

NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=400 curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Though I do think build user id should just start at 400 since Apple might add new build users in the future

I have found that the following works for the canonical installer:

NIX_FIRST_BUILD_UID=30001 sh <(curl -L https://nixos.org/nix/install)

Source: https://github.com/NixOS/nix/blob/master/scripts/install-darwin-multi-user.sh#L7

Here is a way to list all taken uids:

% dscacheutil -q user | grep uid | awk '{ print $2 }' | sort -h | uniq
-2
0
1
4
13
24
25
26
27
31
...

@abhillman
Copy link

abhillman commented Jul 13, 2024

PR #11095 should solve this issue. Please feel free +1.

@theoparis
Copy link

theoparis commented Sep 2, 2024

NIX_FIRST_BUILD_UID=30001 sh <(curl -L https://nixos.org/nix/install)

I received the following error with this command:

It seems the build user _nixbld1 already exists, but with the UID
with the UID ''. This script can't really handle that right
now, so I'm going to give up.

If you already created the users and you know they start from
 and go up from there, you can edit this script and change
NIX_FIRST_BUILD_UID near the top of the file to  and try
again.

We'd love to help if you need it.

Edit: Running for u in $(sudo dscl . -list /Users | grep _nixbld); do sudo dscl . -delete /Users/$u; done and re-running the installer command worked.

@Eveeifyeve
Copy link

Eveeifyeve commented Sep 5, 2024

Fixed in: #10919

@Eveeifyeve
Copy link

Eveeifyeve commented Sep 5, 2024

Sort of but not a permanent solution so not really but It's under decision as of this: #10919 (comment)
A PR has been made 34mins ago that fixes the mistake: #11433 (comment)

@Eveeifyeve
Copy link

Eveeifyeve commented Sep 6, 2024

cc @tomberek, close this issue as it's solved in #11433?

@theoparis
Copy link

theoparis commented Sep 8, 2024

It is not solved via sh <(curl -L https://nixos.org/nix/install) yet.. I still have to prepend NIX_FIRST_BUILD_UID=30001

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/macos-15-sequoia-update-clobbers-nixbld1-4-users/52223/3

@Eveeifyeve
Copy link

It is not solved via sh <(curl -L https://nixos.org/nix/install) yet.. I still have to prepend NIX_FIRST_BUILD_UID=30001

I could have a look at making a pr that changes the users but that still doesn’t fix the issue, right?

@abathur
Copy link
Member

abathur commented Sep 18, 2024

@Eveeifyeve my linked PRs don't attempt to directly address this issue (nor is this issue directly related to the sequoia migration). My PRs just move macos installs to a different UID range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installer macos Nix on macOS, aka OS X, aka darwin
Projects
None yet
Development

No branches or pull requests