upgrade-nix fails to install instanced nix-daemon@.service #1112

Closed
opened 2026-01-29 17:55:58 +00:00 by lunaphied · 11 comments
Owner

Describe the bug

When you upgrade to a nightly Lix from an existing non-NixOS install, the new instanced systemd target does not get linked in. As a result, daemon socket activation stops working correctly, as the socket unit file has Accept=Yes which causes systemd to expect th

Steps To Reproduce

  1. Install Lix from the installer following the instructions at https://lix.systems/install (curl -sSf -L https://install.lix.systems/lix | sh -s -- install)
  2. Build a nightly Lix (for example rev 56988d8605) and capture the store path.
  3. Upgrade the installed lix by doing sudo nix upgrade-nix --store-path $builtStorePath.
  4. Reboot the system (this is the easiest way to reload the systemd units and restart them correctly)
  5. Observe that nix store ping no longer works when using the daemon.

Expected behavior

Either it should upgrade correctly or some kind of error should be thrown indicating a manual step is required for this update.

nix --version output

nix (Lix, like Nix) 2.95.0-pre20260127-dev_9861915
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/iris.iridium/.config/nix/nix.conf:/etc/xdg/xdg-ubuntu/nix/nix.conf:/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/lfpgnl5wfsfpgd955qfbs6rcac0nbzv2-lix-2.95.0-pre20260127-dev_9861915/share
## Describe the bug When you upgrade to a nightly Lix from an existing non-NixOS install, the new instanced systemd target does not get linked in. As a result, daemon socket activation stops working correctly, as the socket unit file has `Accept=Yes` which causes systemd to expect th ## Steps To Reproduce 1. Install Lix from the installer following the instructions at https://lix.systems/install (`curl -sSf -L https://install.lix.systems/lix | sh -s -- install`) 2. Build a nightly Lix (for example rev 56988d860593a5fd8153d02a0ca5469508378626) and capture the store path. 3. Upgrade the installed lix by doing `sudo nix upgrade-nix --store-path $builtStorePath`. 4. Reboot the system (this is the easiest way to reload the systemd units and restart them correctly) 5. Observe that `nix store ping` no longer works when using the daemon. ## Expected behavior Either it should upgrade correctly or some kind of error should be thrown indicating a manual step is required for this update. ## `nix --version` output ``` nix (Lix, like Nix) 2.95.0-pre20260127-dev_9861915 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/iris.iridium/.config/nix/nix.conf:/etc/xdg/xdg-ubuntu/nix/nix.conf:/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/lfpgnl5wfsfpgd955qfbs6rcac0nbzv2-lix-2.95.0-pre20260127-dev_9861915/share ```
lunaphied added this to the 2.95 milestone 2026-01-29 17:55:58 +00:00
lunaphied changed title from Upgrad to upgrade-nix fails to install instanced nix-daemon@ systemd unit 2026-01-29 17:56:23 +00:00
lunaphied changed title from upgrade-nix fails to install instanced nix-daemon@ systemd unit to upgrade-nix fails to install instanced nix-daemon@.service 2026-01-29 17:56:31 +00:00
Owner

tbh upgrade-nix should just be deleted. on a nixos system it has no purpose, and on non-nixos systems it is bound to always cause problems of this sort. the installer has much better knowledge of where to put what and how to activate it, upgrading an installation should be done via the installer as well to take advantage of that

tbh `upgrade-nix` should just be deleted. on a nixos system it has no purpose, and on non-nixos systems it is bound to always cause problems of this sort. the installer has much better knowledge of where to put what and how to activate it, upgrading an installation should be done via the installer as well to take advantage of that
Author
Owner

I totally agree but right now this is our supported flow until that work gets done and either we need to block release on the installer improvements or (more realistically) block release on adding special case handling to upgrade-nix (I imagine we could add some kind of script that gets run after the profile is built but before switching to it if we wanted to make it somewhat generic)

I totally agree but right now this is our supported flow until that work gets done and either we need to block release on the installer improvements or (more realistically) block release on adding special case handling to upgrade-nix (I imagine we could add some kind of script that gets run after the profile is built but before switching to it if we wanted to make it somewhat generic)
Owner

yes, the releaswe cannot happen before we have some solution to this. we would greatly prefer doing this in the installer if at all possible because having two (diverging?) methods to get the latest version is likely to cause ever more problems as time passes, but we're not familiar with how active installer maintenance is right now

yes, the releaswe cannot happen before we have some solution to this. we would greatly prefer doing this in the installer if at all possible because having two (diverging?) methods to get the latest version is likely to cause ever more problems as time passes, but we're not familiar with how active installer maintenance is right now
Owner

it seems that the most reasonable thing we can do is to refuse to upgrade with an additional confirmation step if systemctl is present and nix-daemon.socket is enabled without a nix-daemon@.socket being present. that should be easy enough to add and can link to our upgrade documentation to explain the gory details

it seems that the most reasonable thing we can do is to refuse to upgrade with an additional confirmation step if `systemctl` is present and `nix-daemon.socket` is enabled without a `nix-daemon@.socket` being present. that should be easy enough to add and can link to our upgrade documentation to explain the gory details
Member

@pennae wrote in #1112 (comment):

it seems that the most reasonable thing we can do is to refuse to upgrade with an additional confirmation step if systemctl is present and nix-daemon.socket is enabled without a nix-daemon@.socket being present. that should be easy enough to add and can link to our upgrade documentation to explain the gory details

This is what we should go with, for now. Eventually (next release, prolly?) we'll have the installer set up a basic profile manager to handle system upgrades, and then we can tear out upgrade-nix.

@pennae wrote in https://git.lix.systems/lix-project/lix/issues/1112#issuecomment-17970: > it seems that the most reasonable thing we can do is to refuse to upgrade with an additional confirmation step if `systemctl` is present and `nix-daemon.socket` is enabled without a `nix-daemon@.socket` being present. that should be easy enough to add and can link to our upgrade documentation to explain the gory details This is what we should go with, for now. Eventually (next release, prolly?) we'll have the installer set up a basic profile manager to handle system upgrades, and then we can tear out `upgrade-nix`.
Member

also, just to keep the record consistent:

the installer has much better knowledge of where to put what and how to activate it

We decided the installer doesn't; and instead a profile management tool is the actual thing that should be handling this.

also, just to keep the record consistent: > the installer has much better knowledge of where to put what and how to activate it We decided the installer doesn't; and instead a _profile management tool_ is the actual thing that should be handling this.
ktemkin self-assigned this 2026-03-08 14:27:24 +00:00
Owner

I believe we are done here but I will pin it for easier discovery and we should monitor things.

I believe we are done here but I will pin it for easier discovery and we should monitor things.
raito closed this issue 2026-03-26 11:38:43 +00:00

I have run into the same problem (after upgrading first to 2.95.0 and then to 2.95.1) and I'm bit confused since it seems like it should be solved? So, what's the current workaround/solution?

I have run into the same problem (after upgrading first to 2.95.0 and then to 2.95.1) and I'm bit confused since it seems like it should be solved? So, what's the current workaround/solution?
Owner

@razem Have you upgraded using the script mentioned in https://lix.systems/install/ i.e.

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

This script takes care of things that the installer cannot, namely service management updates.

If not, that can help. If yes, then, we have a problem and it would help us to understand which steps did you take so far.

@razem Have you upgraded using the script mentioned in https://lix.systems/install/ i.e. ```bash 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 ``` This script takes care of things that the installer cannot, namely service management updates. If not, that can help. If yes, then, we have a problem and it would help us to understand which steps did you take so far.

@raito Well, no. I intuitively went to https://docs.lix.systems/manual/lix/stable/installation/upgrading.html and used nix-upgrade subcommand. Maybe it should be marked as deprecated.

Using the script, things ended… catastrophically. 🙃

$ 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
[sudo] password for ...:
WARNING: manual intervention will be required to complete this Lix install!
The Lix daemon is now an instanced unit that is fully socket-activated.

This requires a new systemd unit: nix-daemon@.service

'nix upgrade-nix' will provide a profile with a new Lix, likely one of:
  /nix/var/nix/profiles/default
  /nix/var/nix/profiles/per-user/root/profile
It will have the instanced systemd unit file at 'lib/systemd/system/nix-daemon@.service'

You should symlink or copy this file to '/etc/systemd/system/nix-daemon@.service',
and then run 'systemctl daemon-reload && systemctl restart nix-daemon.socket'.
Until you do that, all nix commands will require root and '--store local'.

Installation cancelled!

So I created the symlink as instructed:

$ sudo ln -s /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon@.service /etc/systemd/system

But I forgot to restart the daemon (I know, silly me 🙃). So running the upgrade script again tanked my install:

$ 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'
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

I don't know if there was any way to save it at that point, but I ended up uninstalling Lix completely and reinstalling it from scratch. I only had a few packages in my profile, so not really a big deal. Maybe the upgrade script could check if the daemon is running before uninstalling the current version?

@raito Well, no. I intuitively went to https://docs.lix.systems/manual/lix/stable/installation/upgrading.html and used `nix-upgrade` subcommand. Maybe it should be marked as deprecated. Using the script, things ended… catastrophically. 🙃 ```bash $ 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 [sudo] password for ...: WARNING: manual intervention will be required to complete this Lix install! The Lix daemon is now an instanced unit that is fully socket-activated. This requires a new systemd unit: nix-daemon@.service 'nix upgrade-nix' will provide a profile with a new Lix, likely one of: /nix/var/nix/profiles/default /nix/var/nix/profiles/per-user/root/profile It will have the instanced systemd unit file at 'lib/systemd/system/nix-daemon@.service' You should symlink or copy this file to '/etc/systemd/system/nix-daemon@.service', and then run 'systemctl daemon-reload && systemctl restart nix-daemon.socket'. Until you do that, all nix commands will require root and '--store local'. Installation cancelled! ``` So I created the symlink as instructed: ```bash $ sudo ln -s /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon@.service /etc/systemd/system ``` But I forgot to restart the daemon (I know, silly me 🙃). So running the upgrade script again tanked my install: ```bash $ 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' 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 ``` I don't know if there was any way to save it at that point, but I ended up uninstalling Lix completely and reinstalling it from scratch. I only had a few packages in my profile, so not really a big deal. Maybe the upgrade script could check if the daemon is running before uninstalling the current version?
Owner

@razem I'm really sorry for your experience but thanks a lot for the all details to help us build a better experience. We will definitely use these info to improve the script.

@razem I'm really sorry for your experience but thanks a lot for the all details to help us build a better experience. We will definitely use these info to improve the script.
Sign in to join this conversation.
No milestone
No project
No assignees
5 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#1112
No description provided.