-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Cannot delete a store path when sudo-ing nix-store --delete $storePath #7053
Comments
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-use-nix-store-delete/22024/10 |
I'm not sure if it's exactly the same bug, but when trying to delete a store path as a normal user, I get this error:
And when running If I use sudo before the nix-store command, I get the same result as OP |
I think I also hit the bug you are describing @rapenne-s . I however did not manage to reproduce it later on :/ Would you happen to have a minimal snippet to reproduce it? Maybe we could try to pinpoint what's wrong. It might be related to this issue to some extent, but I don't think it's the same bug. |
Create the files Then delete the local
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-36/22120/1 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/cant-find-out-what-takes-so-much-space-in-my-store/22562/3 |
This can be worked around using a command like However, I am not aware of a case where it is necessary for sudo to be involved with |
Discussed on the Nix team meeting 2023-01-16:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-01-13-nix-team-meeting-minutes-23/24644/1 |
I'm a newbie Nix user but I'm seeing this exact same behavior with some leftover Mathematica files:
Ideally I'd like to remove the remnant 13.3.0 files. |
this worked for me: removed 6 gigs of shit woohoo! |
Describe the bug
It is currently impossible to use
nix-store --delete $storePath
when running nix through sudo.@thufschmitt investigated a bit the issue and realized sudo adds the sudo cmd in a
SUDO_COMMAND
env variable. See https://manpage.me/index.cgi?apropos=0&q=sudo&sektion=0&manpath=Debian+8.1.0&arch=default&format=html#ENVIRONMENTNix is looking at the live processes env variables and creates GC roots for the store paths it'll find. See https://github.com/NixOS/nix/blob/master/src/libstore/gc.cc#L392. It'll find the store path we're trying to delete in the
SUDO_COMMAND
env variable and will create a temporary GC-Root for it, preventing us to delete the store path.Steps To Reproduce
Expected behavior
sudo nix-store --delete $hello
should delete the store path as expectednix-env --version
outputThe text was updated successfully, but these errors were encountered: