nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.69k stars 1.76k forks source link

bug: home-manager activation fails when a switch also restarts nix-daemon #4014

Open arcnmx opened 1 year ago

arcnmx commented 1 year ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

restarting the following units: home-manager-arc.service, nix-daemon.service, polkit.service Job for home-manager-arc.service failed because the control process exited with error code. See "systemctl status home-manager-arc" and "journalctl -xeu home-manager-arc.service" for details.

systemd[1]: Starting Home Manager environment for arc... hm-activate-arc[4643]: Starting Home Manager activation systemd[1]: Stopping Nix Daemon... nix-daemon[1708]: accepted connection from pid 4651, user arc (trusted) nix-daemon[4655]: unexpected Nix daemon error: error: interrupted by the user hm-activate-arc[4651]: error: cannot open connection to remote store 'daemon': error: reading from file: Connection reset by peer systemd[1]: Stopped Authorization Manager. systemd[1]: nix-daemon.service: Deactivated successfully. systemd[1]: Stopped Nix Daemon. systemd[1]: home-manager-arc.service: Main process exited, code=exited, status=1/FAILURE systemd[1]: home-manager-arc.service: Failed with result 'exit-code'.

Presumably due to the following only ordering around nix-daemon.socket and not nix-daemon.service:

:;  systemctl show home-manager-arc.service -p After
After=-.mount systemd-journald.socket nix-daemon.socket basic.target system.slice sysinit.target

Maintainer CC

No response

System information

- system: `"x86_64-linux"`
 - host os: `Linux 6.3.3, NixOS, 23.11 (Tapir), 23.11pre-git`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - nixpkgs: `github:NixOS/nixpkgs/7c5d126b21400c74614801ccefe607f4aa87bad1`
 - home-manager: `github:nix-community/home-manager/58eb968c21d309a6c2b020ea8d64e25c38ceebba`
Xe commented 1 year ago

I run into this too. I've figured out that if you run the deploy again it works fine.

stale[bot] commented 10 months ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] commented 7 months ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

awebeer256 commented 3 months ago

I have the same problem, but making this change:

Presumably due to the following only ordering around nix-daemon.socket and not nix-daemon.service

doesn't fix it. Adding my user to nix.settings.allowed-users (credit) did, but obviously that won't work if you want to use Home Manager for users that you don't want to have that permission!