-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 collect garbage: store path contains illegal character '!' #5176
Comments
I also have this. My store contans about 50 lockfiles similar to the following:
They appeared roughly when I started experimenting with content-addressing.
|
I applied this patch for now, but it's just a bandaid. It probably won't really hurt, but tread carefully. Alternatively, remount the nix store with diff --git a/src/libstore/path.cc b/src/libstore/path.cc
index e642abcd5..0e584ef33 100644
--- a/src/libstore/path.cc
+++ b/src/libstore/path.cc
@@ -12,7 +12,7 @@ static void checkName(std::string_view path, std::string_view name)
if (!((c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
- || c == '+' || c == '-' || c == '.' || c == '_' || c == '?' || c == '='))
+ || c == '+' || c == '-' || c == '.' || c == '_' || c == '?' || c == '=' || c == '!'))
throw BadStorePath("store path '%s' contains illegal character '%s'", path, c);
} And then in configuration.nix something like this: nix = {
package = pkgs.nixUnstable.overrideAttrs (oldAttrs: {
patches = (oldAttrs.patches or []) ++ [
./nix-store-path-illegal.patch
];
});
}; also cc @regnat since this is probably related to content-addressed deriviations. |
I’ve recently hit that too. That’s apparently due to 8707773 . I’ll add a patch quickly to fix it (and in the meantime, it should be safe to remove them manually as they are just transient files that don’t go in the database at all) |
Store paths are only allowed to contain a limited subset of the alphabet, which doesn’t include `!`. So don’t create lockfiles that contain this `!` character as that would otherwise confuse (and break) the gc. Fix #5176
I’ve opened a fix at #5203 to stop creating these invalid lockfiles (you’d still have to manually remove the existing ones) |
Just a heads up, I hit this recently but not with a lock file, but with an a derivation named No idea how I got this path on my system in the first place, but just thought it might be worth at least reporting since this is a bit different than the OP. |
I had the same issue. In case anyone else is faced with this: deleting the file from the store manually is a bad idea. Instead the correct solution is to patch Nix with the patch from above, and delete the store path with |
If an error occurs in NixOS, even with the command It seems like a reinstallation might be necessary. |
I encountered the same error with the store path containing a dot: Someone knowing why this is happening? |
In my case, this happened when I created a file starting with dot in nix in the home folder. |
@PlumpMath @MartinLoeper : your issue seems to be #9095 . It got reverted in #9867, but somehow never backported to 2.18 (which I assume you're running on?). I'm backporting it locally (there was a small merge conflict, I'm just checking that everything works fine) and I'll open a PR for the backport |
Describe the bug
I'm running nix unstable and I cannot do a garbage collection anymore, because my store contains a path with an 'illegal' character.
Steps To Reproduce
What I tried:
Expected behavior
I can still do a garbage collection, even if it's just to remove the illegal directories.
nix-env --version
outputnix-env (Nix) 2.4pre20210802_47e96bb
Additional context
Some experimental features are enabled, which may have caused this issue or be related to it:
The text was updated successfully, but these errors were encountered: