NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
11.45k stars 1.44k forks source link

Error when trying to create core users with empty uid #10948

Open nkeneng opened 1 week ago

nkeneng commented 1 week ago

Platform

Issue with Installing Nix Package Manager on macOS

When trying to install the Nix package manager, I encountered the following error:

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.

The issue arose because the script used the condition if ! poly_user_exists "$username" ; then to check if the user existed. However, this condition returned an empty space in the terminal, which caused the script to incorrectly assume the user existed. Consequently, the next step attempted to retrieve the user ID, resulting in an empty string for the UID because no user ID was found.

To resolve this, I added an OR statement to check if the user ID for the username was empty. The modified condition was:

if ! poly_user_exists "$username" || [ -z "$(poly_user_id_get "$username")" ]; then

This fixed the issue, allowing the installation to proceed correctly.

abathur commented 1 week ago

Assuming you've taken the Sequoia update and already had Nix installed, I'm reasonably sure that dscl actually is reporting that the user exists, but that it also has no UID because the Sequoia update is clobbering them.

What's /usr/bin/dscl . -read "/Users/_nixbld1"; echo $? say?

See also: