home-manager-$USER service failing to start

Created on 15 Dec 2019  路  10Comments  路  Source: nix-community/home-manager

I'm on NixOS-19.09 and the latest home-manager version.

I just did an equivalent to build-vm and I got a failure similar to the end of this thread: https://github.com/rycee/home-manager/issues/107#issuecomment-341959680

The home manager service for the user was erroring out on the profiles/per-user/$USER directory not existing, and things started working after I manually created it. Rebooting the VM doesn't fix it even after logging into the user.

I can probably create a more exact repro if necessary.

Most helpful comment

Should be fixed now.

All 10 comments

I submitted this too quickly, apparently there are still some problems. :P

Ok yeah so what I said the first post still applies, I just aditionally had to make the gcroots directory as well, and clean up the asymmetric profile links as instructed by the journalctl logs.

this was a problem for me. I had to manually create the nix profile for the user:

sudo -i -u [user] nix-env -i hello

in order for home-manager to successfully start the user's service

Got the same issue too. As a dirty workaround to make it work seamlessly I've added:

systemd.services.home-manager-"{{YOUR_USER}}".preStart = ''
      # XXX: Dummy nix-env command to work around https://github.com/rycee/home-manager/issues/948
      ${pkgs.nix}/bin/nix-env -i -E {}
'';

to my configuration.nix so that build-vm or any equivalent works fine without needing any manual intervention

@regnat The workaround as-is fails with another error: attempt to call something which is not a function but a set, at undefined position on my system. Deleting {} at the end of the nix-env command got rid of it.

Anyhow, thank you.

I can confirm the same issue here, expecting a clean solution.

The problem also exists in costum build ISOs, new installs, vms and images. As described in #1154 I use the SystemActivation to create the gcroot.

But I also like the preStart way of doing it described by @regnat. But I belive than an mkdir way would be better, which needs sudo rights.

I created a PR, which creates the directories via mkdir in the system activation phase

I believe https://github.com/rycee/home-manager/pull/1091 is a more proper fix for this issue.

I believe #1091 is a more proper fix for this issue.

I'm full with you, did not look so deep into where the problem comes from

Should be fixed now.

Was this page helpful?
0 / 5 - 0 ratings