Skip to content

nix-installer did not install the nix-daemon service properly.  #1263

@carsoncall

Description

@carsoncall
  1. Your OS (Linux, Mac) and architecture (x86_64, aarch64)
    • Fedora 40 (Sway), x86_64
  2. Your nix-installer version (/nix/nix-installer --version)
    • nix-installer 0.27.0
  3. The thing you tried to run (eg nix-installer)
    • curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate
  4. What happened (the output of the command, please)
    • Not sure, was a few days ago. No sign of an error though, as far as I can tell.
  5. What you expected to happen
    • I expected Nix to work out of the box.
  6. If you tried to fix it, what did you try?
    • I tried updating nix by running sudo -i nix upgrade-nix, which simply output:
replacing old 'nix-2.24.9'
installing 'nix-2.24.9'
building '/nix/store/bx8csgm2db868w6dcp8sc3yl1aji393a-user-environment.drv'... 

And then hung forever.

  • I tried running /nix/nix-installer repair, and it output:
INFO nix-installer v0.27.0
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
[sudo] password for carsoncall:
 INFO nix-installer v0.27.0
 INFO Will ensure the Nix shell profiles are still being sourced
 INFO Finished repairing successfully!
  • I then tried uninstalling:
INFO nix-installer v0.27.0
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
 INFO nix-installer v0.27.0
 INFO nix-installer v0.27.0
Nix uninstall plan (v0.27.0)

Planner: linux

Configured settings:
* determinate_nix: true

Planned actions:
* Remove the Determinate Nix daemon
* Remove the directory `/etc/tmpfiles.d` if no other contents exists
* Remove the SELinux policy for Nix
* Unconfigure the shell profiles
* Remove the Nix configuration in `/etc/nix/nix.conf`
* Unset the default Nix profile
* Remove Nix users and group
* Remove the directory tree in `/nix`
* Remove the Determinate Nix superpowers
* Remove the directory `/nix`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Revert: Remove directory `/nix/temp-install-dir`
 INFO Revert: Configure the Determinate Nix daemon
 INFO Revert: Create directory `/etc/tmpfiles.d`
 INFO Revert: Install an SELinux Policy for Nix
 INFO Revert: Configure Nix
 INFO Revert: Create build users (UID 30001-30032) and group (GID 30000)
 INFO Revert: Provision Nix
 INFO Revert: Install Determinate Nixd
 INFO Revert: Create directory `/nix`
ERROR Uninstallation complete, some errors encountered
Error:
   0: Error reverting
   0: Action `configure_determinate_nixd_init_service` errored
      Remove file `/etc/systemd/system/nix-daemon.service`
   0:

Location:
   src/cli/subcommand/uninstall.rs:192

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Consider reporting this error using this URL: https://github.com/DeterminateSystems/nix-installer/issues/new?title=%3Cautogenerated-issue%3E&body=%23%23+Error%0A%60%60%60%0AError%3A+%0A+++0%3A+Error+reverting%0A+++0%3A+Action+%60configure_determinate_nixd_init_service%60+errored%0A++++++Remove+file+%60%2Fetc%2Fsystemd%2Fsystem%2Fnix-daemon.service%60%0A%0A%60%60%60%0A%0A%23%23+Metadata%0A%7Ckey%7Cvalue%7C%0A%7C--%7C--%7C%0A%7C**version**%7C0.27.0%7C%0A%7C**os**%7Clinux%7C%0A%7C**arch**%7Cx86_64%7C%0A

Looks like it didn't find the file... because it doesn't exist.

The issue, as far as I can tell, is the following:
Here's an excerpt from the receipt from the installation:

"action": {
        "action_name": "configure_determinate_nixd_init_service",
        "init": "Systemd",
        "configure_init_service": {
          "action": {
            "action_name": "configure_init_service",
            "init": "Systemd",
            "start_daemon": true,
            "service_src": null,
            "service_name": null,
            "service_dest": "/etc/systemd/system/nix-daemon.service",
            "socket_files": [
              {
                "name": "nix-daemon.socket",
                "src": {
                  "Literal": "[Unit]\nDescription=Determinate Nix Daemon Socket\nBefore=multi-user.target\nRequiresMountsFor=/nix/store\nRequiresMountsFor=/nix/var\nRequiresMountsFor=/nix/var/nix/db\nConditionPathIsReadWrite=/nix/var/nix/daemon-socket\n\n[Socket]\nFileDescriptorName=nix-daemon.socket\nListenStream=/nix/var/nix/daemon-socket/socket\n\n[Install]\nWantedBy=sockets.target\n"
                },
                "dest": "/etc/systemd/system/nix-daemon.socket"
              },
              {
                "name": "determinate-nixd.socket",
                "src": {
                  "Literal": "[Unit]\nDescription=Determinate Nixd Daemon Socket\nBefore=multi-user.target\nRequiresMountsFor=/nix/store\nRequiresMountsFor=/nix/var/determinate\n\n[Socket]\nFileDescriptorName=determinate-nixd.socket\nDirectoryMode=0755\nListenStream=/nix/var/determinate/determinate-nixd.socket\nService=nix-daemon.service\n\n[Install]\nWantedBy=sockets.target\n"
                },
                "dest": "/etc/systemd/system/determinate-nixd.socket"
              }
            ]
          },
          "state": "Completed"
        }
      },
      "state": "Completed"

Both of the sockets are enabled, but there does not exist any file with the path /etc/systemd/system/nix-daemon.service. As far as I can tell, the only way to be able to use Nix at all in this state is to run determinate-nixd daemon. This is not ideal. I am running SELinux in permissive mode, so it would not have interfered.

Let me know if you need any more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions