[Nix#8508] nix-collect-garbage -d does not clean up user profiles in XDG directories when run as root #151

Open
opened 2024-03-19 01:01:30 +00:00 by lix-bot · 1 comment
Member

Upstream-Issue: NixOS/nix#8508

Describe the bug

❯ ls .local/state/nix/profiles 
home-manager@  home-manager-14-link@  home-manager-15-link@  home-manager-16-link@  profile@  profile-12-link@  profile-13-link@  profile-14-link@

❯ sudo nix-collect-garbage -d
removing old generations of profile /nix/var/nix/profiles/per-user/root/profile
removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager
removing profile version 257
removing profile version 258
removing old generations of profile /nix/var/nix/profiles/per-user/k900/profile
removing old generations of profile /nix/var/nix/profiles/system
removing profile version 502
removing profile version 503
removing old generations of profile /nix/var/nix/profiles/default
removing old generations of profile /nix/var/nix/profiles/per-user/root/profile
removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager
finding garbage collector roots...
<snip>

❯ ls .local/state/nix/profiles
home-manager@  home-manager-14-link@  home-manager-15-link@  home-manager-16-link@  profile@  profile-12-link@  profile-13-link@  profile-14-link@

❯ sudo nix-collect-garbage -d --option use-xdg-base-directories true
removing old generations of profile /nix/var/nix/profiles/per-user/root/profile
removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager
removing old generations of profile /nix/var/nix/profiles/per-user/k900/profile
removing old generations of profile /nix/var/nix/profiles/system
removing old generations of profile /nix/var/nix/profiles/default
removing old generations of profile /nix/var/nix/profiles/per-user/root/profile
removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager
finding garbage collector roots...
<snip>

❯ ls .local/state/nix/profiles
home-manager@  home-manager-14-link@  home-manager-15-link@  home-manager-16-link@  profile@  profile-12-link@  profile-13-link@  profile-14-link@

❯ nix-collect-garbage -d     
removing old generations of profile /home/k900/.local/state/nix/profiles/home-manager
removing profile version 14
removing profile version 15
removing old generations of profile /home/k900/.local/state/nix/profiles/profile
removing profile version 12
removing profile version 13
removing old generations of profile /nix/var/nix/profiles/per-user/k900/profile
finding garbage collector roots...
<snip>

Expected behavior

home-manager generations are cleaned up on the first sudo nix-collect-garbage -d invocation.

nix-env --version output

nix-collect-garbage (Nix) 2.16.1

Additional context

I'm not sure when this started happening, but I feel like it might have something to do with HM switching to XDG paths?

Priorities

Add 👍 to issues you find important.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/8508 **Describe the bug** ``` ❯ ls .local/state/nix/profiles home-manager@ home-manager-14-link@ home-manager-15-link@ home-manager-16-link@ profile@ profile-12-link@ profile-13-link@ profile-14-link@ ❯ sudo nix-collect-garbage -d removing old generations of profile /nix/var/nix/profiles/per-user/root/profile removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager removing profile version 257 removing profile version 258 removing old generations of profile /nix/var/nix/profiles/per-user/k900/profile removing old generations of profile /nix/var/nix/profiles/system removing profile version 502 removing profile version 503 removing old generations of profile /nix/var/nix/profiles/default removing old generations of profile /nix/var/nix/profiles/per-user/root/profile removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager finding garbage collector roots... <snip> ❯ ls .local/state/nix/profiles home-manager@ home-manager-14-link@ home-manager-15-link@ home-manager-16-link@ profile@ profile-12-link@ profile-13-link@ profile-14-link@ ❯ sudo nix-collect-garbage -d --option use-xdg-base-directories true removing old generations of profile /nix/var/nix/profiles/per-user/root/profile removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager removing old generations of profile /nix/var/nix/profiles/per-user/k900/profile removing old generations of profile /nix/var/nix/profiles/system removing old generations of profile /nix/var/nix/profiles/default removing old generations of profile /nix/var/nix/profiles/per-user/root/profile removing old generations of profile /nix/var/nix/profiles/per-user/root/home-manager finding garbage collector roots... <snip> ❯ ls .local/state/nix/profiles home-manager@ home-manager-14-link@ home-manager-15-link@ home-manager-16-link@ profile@ profile-12-link@ profile-13-link@ profile-14-link@ ❯ nix-collect-garbage -d removing old generations of profile /home/k900/.local/state/nix/profiles/home-manager removing profile version 14 removing profile version 15 removing old generations of profile /home/k900/.local/state/nix/profiles/profile removing profile version 12 removing profile version 13 removing old generations of profile /nix/var/nix/profiles/per-user/k900/profile finding garbage collector roots... <snip> ``` **Expected behavior** home-manager generations are cleaned up on the first `sudo nix-collect-garbage -d` invocation. **`nix-env --version` output** `nix-collect-garbage (Nix) 2.16.1` **Additional context** I'm not sure when this started happening, but I feel like it might have something to do with HM switching to XDG paths? **Priorities** Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
bug
imported
labels 2024-03-19 01:01:30 +00:00
Owner

we don't think this should have shipped as it currently exists. that directory should have been a symlink to /nix/var/nix/profiles/per-user

disposition after discussion with @lunaphied: unship the feature, and replace it with a symlink to /nix/var/nix/profiles/per-user/USER

we don't think this should have shipped as it currently exists. that directory should have been a symlink to /nix/var/nix/profiles/per-user disposition after discussion with @lunaphied: unship the feature, and replace it with a symlink to `/nix/var/nix/profiles/per-user/USER`
qyriad added the
Area/profiles
label 2024-04-27 04:47:43 +00:00
qyriad added this to the v2.90 milestone 2024-04-29 13:10:32 +00:00
jade modified the milestone from v2.90 to post-release 2024-08-13 01:19:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#151
No description provided.