Upgrading an existing config deleted nix-daemon.service file and broke everything #79

Open
opened 2026-04-21 13:20:28 +00:00 by blokyk · 6 comments

maybe I'm stupid and did something wrong, but running

$ curl -sSf -L "https://git.lix.systems/lix-project/lix/raw/tag/2.95.1/misc/upgrade-lix.sh" | sudo --preserve-env=PATH bash -s -- 2.95.1

on an existing (2.95.1, yes i know i'm dumb, i forgot i'd already upgraded) config uninstalled (among other things) nix-daemon.service and then was unable to start it again, completely breaking everything. this also means i don't have nix in my path anymore, so i can't take the "upgrade" path anymore, and instead have to reinstall everything. (i tried to just rm /nix/receipt.json && /nix/nix-installer install, but for some reason it fails, complaining about either error: you don't have sufficient rights to use this command or error: could not connect to any lix socket (tried /nix/var/nix/daemon-socket/socket) when trying to --load-db.)

Here is the original installer error, after which nix was unusable:

$ curl -sSf -L "https://git.lix.systems/lix-project/lix/raw/tag/2.95.1/misc/upgrade-lix.sh" | sudo --preserve-env=PATH bash -s -- 2.95.1

+ exec /nix/var/nix/profiles/default/bin/nix run --extra-experimental-features 'nix-command flakes' --extra-substituters https://cache.lix.systems --extra-trusted-public-keys cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= 'git+https://git.lix.systems/lix-project/lix?ref=refs/tags/2.95.1' --extra-experimental-features 'nix-command flakes' upgrade-nix --extra-substituters https://cache.lix.systems --extra-trusted-public-keys cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=
uninstalling 'lix-2.95.1'
building '/nix/store/a09wbm6bn585g6z7rd2pjw389yar4pz8-user-environment.drv'...
warning: Ignoring setting 'bash-prompt-prefix' because experimental feature 'nix-command' is not enabled
installing 'lix-2.95.1'
error: cannot open connection to remote store 'daemon': error: read failed: Connection reset by peer
error: program '/nix/store/slkbw0cg08jhfsax6kc0bf6rvw7rkl26-lix-2.95.1/bin/nix-env' failed with exit code 1

For completeness, I've also attached the full terminal session as nix-install.log (yes, there's a lot of repetition in there, sorry ;-;)

maybe I'm stupid and did something wrong, but running ```sh $ curl -sSf -L "https://git.lix.systems/lix-project/lix/raw/tag/2.95.1/misc/upgrade-lix.sh" | sudo --preserve-env=PATH bash -s -- 2.95.1 ``` on an existing (2.95.1, yes i know i'm dumb, i forgot i'd already upgraded) config uninstalled (among other things) `nix-daemon.service` and then was unable to start it again, completely breaking everything. this also means i don't have nix in my path anymore, so i can't take the "upgrade" path anymore, and instead have to reinstall everything. (i tried to just `rm /nix/receipt.json && /nix/nix-installer install`, but for some reason it fails, complaining about either `error: you don't have sufficient rights to use this command` or `error: could not connect to any lix socket (tried /nix/var/nix/daemon-socket/socket)` when trying to `--load-db`.) Here is the original installer error, after which nix was unusable: ```sh $ curl -sSf -L "https://git.lix.systems/lix-project/lix/raw/tag/2.95.1/misc/upgrade-lix.sh" | sudo --preserve-env=PATH bash -s -- 2.95.1 + exec /nix/var/nix/profiles/default/bin/nix run --extra-experimental-features 'nix-command flakes' --extra-substituters https://cache.lix.systems --extra-trusted-public-keys cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= 'git+https://git.lix.systems/lix-project/lix?ref=refs/tags/2.95.1' --extra-experimental-features 'nix-command flakes' upgrade-nix --extra-substituters https://cache.lix.systems --extra-trusted-public-keys cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= uninstalling 'lix-2.95.1' building '/nix/store/a09wbm6bn585g6z7rd2pjw389yar4pz8-user-environment.drv'... warning: Ignoring setting 'bash-prompt-prefix' because experimental feature 'nix-command' is not enabled installing 'lix-2.95.1' error: cannot open connection to remote store 'daemon': error: read failed: Connection reset by peer error: program '/nix/store/slkbw0cg08jhfsax6kc0bf6rvw7rkl26-lix-2.95.1/bin/nix-env' failed with exit code 1 ``` For completeness, I've also attached the full terminal session as `nix-install.log` (yes, there's a lot of repetition in there, sorry ;-;)
Member

Sounds like there might be a bug in the upgrade-lix script?

This technically isn't related to the installer -- the installer isn't used for the upgrade-lix path; it's only responsible for bootstrapping new installs, not upgrades.

I'm cc'ing @qyriad; hopefully she can make an issue in the core lix repo and figure out what's going on with the script.

Sounds like there might be a bug in the upgrade-lix script? This technically isn't related to the installer -- the installer isn't used for the upgrade-lix path; it's only responsible for bootstrapping new installs, not upgrades. I'm cc'ing @qyriad; hopefully she can make an issue in the core lix repo and figure out what's going on with the script.
Author

i hesitated on whether this should be in lix or lix-installer; i'll open an issue in the core repo

EDIT: done

i hesitated on whether this should be in lix or lix-installer; i'll open an issue in the core repo EDIT: done
qyriad self-assigned this 2026-04-22 10:06:43 +00:00
Owner

Running the script on a system that already has 2.95 is not a case we tested, I think… still not sure why that broke so spectacularly though. We will investigate.

I'm really sorry about this. To be clear: your system is back up and in a usable state again now?

Running the script on a system that already has 2.95 is not a case we tested, I think… still not sure why that broke so spectacularly though. We will investigate. I'm really sorry about this. To be clear: your system is back up and in a usable state again now?
Author

yep, i had to completely wipe the old install and install again, but after an hour of patience i'm pretty much back where i started (just forgot to backup my /etc/nix/nix.conf before uninstalling D: but that's me being stupid). i'm just glad this was on a machine where i have a terminal emulator that isn't nix-managed x)

yep, i had to completely wipe the old install and install again, but after an hour of patience i'm pretty much back where i started (just forgot to backup my `/etc/nix/nix.conf` before uninstalling D: but that's me being stupid). i'm just glad this was on a machine where i have a terminal emulator that isn't nix-managed x)
Owner

That's good to hear.

I've reproduced the issue, and it does seem at least that the store paths remain intact, just the /nix/var/nix/profiles and files in /etc/ are gone

That's good to hear. I've reproduced the issue, and it does seem at least that the *store paths* remain intact, just the `/nix/var/nix/profiles` and files in `/etc/` are gone
Owner

Okay, there is an installer bug here on why /nix/nix-installer repair does not fix the issue:

$ /nix/nix-installer repair --verbose
 INFO nix-installer v3.95.0
`lix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
 INFO nix-installer v3.95.0
 INFO Will ensure the Nix shell profiles are still being sourced
DEBUG plan:plan: Inserting into `/etc/bashrc` already complete
DEBUG plan:plan: Inserting into `/etc/profile.d/nix.sh` already complete
DEBUG plan:plan: Inserting into `/etc/bash.bashrc` already complete
DEBUG plan:plan: Inserting into `/etc/zshrc` already complete
DEBUG plan:plan: Inserting into `/etc/zsh/zshrc` already complete
DEBUG plan:plan: Creating directory `/usr/share/fish/vendor_conf.d` already complete is_mountpoint=false
DEBUG plan:plan: Inserting into `/usr/share/fish/vendor_conf.d/nix.fish` already complete
DEBUG try_execute: Executing: Configure the shell profiles
DEBUG try_execute: Completed: Configure the shell profiles
 INFO Finished repairing successfully!

$ nix --version
-bash: /nix/var/nix/profiles/per-user/root/profile/bin/nix: No such file or directory

$ ls -lah /nix/var/nix/profiles/per-user/root/profile
Permissions Size User Group Date Modified Name
lrwxrwxrwx     - root root   1 Jan  1970  etc -> /nix/store/h9yk2vzsdxqfazifi47w465lbswqy2p5-nss-cacert-3.121/etc/
lrwxrwxrwx     - root root   1 Jan  1970  manifest.nix -> /nix/store/xbj7xnm4ng26idkm200d6j1i38j2sr4b-env-manifest.nix
Okay, there *is* an installer bug here on why `/nix/nix-installer repair` does not fix the issue: ```bash $ /nix/nix-installer repair --verbose INFO nix-installer v3.95.0 `lix-installer` needs to run as `root`, attempting to escalate now via `sudo`... INFO nix-installer v3.95.0 INFO Will ensure the Nix shell profiles are still being sourced DEBUG plan:plan: Inserting into `/etc/bashrc` already complete DEBUG plan:plan: Inserting into `/etc/profile.d/nix.sh` already complete DEBUG plan:plan: Inserting into `/etc/bash.bashrc` already complete DEBUG plan:plan: Inserting into `/etc/zshrc` already complete DEBUG plan:plan: Inserting into `/etc/zsh/zshrc` already complete DEBUG plan:plan: Creating directory `/usr/share/fish/vendor_conf.d` already complete is_mountpoint=false DEBUG plan:plan: Inserting into `/usr/share/fish/vendor_conf.d/nix.fish` already complete DEBUG try_execute: Executing: Configure the shell profiles DEBUG try_execute: Completed: Configure the shell profiles INFO Finished repairing successfully! $ nix --version -bash: /nix/var/nix/profiles/per-user/root/profile/bin/nix: No such file or directory $ ls -lah /nix/var/nix/profiles/per-user/root/profile Permissions Size User Group Date Modified Name lrwxrwxrwx - root root 1 Jan 1970 etc -> /nix/store/h9yk2vzsdxqfazifi47w465lbswqy2p5-nss-cacert-3.121/etc/ lrwxrwxrwx - root root 1 Jan 1970 manifest.nix -> /nix/store/xbj7xnm4ng26idkm200d6j1i38j2sr4b-env-manifest.nix ```
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix-installer#79
No description provided.