nix icon indicating copy to clipboard operation
nix copied to clipboard

Renaming a user breaks nix-env on new install with old home-directory

Open hyperfekt opened this issue 6 years ago • 4 comments

After renaming a user, /home/[newname]/.nix-profile still points to /nix/var/nix/profiles/per-user/[oldname]/profile. This works fine, until for some reason /nix is regenerated - for example due to reinstalling NixOS but keeping the old home directory. Then, nix-env fails with error: opening lock file '/nix/var/nix/profiles/per-user/[oldname]/profile.lock': No such file or directory. This could be either a documentation, an error message or an implementation issue, depending on how you see it.

hyperfekt avatar Sep 22 '19 18:09 hyperfekt

This is related to https://github.com/NixOS/nix/issues/509. We should move per-user data out of /nix/var/nix and into their home directories.

edolstra avatar Sep 22 '19 23:09 edolstra

I marked this as stale due to inactivity. → More info

stale[bot] avatar Feb 18 '21 04:02 stale[bot]

I closed this issue due to inactivity. → More info

stale[bot] avatar Apr 28 '22 23:04 stale[bot]

Today single-user install failed me with the error below:

copying Nix to /nix/store....................................................
installing 'nix-2.22.1'
building '/nix/store/x8hfibkpb6as4rji91ln5xp5lnj02gn8-user-environment.drv'...
error: opening lock file '/nix/var/nix/profiles/per-user/<user>/profile.lock': No such file or directory
/tmp/nix-binary-tarball-unpack.kaPc1MktsZ/unpack/nix-2.22.1-x86_64-linux/install: unable to install Nix into your default profile

And i could make it work deleting ~/.nix-profile after reading this issue

danse-nr3 avatar May 17 '24 09:05 danse-nr3