home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

bug: Permission denied when updating home-manager profile

Open PAI5REECHO opened this issue 3 years ago • 3 comments

Are you following the right branch?

  • [X] My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • [X] I have searched the existing issues

Issue description

$ home-manager switch
...
error: creating symlink from '/nix/var/nix/profiles/default-32-link.tmp-...' to '/nix/store/...-profile': Permission denied

Oops, Nix failed to install your new Home Manager profile!

Perhaps there is a conflict with a package that was installed using
"nix profile install"? Try running

    nix profile list

and if there is a conflicting package you can remove it with

    nix profile remove {number | store path}

Then try activating your Home Manager configuration again.

Maintainer CC

No response

System information

- system: `"x86_64-linux"`
 - host os: `Linux 5.18.10, NixOS, 22.11 (Raccoon), 22.11.20220809.36cc29d`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.10.0pre20220810_8f3fdef`
 - channels(root): `"home-manager, nixos, nixpkgs"`
 - channels(me): `"home-manager"`
 - nixpkgs: `/nix/store/5yyw0c73qqqqy3brz1ny4vm0fz72jj79-source`

PAI5REECHO avatar Aug 25 '22 00:08 PAI5REECHO

The /nix/var/nix/profiles/default-32-link.tmp-... path doesn't look right. I would have expected a per-user in there.

@blaggacao, have you seen this before with nix profile install?

rycee avatar Aug 25 '22 07:08 rycee

Some additional info:

$ nix profile list
$ nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
$ sudo -s
# nix profile list
# nix-channel --list
nixos https://nixos.org/channels/nixos-21.11

PAI5REECHO avatar Aug 30 '22 20:08 PAI5REECHO

@rycee & @blaggacao, is there anything I should do to try and work around this? I haven't been able to update my home-manager profile for a long time now.

PAI5REECHO avatar Sep 16 '22 10:09 PAI5REECHO

what's NIX_PATH set to btw?

eclairevoyant avatar Nov 12 '22 04:11 eclairevoyant

Uf! Permission denied! Reproducability breaking on the side effect boundary.

I'd really start from the most minimal context of that error which is trying to do a symlink.

  • Can you do that manually?
  • If no, why? (Permission denied?)
  • If yes, how is the error environment different from the manual one? (I wouldn't know, either, atm)

... and then work backwards from there.

There are two strategies to resolving this:

  • shot in the dark based on expert intuition (I'm sorry, I don't have any, here, for my part)
  • work backwards from the error context (tedious but guaranteed to work)

Oh, in these cases, also always try to update your nix version. Newer nix is notorious for having all sorts of regressions / bugs.

blaggacao avatar Nov 12 '22 10:11 blaggacao

Still unable to home-manager switch/nix profile install ...

what's NIX_PATH set to btw?

/home/me/.nix-defexpr/channels nixpkgs=/nix/store/y0vjv4jpzrwdw0x5m4p9c2p4w7mrcz3w-source

PAI5REECHO avatar Jan 03 '23 21:01 PAI5REECHO

I'm hitting this now as well with:

Jan 20 12:48:06 triton hm-activate-nrd[1321136]: error: creating symlink from '/test-1-link.tmp-1321136-2018944206' to '/nix/store/0zdsafjgba7przfxl43vwq8pb9r9xkyb-profile': Permission denied

I also noticed that nix profile list shows empty but there are still old hm profiles in /nix/var/nix/profiles. This might be an upstream issue

edit If I manually remove all symlinks in the profile directory for my user the issue clears up. I see it looks for a manifest file and if found tries to run nix profile remove which is where it fails (because nix profile list returns empty).

nrdxp avatar Jan 20 '23 19:01 nrdxp

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] avatar Apr 21 '23 07:04 stale[bot]

If I manually remove all symlinks in the profile directory for my user the issue clears up. I see it looks for a manifest file and if found tries to run nix profile remove which is where it fails (because nix profile list returns empty).

@nrdxp what files do I need to unlink specifically?

Currently I'm running into:

$ nix profile remove --verbose
removed 0 packages, kept 0 packages
warning: Use 'nix profile list' to see the current profile.
error: creating symlink from '/nix/var/nix/profiles/.0_default' to 'default-23-link': Permission denied

PAI5REECHO avatar Aug 21 '23 02:08 PAI5REECHO

@nrdxp what files do I need to unlink specifically?

Sorry been way to long since I ran into this, can't recall specifically. You can look under ~/.local/state/nix/profiles for anything with suspicious permissions perhaps though :shrug:

nrdxp avatar Sep 07 '23 23:09 nrdxp

@nrdxp

$ ls -a ~/.local/state/nix/profiles
.  ..

$ nix profile remove --verbose
removed 0 packages, kept 0 packages
warning: Use 'nix profile list' to see the current profile.
error: creating symlink from '/nix/var/nix/profiles/.0_default' to 'default-20-link': Permission denied

PAI5REECHO avatar Sep 13 '23 04:09 PAI5REECHO

so the permissions on nix/var/nix/profiles are too restrictive most likely

nrdxp avatar Sep 20 '23 06:09 nrdxp

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] avatar Dec 20 '23 19:12 stale[bot]