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.15k stars 53 forks source link

Mac APFS volume cannot be unmounted (ThemeWidgetControlViewService) #836

Open zhuher opened 8 months ago

zhuher commented 8 months ago

Error

Error: 
   0: Error reverting
   0: Action `create_or_merge_nix_config` errored
      Remove file `/etc/nix/nix.conf`

      Action `create_apfs_volume` errored
      Failed to execute command with status 1 `"/usr/sbin/diskutil" "apfs" "deleteVolume" "Nix Store"`, stdout: Started APFS operation
      Deleting APFS Volume from its APFS Container
      Unmounting disk3s7
      The volume "Nix Store" on disk3s7 couldn't be unmounted because it is in use by process 56610 (ThemeWidgetControlViewService)

      stderr: Error: -69888: Couldn't unmount disk

Metadata

key value
version 0.16.0
os macos
arch aarch64

Once upon a nix rebuild(added some lsp lines to my nvim home-manager extraLuaConfig), many of my ~/ dirs(Documents, etc.) became readable by root only... Which naturally(in my head) called for the total reinstallation of anything nix-related. Which failed(stopped), calling to uninstall nix-darwin first. Which seemed to fail, but, after restarting the terminal session, the /nix/nix-uninstaller proceeded, failing at what is autogenerated above.

zhuher commented 8 months ago

Tried the uninstaller again and got an error url so long it can neither be pasted, nor opened directly. Encoded is the following:

Error:
   0: Error reverting
   0: Action `create_nix_hook_service` errored
      Remove file `/Library/LaunchDaemons/systems.determinate.nix-installer.nix-hook.plist`

      Action `configure_nix` errored
      Multiple child errors

      Action `configure_shell_profile` errored
      Multiple child errors

      Action `create_directory` errored
      Read path `/etc/profile.d`

      Action `create_directory` errored
      Read path `/etc/zsh`

      Action `create_or_merge_nix_config` errored
      Remove file `/etc/nix/nix.conf`

      Action `set_tmutil_exclusion` errored
      Failed to execute command with status 22 `"tmutil" "removeexclusion" "/nix/var"`, stdout:
      stderr: /nix/var: Error (-43) while attempting to change exclusion setting.

      Action `create_users_and_group` errored
      Multiple child errors

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld1"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld2"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld3"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld4"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld5"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld6"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld7"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld8"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld9"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld10"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld11"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld12"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld13"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld14"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld15"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld16"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld17"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld18"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld19"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld20"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld21"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld22"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld23"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld24"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld25"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld26"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld27"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld28"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld29"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld30"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld31"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_user` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Users/_nixbld32"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_group` errored
      Failed to execute command with status 185 `"/usr/bin/dscl" "." "-delete" "/Groups/nixbld"`, stdout: delete: Invalid Path

      stderr: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)

      Action `create_nix_tree` errored
      Multiple child errors

      Action `create_directory` errored
      Read path `/nix/var/nix/daemon-socket`

      Action `create_directory` errored
      Read path `/nix/var/nix/userpool`

      Action `create_directory` errored
      Read path `/nix/var/nix/temproots`

      Action `create_directory` errored
      Read path `/nix/var/nix/profiles/per-user`

      Action `create_directory` errored
      Read path `/nix/var/nix/profiles`

      Action `create_directory` errored
      Read path `/nix/var/nix/gcroots/per-user`

      Action `create_directory` errored
      Read path `/nix/var/nix/gcroots`

      Action `create_directory` errored
      Read path `/nix/var/nix/db`

      Action `create_directory` errored
      Read path `/nix/var/nix`

      Action `create_directory` errored
      Read path `/nix/var/log/nix/drvs`

      Action `create_directory` errored
      Read path `/nix/var/log/nix`

      Action `create_directory` errored
      Read path `/nix/var/log`

      Action `create_directory` errored
      Read path `/nix/var`

      Action `create_nix_volume` errored
      Multiple child errors

      Action `bootstrap_launchctl_service` errored
      Failed to execute command with status 5 `"launchctl" "bootout" "system" "/Library/LaunchDaemons/org.nixos.darwin-store.plist"`, stdout:
      stderr: Boot-out failed: 5: Input/output error

      Action `create_volume_service` errored
      Remove file `/Library/LaunchDaemons/org.nixos.darwin-store.plist`

      Action `encrypt_apfs_volume` errored
      Failed to execute command with status 44 `"/usr/bin/security" "delete-generic-password" "-a" "Nix Store" "-s" "Nix Store" "-l" "disk3 encryption password" "-D" "Encrypted volume password" "-j" "Added automatically by the Nix installer for use by /Library/LaunchDaemons/org.nixos.darwin-store.plist"`, stdout:
      stderr: security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

      Action `create_apfs_volume` errored
      Failed to execute command with status 1 `"/usr/sbin/diskutil" "apfs" "deleteVolume" "Nix Store"`, stdout: Started APFS operation
      Deleting APFS Volume from its APFS Container
      Unmounting disk3s7
      The volume "Nix Store" on disk3s7 couldn't be unmounted because it is in use by process 56610 (ThemeWidgetControlViewService)

      stderr: Error: -69888: Couldn't unmount disk

   0:

Location:
   src/cli/subcommand/uninstall.rs:192
Hoverbear commented 8 months ago

We've seen this error before for different processes, it may be wise for us to add some sort of poll-wait-with-timeout or find some way to prevent running the uninstall while a process is using the mount...

In your second attempt, the long error message is because the installer was attempting to repeat an uninstall and some steps may have already been done.

If you reboot, perhaps ThemeWidgetControlViewService will let go and you can properly uninstall.