nix-store --delete
fails to delete derivations whose outputs exist #282
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#282
Loading…
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 -r
to 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
--referrers
prevent GC, so maybe--outputs
do too …nonetheless, it would be great to have a
--why-no-delete
command, since--roots
isn'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 delete
a.drv
which 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 delete
should not delete dependents, butnix store delete
's current semantics when an output is live make absolutely no sense, since according to the manual,--ignore-liveness
means ignore roots, not ignore everything. Why is theBut clearly this is bogus! You can
nix store delete --ignore-liveness
and 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 delete
just 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.
The 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 --delete` fails without there being any discernable roots in `nix-store --query --roots`to `nix-store --delete` fails to delete derivations whose outputs exist