Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home-manager-$USER service failing to start #948

Closed
deliciouslytyped opened this issue Dec 15, 2019 · 10 comments
Closed

home-manager-$USER service failing to start #948

deliciouslytyped opened this issue Dec 15, 2019 · 10 comments

Comments

@deliciouslytyped
Copy link

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: #107 (comment)

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.

@deliciouslytyped
Copy link
Author

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

@deliciouslytyped
Copy link
Author

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.

@tristanpemble
Copy link

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

@thufschmitt
Copy link

thufschmitt commented Jan 29, 2020

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

@ghost
Copy link

ghost commented Feb 3, 2020

@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.

@LEXUGE
Copy link

LEXUGE commented Feb 19, 2020

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

Kloenk added a commit to Kloenk/home-manager that referenced this issue Apr 18, 2020
make sure that the profile directory and the gcroot of the user exists
while starting the home-manager user unit. This fixes nix-community#948
Kloenk added a commit to Kloenk/home-manager that referenced this issue Apr 18, 2020
make sure that the profile directory and the gcroot of the user exists
while starting the home-manager user unit. This fixes nix-community#948
Kloenk added a commit to Kloenk/home-manager that referenced this issue Apr 18, 2020
make sure that the profile directory and the gcroot of the user exists
while starting the home-manager user unit. This fixes nix-community#948
@Kloenk
Copy link
Member

Kloenk commented Apr 18, 2020

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

@misuzu
Copy link

misuzu commented Apr 18, 2020

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

@Kloenk
Copy link
Member

Kloenk commented Apr 18, 2020

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

rycee added a commit that referenced this issue May 16, 2020
Using the `nix-env` command is far more robust. It also has the
benefit that if the per-user `profiles` and `gcroots` directories do
not exist then they will be created with the correct permissions.

Because of the second point this commit also removes the `mkdir` step
of the installation instructions.

PR #1239
Closes #474, #948, #1091
@rycee
Copy link
Member

rycee commented May 16, 2020

Should be fixed now.

@rycee rycee closed this as completed May 16, 2020
NickHu pushed a commit to NickHu/home-manager that referenced this issue May 19, 2020
Using the `nix-env` command is far more robust. It also has the
benefit that if the per-user `profiles` and `gcroots` directories do
not exist then they will be created with the correct permissions.

Because of the second point this commit also removes the `mkdir` step
of the installation instructions.

PR nix-community#1239
Closes nix-community#474, nix-community#948, nix-community#1091
rycee added a commit that referenced this issue May 20, 2020
Using the `nix-env` command is far more robust. It also has the
benefit that if the per-user `profiles` and `gcroots` directories do
not exist then they will be created with the correct permissions.

Because of the second point this commit also removes the `mkdir` step
of the installation instructions.

PR #1239
Closes #474, #948, #1091

(cherry picked from commit 9ec9f00)
frobware pushed a commit to frobware/home-manager that referenced this issue May 25, 2020
Using the `nix-env` command is far more robust. It also has the
benefit that if the per-user `profiles` and `gcroots` directories do
not exist then they will be created with the correct permissions.

Because of the second point this commit also removes the `mkdir` step
of the installation instructions.

PR nix-community#1239
Closes nix-community#474, nix-community#948, nix-community#1091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants