nix-store --delete fails to delete derivations whose outputs exist #282
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
Importance
High
Importance
Low
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
Release Blocking
Non-urgent
Release Blocking
Urgent
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
Urgency
High
Urgency
Low
ux
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#282
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
n.b. we know that there are spurious-liveness issues caused by sudo env-vars, which we probably should do something about, but this happens even without sudo doing it.
Below is a hex dump of the offending file, which one can un-hexdump and then reproduce this bug with.
logrotate.conf.drv
Use
xxd -rto reconstitute the file.This looks like it could be arguments being treated as roots. What platform is this on?
hmm I'm seeing the opposite issue(?): I cannot delete the
.drv, but I can delete the build artifact first (what's the proper name for that?) and then the.drv. this might just be expected behavior? i don't knowlike, it makes sense that
--referrersprevent GC, so maybe--outputsdo too …nonetheless, it would be great to have a
--why-no-deletecommand, since--rootsisn't the full issue when deleting individual pathsoh, i see, yes this reproduces on my other machine now. it looks like it was an important step to actually run the build in order to cause this problem. so what we are actually experiencing is that if you
nix store deletea.drvwhich has been built already and has output paths, it will fail to delete.should we just like, make it work by deleting the outputs? i don't see immediately why one would not do that, but there might be a reason.
alternatively we could report a better error. i can kind of buy the argument that
nix store deleteshould not delete dependents, butnix store delete's current semantics when an output is live make absolutely no sense, since according to the manual,--ignore-livenessmeans ignore roots, not ignore everything. Why is theBut clearly this is bogus! You can
nix store delete --ignore-livenessand the output remains there afterwards, seemingly violating an invariant. This seems like it actually should not be allowed to begin with, in addition to the UX issue we found here.hm, ok it does not violate an invariant at least: i realised a path that is not on my system without doing it from an evaluation (i know it is not on this system because it is a different architecture).
so then, should
nix store deletejust ignore outputs when deleting derivations and simply delete them properly by default? should it delete also the outputs? i don't know! i would also like to have a "gc this path please, delete its dependents for me uwu" command, which sounds like a horribly dangerous footgun, but if it only works on unrooted paths, it should probably be fine right?aha, yes, this is the sudo issue referenced at the top of the bug here. we should probably file another bug for that one: the sudo environment does get caught as a root on linux, which is rather cursed to be honest.
however it wasn't at play because we noticed it and used an interactive root shell.
has been noted that keep-outputs and keep-derivations may be at play in making this error especially terrible.
https://github.com/NixOS/nix/pull/10733 hey a fix, hi alyssa
Self-references?
There are self-references.
nix store delete/nix-store --deletecannot delete paths with self-references #494The original bug above is caused by the output being present on the system, which is referencing the derivation, possibly due to
keep-derivations. The error message is just as awful as before, though. It does not reproduce if the derivation is not realised.Accordingly, here is a trivial reproducer:
The behaviour I would expect is that at least one of the listed commands would correctly list the referrers from a gc perspective. Perhaps also that the failure would actually say which paths were referring to it.
nix-store --deleteis intended to gc closures and simply does not do that #495tonix-store --deletefails without there being any discernable roots innix-store --query --rootsnix-store --deletefails to delete derivations whose outputs exist