DeterminateSystems / nix-installer

Install Nix and flakes with the fast and reliable Determinate Nix Installer, with over 7 million installs.
https://determinate.systems
GNU Lesser General Public License v2.1
2.3k stars 60 forks source link

<autogenerated-issue> unable to install nix or partial installed nix? #1181

Closed yishiliu1 closed 2 months ago

yishiliu1 commented 2 months ago

May have had nix installed a long time ago (2-3 years ago), but not very sure and now the system cannot find nix -bash: nix: command not found

When I tried to run the nix installation command curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install, got an error below

Error

Error:
   0: Planner error
   1: Error executing action
   2: Action `encrypt_apfs_volume` errored
   3: The keychain lacks a password for the already existing "Nix Store" volume on disk `disk1`, consider removing the volume with `diskutil apfs deleteVolume "Nix Store"` (if you receive error -69888, you may need to run `sudo launchctl bootout system/org.nixos.darwin-store` and `sudo launchctl bootout system/org.nixos.nix-daemon` first)

Then I ran the suggested command diskutil apfs deleteVolume "Nix Store", and got this error below

Error:
   0: Planner error
   1: Error executing action
   2: Action `create_group` errored
   3: Group `nixbld` existed but had a different gid (30000) than planned (350)

We found a suggestion to addd --nix-build-group-id 30000 to the installation command, i.e. curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --nix-build-group-id 30000. Then got this error below

Error:
   0: Planner error
   1: Error executing action
   2: Action `create_users_and_group` errored
   3: Action `create_user` errored
   4: User `_nixbld1` existed but had a different uid (301) than planned (351)

Lastly, we added another flag to the installation command - curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --nix-build-group-id 30000 --nix-build-user-id-base 301 and ended up with this error below. We got this --nix-build-user-id-base suggested argument from nix

Error: 
   0: Planner error
   1: Error executing action
   2: Action `create_users_and_group` errored
   3: Action `create_user` errored
   4: User `_nixbld1` existed but had a different uid (301) than planned (302)

Any suggestion on what next steps I can try? Or any idea on what's happening here?

Metadata

key value
version 0.26.0
os macos
arch x86_64
cole-h commented 2 months ago

If you want to start from scratch, I'd suggest following the upstream uninstall documentation: https://nix.dev/manual/nix/latest/installation/uninstall.html#macos

Also note that the base is just that: the base. So every other user will be base + N. So you'd want to configure the base to be 300 instead of 301.

yishiliu1 commented 2 months ago

Thanks @cole-h! Changing the base from301 to 300 solved the issue! The command I ran that successfully installed nix in my system: curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --nix-build-group-id 30000 --nix-build-user-id-base 300

cole-h commented 2 months ago

Great, I'm glad you got it working! Keep in mind that the 300 base will break Nix after you take the macOS Sequoia upgrade. You may want to take a look at our blog post on preparing for that inevitability: https://determinate.systems/posts/nix-support-for-macos-sequoia/