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

Sporradic user '_nixbld2' in the group 'nixbld' does not exist #1224

Open
simonzkl opened this issue Oct 6, 2024 · 3 comments
Open

Sporradic user '_nixbld2' in the group 'nixbld' does not exist #1224

simonzkl opened this issue Oct 6, 2024 · 3 comments

Comments

@simonzkl
Copy link

simonzkl commented Oct 6, 2024

When running a nix build on Darwin right after running the nix-installer, we will sporadically get this error:

error: the user '_nixbld4' in the group 'nixbld' does not exist

This error is not related to Sequoia. The machines we're running this on are using an older version of MacOS and this has been a long standing issue for us.

Nix-installer version: 0.27.0

Nix version (by overriding nix installation url):

$ nix-env --version
nix-env (Nix) 2.18.8

System info:

$ system_profiler SPSoftwareDataType SPHardwareDataType
Software:
    System Software Overview:
      System Version: macOS 13.3 (22E252)
      Kernel Version: Darwin 22.4.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: Anka’s Virtual Machine
      User Name: Anka (admin)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Disabled
      Time since boot: 3 minutes, 44 seconds
Hardware:
    Hardware Overview:
      Model Name: Apple Virtual Machine 1
      Model Identifier: VirtualMac2,1
      Model Number: VM0001LL/A
      Chip: Apple M1 (Virtual)
      Total Number of Cores: 4
      Memory: 6 GB
      System Firmware Version: 8422.100.650
      OS Loader Version: 8422.100.650
      Serial Number (system): Z5WTDGHGGW
      Hardware UUID: 8D1B883B-CFC6-5665-AAC5-413C8866FA06
      Provisioning UDID: 0000FE00-531DB21EDCE65966
      Activation Lock Status: Disabled

As you can see the user _nixbld4 does actually exist:

$ dscacheutil -q user
...
name: _nixbld4
password: ********
uid: 354
gid: 350
dir: /var/empty
shell: /sbin/nologin
gecos: 

And the user _nixbld4 is part of nixbld:

$ dscacheutil -q group -a name nixbld
name: nixbld
password: *
gid: 350
users: _nixbld1 _nixbld2 _nixbld3 _nixbld4 _nixbld5 _nixbld6 _nixbld7 _nixbld8 _nixbld9 _nixbld10 _nixbld11 _nixbld12 _nixbld13 _nixbld14 _nixbld15 _nixbld16 _nixbld17 _nixbld18 _nixbld19 _nixbld20 _nixbld21 _nixbld22 _nixbld23 _nixbld24 _nixbld25 _nixbld26 _nixbld27 _nixbld28 _nixbld29 _nixbld30 _nixbld31 _nixbld32 

Some other observations/thoughts:

  • Re-running nix build does not solve the issue. The only way to fix it is to tear down the VM and re-install (rebooting not tested because this is CI).
  • Looking through the nix source code, it seems hard to see how this could fail
  • Possibly a MacOS bug, or the nix-installer setting up users in such a way that MacOS doesn't always pick them up immediately?
@simonzkl
Copy link
Author

simonzkl commented Oct 6, 2024

Running this after the nix-installer step fixed the issue for me:

for user in $(dscacheutil -q group -a name nixbld | tr ' ' '\n' | grep _nixbld); do
  sudo dscl . -create /Users/$user RealName "User $user"
done

The thinking is that this is some sort of MacOS bug and updating the user refreshes the system user cache.

I'll keep testing and report if this ever props back up.

@simonzkl
Copy link
Author

simonzkl commented Oct 6, 2024

Are users created in parallel? I wonder if that's causing the issue.

@simonzkl
Copy link
Author

simonzkl commented Oct 7, 2024

Running odutil reset cache after nix-installer works too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant