-
-
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
Tools barf on invalid (empty name) store paths, without telling me where they are referred to #6090
Comments
How I solved thisI After doing the above, I restarted the system so that the current system in no way refers to this derivation. Then I changed the version of nix by using The reason we have to downgrade is that Once we have nix 2.3, use this to remove old boot generations:
Use this to remove boot entries for old generations:
Courtesy of this script: https://gist.github.com/xeppaka/f6126eebe030a000aa14ed63cc6e8496 Now reboot again, and run Double check the file is gone. |
Once you downgrade to |
@cstich Thank you, that's awesome! That has finally fixed this issue for me. @itsfarseen You can just use e.g. open a shell with |
@cumber I also had the same issue. The offending derivation was long gone from my system. I couldn't find anything that referenced it but there was still a broken reference to it in the database. I am glad it works now for you as well. This took me the better part of a Sunday to figure out. |
Weirdly enough, I happened to run a
I'm a little concerned that this reference to a bad path is somehow being resurrected, years after I have removed it from my system! |
Likely needs work in the repair subsystem to allow fixing incorrect metadata. |
Describe the bug
Certain nix tools that deal with my whole store tell me this:
This store path is not actually present on my system:
As a side note, this is in fact the same store path that I reported prevented me from running a garbage collection in #5015, which resulted from me years ago copying a Nixos module recommended on the wiki. At the time empty names were not forbidden, but I have long since stopped using this module and garbage collected the system generations that used it. Whatever is referring to it now is no longer preventing garbage collection; I don't know if this is because the garbage collector now tolerates cleaning up things that refer to invalid store paths, or because the garbage collector happens not to scan anything that refers to it.
Unfortunately, attempting to query for references to this store path (so that I can manually remove the things that refer to it) doesn't work; the query tool errors out on being asked to contemplate an invalid store path:
Steps To Reproduce
The query part of this is trivial to reproduce:
nix-store -q --referrers /nix/store/4w6hv3912fjvanj4c9n83f3ahpql6ilj-
But my real problem is that somewhere in my store is a reference to such a path (not the path itself), and that is difficult to reproduce now. I have this problem because I once-upon-a-time built something like
builtins.toFile "" "contents of file with bad name"
(as I mentioned, this was from this Nixos module, which I found suggested at https://nixos.wiki/wiki/Scanners#Network_scanning). The oldest nix in unstable nixpkgs now isnix_2_3
, which won't allow such a derivation to be evaluated, let alone built:I believe nix 2.2 allowed such a build, however, if you get nix from an older nixpkgs. Having obtained such a nix, building
builtins.toFile "" "contents of file with bad name"
should reproduce all of the other symptoms I describe here.Expected behavior
For
nix store verify
in particular, I would expect it not to fail on this error. Given its whole purpose is to "verify the integrity of store paths", it should at minimum report some diagnostics about which store paths it is processing when it finds the reference to an invalid store path; preferably it should also be able to recover and continue scanning for more problems.I'm not sure whether it's practical for this error to be more informative in general, whatever context it occurs in; I imagine the point in the code that raises the error may not have easy access to knowledge of where the bad path was found.
For
nix-store -q
it would be awfully handy if passing it an invalid store path was only a warning, not a fatal error. But given that nix no longer lets you create such paths, and that the only reason I want that is to be able to find where the invalid path is referenced in order to remove the reference, it may not be worth anyone's trouble to makenix-store -q
tolerate such an error, provided that there is some tool (I would expectnix store verify
) that can find it.nix-env --version
outputAdditional context
The text was updated successfully, but these errors were encountered: