-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
opening lock file '/nix/var/nix/profiles/per-user/root/home-manager.lock': No such file or directory #3734
Comments
This is a consequence of #2544, which is starting to cause issues with Nix 2.14 because the default profile location changed, see NixOS/nix#7930. |
I'm on a Kali linux host, and I could solve this issue by doing:
|
Thanks for the report! I'll try to get this resolved over the weekend. |
A similar issue also happens before 2.14 when you try use the store located in So having this bug fixed can be interesting since it would mean that we could have Home-Manager running in almost any Linux system that supports user-namespaces and have access to Nix static binaries. This also means things like https://github.com/nix-community/nix-user-chroot/ (that is unmaintained right now) wouldn't be necessary anymore (at least for the Home-Manager use case). |
@thiagokokada Hmm, wouldn't setting NIX_STATE_DIR work in that case? |
No, for two reasons:
|
Yeah, I also have this issue. Reproducible on Debian. |
With the following patch:
The issue of the topic seems to be fixed, but I am not sure about the implications yet. Also this is not sufficient to make Home-Manager to work with store inside |
Any update on the progress of this? All workarounds suggested are really nothing more than hacks so far. And this is keeping anyone using nix v2.14 or newer from installing home-manager. Iirc, this should also be a problem for new nixos users too, but I have not verified this. But all new nix versions will be using the new profile location, so this is a bit problematic. |
I think it is worth mentioning this pull request here. |
@thiagokokada Thanks for the description! I see your point about NIX_STATE_DIR. If anybody could try out #3742 that would be great. It seems to work OK for me in a fresh Debian VM with Nix 2.14.1 but it would be good to have extra confirmation. |
@cvoges12 The stable version of Nix is still 2.13 at the moment so NixOS users should be safe. IMHO 2.13 should stay as stable until the interaction with Edit: I realized that the above may sound a bit bitter but I assure it is just because I'm very sleepy 🙂 I think managing the user's profiles within the user's directory makes a lot of sense. |
No bitterness inferred heh. I like to be very direct as well. I still think unstable should be prioritized. But yes, I agree that such a major change should be put in the release notes. Anyways, I've cloned the branch that you've made. But I'm not seeing where in the contributing section of the manual on how to build it without nix build --no-link path:<path>/home-manager
"$(nix path-info path:<path>/home-manager)"/activate Which gave an error: I might be wrong in how I'm attempting this, but I do know that at least |
@rycee #3742 works with I had a raspberry pi running Raspbian/Debian 11 that failed finding the lock file. Google searches led me here. jsk@fieldagent:~ $ nix --version
nix (Nix) 2.14.0
jsk@fieldagent:~ $ ls -l .nix*
-rw-r--r-- 1 jsk jsk 133 Mar 2 23:55 .nix-channels
lrwxrwxrwx 1 jsk jsk 43 Feb 28 18:20 .nix-profile -> /home/jsk/.local/state/nix/profiles/profile I ran On
And
Update: Confirmed install. Learned what "" means and ran:
which followed the same behavior (fails on main, OK on branch).
-- UPDATE 2: I maybe running into an issue with jsk@fieldagent:~ $ home-manager switch -v
/nix/store/h2b36gwxhryrzb1hs81shhj6grm0fk14-home-manager-generation
Starting Home Manager activation
Sanity checking Nix
error: opening lock file '/nix/var/nix/profiles/per-user/jsk/home-manager.lock': No such file or directory I may have something backwards. I have
So it looks like there's another reference somewhere, or I have it backwards. |
@jskulski Hmm, it may be that you got an older commit. I think the readonly variable issues should be resolved in the latest version. I merged the PR to master so now it should be possible to test just by updating HM in the regular way. |
Thanks, installed and everything working as expected for me. |
@jskulski Great to hear! Thanks for trying out and reporting on the result. I'll close this issue for now, if anybody encounters the same issue after updating please write a comment. |
I seem to be having the same issue, also on Arch Linux. My For reference I'm trying to create dotfiles with a nix flake, with pretty much the same template as this. Running EDIT: The guide uses release-22.11 which has this bug. switching to unstable worked |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
I'm trying the same and running into this issue on Ubuntu 20.04. I (re)installed > nix run home-manager/master -- --flake ~/dotfiles/hm-only switch
error: opening lock file '/nix/var/nix/profiles/per-user/artem/home-manager.lock': Permission denied
> ll /nix/var/nix/profiles/per-user/artem
lrwxrwxrwx 15 root 6 May 16:39 channels -> channels-4-link
lrwxrwxrwx 60 root 11 Dec 2020 channels-2-link -> /nix/store/qni5gy8rjjyw3vpqh0ij10mq6h52x206-user-environment
lrwxrwxrwx 60 root 8 Oct 2021 channels-3-link -> /nix/store/95wnq250bhn6jk73ivd67s6dh2l3v85g-user-environment
lrwxrwxrwx 60 root 6 May 16:39 channels-4-link -> /nix/store/7ibvmbxqls2310lkflls4ibxrpwk84ms-user-environment
lrwxrwxrwx 14 root 6 May 16:41 profile -> profile-2-link
lrwxrwxrwx 60 root 27 Apr 2020 profile-1-link -> /nix/store/04z1n36fhpdr0fayp2s2v3fp3njvsr79-user-environment
lrwxrwxrwx 60 root 6 May 16:41 profile-2-link -> /nix/store/j8dis32qf9hmfbgg1gb58iz8ara328q6-user-environment Could someone help me figuring what to do about it? Should I provide more info? My config (including the > nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 5.4.0-122-generic, Ubuntu, 20.04.4 LTS (Focal Fossa), nobuild`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.13.3`
- channels(artem): `"nixpkgs-23.05pre481435.caf436a52b2"`
- channels(root): `"nixpkgs"`
- nixpkgs: `/home/artem/.nix-defexpr/channels/nixpkgs` |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
I just ran into this again on a fresh |
I am also having this issue. Same setup as @nuttycom. Please reopen. Current workaround for multi-user install is to uninstall nix and reinstall version 2.13.0 using:
|
Similarly, the following worked for me: |
this work like a charm, thank you |
Just ran into this problem with a fresh Mac. System information:
I had to do both: mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER
sudo chown -R $USER:nixbld /nix/var/nix/{profiles,gcroots}/per-user/$USER to get HM switch to work. |
Looks to me that Home-Manager itself is failing to create the profile directory in the user home if it doesn't exist. CC @rycee. |
On Ubuntu:
Worked perfectly. I wonder why we have to do that... UX wise it's very repellent. |
Are you following the right branch?
Is there an existing issue for this?
Issue description
When installing home-manager on a non-NixOS Linux Distro, I am encountering an error during installation.
This fails consistently, and I have attempted to install it on multiple distros inside of WSL, including Ubuntu, Debian, and Arch.
A friend of mine is also experiencing this exact issue, but he's running Fedora on bare-metal, so this does not seem to be exclusively happening on WSL.
I have also tried installing home-manager on both multi-user Nix installs, and single-user, but the result is the same.
Maintainer CC
No response
System information
The text was updated successfully, but these errors were encountered: