-
-
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
hash mismatch in downloaded path #1885
Comments
|
lesson learned: don't GC your binary cache |
Or probably introduce a config for reducing the disk cache ttl for both positive/negative lookups. Which should be useful for binary caches that are GCed. |
https://github.com/NixOS/nix/blob/1.11.15/scripts/download-from-binary-cache.pl.in i think it can only expire negative hits, so positives stick around forever nix 2.0 will expire things better |
So nix/src/libstore/nar-info-disk-cache.cc Line 52 in c0015e8
|
There is another fix which doesn't require See this other issue, which is related to this one: #1148 |
disk cache lookup for example by doing: nix copy --from <binary-cahe> <store-path> --option \ positive-disk-cache-ttl 0 Issues: NixOS#1885 NixOS#2035
disk cache lookup for example by doing: nix copy --from <binary-cahe> <store-path> --option \ positive-disk-cache-ttl 0 Issues: NixOS#1885 NixOS#2035
disk cache lookup for example by doing: nix copy --from <binary-cahe> <store-path> --option \ positive-disk-cache-ttl 0 Issues: NixOS#1885 NixOS#2035
@domenkozar We just hit this in our system as well. Was there some activity on this issue since last year? Or is the solution still to not expire things on the cache server? |
See |
Looks like a duplicate of #2035 - or the other way around I guess |
I really think the correct fix is for binary cache to advertise this setting and user |
Can't we just invalidate the entry when it turns out to be unusable and retry the substitution? That's what @volth suggested in #2035 (comment) and it appears to solve this issue too. |
Sure, that would be most reliable. Note that in IFD we'd have to make sure it works too. |
Why do you think IFD is different? Afaik, it builds and substitutes normally. |
I don't know the code base, I want to be sure IFD is tested. |
It seems like this would be easily added at https://github.com/NixOS/nix/blob/master/src/libstore/binary-cache-store.cc#L89 to fetch narinfo without using the cache and getting the nar file again. |
I've stumbled upon the same error message today. The original tar I depend on is
But when instantiating a nix-shell, I get the error:
how can I keep the same references without breaking checksums in the future? |
I've tried to reproduce this in #3969 but it seems to just work? Maybe my test is not testing the right thing? |
I've found the problem, Nix will say it's copying it, but it will actually fallback to building it. |
not sure if it helps, but I've just discovered this one:
MacOS, the pinned nixpgs are:
but then it works well with a more recent NixOS/nixpkgs-channels@a0b3103
Both checkouts were marked as "verifed" on github. Maybe my reasoning is not right and it is possible to have hash mismatches for some packages in |
@coderfromhere @avanov The issues you're seeing seem to be distinct from the original issue discussed here, because your mismatches occur in fetchers and fixed-output derivations, not during substitution. These are usually caused by changes to the contents backing those URLs you're fetching from. For example, maintainers can change git tags or re-upload an "improved" release tarball and cause a hash mismatch that way. The reason it works on the recent commit, is because it was fixed four days ago. @coderfromhere In your case, a prefetching command should be able to produce the correct hash. Please make sure that you're using the same parameters in your command and expression and that you're using a fixed-output derivation, not an evaluation-time fetcher like |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/hash-mismatch-in-downloaded-path/11056/1 |
The minimum actionable here is to improve the error message. |
I marked this as stale due to inactivity. → More info |
I honestly wonder if this is the improved error message:
I tried Don't know what to do about it. |
This might be NixOS/nixpkgs#179272. For the URL in the log, I get a the "specified:" hash on (case-sensitive) linux, and the "got:" hash on (case-insensitive) macOS. Was the "specified:" hash computed on a case-sensitive filesystem? |
Well, at first I thought it's related but it's actually not. I'm following 22.05-release-channel. Steps To ReproduceSteps to reproduce the behavior:
I tried imperatively install nix-2.9.1 and then tested why Additional contextsudo -i nix-channel --list
MetadataPlease run [user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"aarch64-darwin"`
- host os: `Darwin 21.5.0, macOS 12.4`
- multi-user?: `yes`
- sandbox: `no`
- version: `nix-env (Nix) 2.8.1`
- channels(lockejan): `""`
- channels(root): `"darwin, home-manager-22.05.tar.gz, nixpkgs"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
|
I wonder if we could catch the bug with a sanity script. Someone with good knowledge of find? |
One way would be to canonicalize the list of filenames and check for duplicates:
|
nixpkgs was fixed in NixOS/nixpkgs@aae0476 |
Indeed, but because I used the neovim-nightly-overlay it remained broken until its flake.lock file got updated to a point of nixpkgs where the fix got merged. I only updated my channels today and the problem finally disappeared. |
Do you want to open a PR to add that to tarball validation steps? |
TLDR; keep all of your binary cache history or don't use
binary-cache-v3.sqlite
:Turns out what happened:
/nix/store/nmhvs4pihm56qnhpb6j09ajcwxjx9h07-digest-0.0.1.2
binary-cache-v3.sqlite
/nix/store/nmhvs4pihm56qnhpb6j09ajcwxjx9h07-digest-0.0.1.2
/nix/store/nmhvs4pihm56qnhpb6j09ajcwxjx9h07-digest-0.0.1.2
binary-cache-v3.sqlite
had the old hashI presume this is due to binary non-determinism?
The fix is:
rm /nix/var/nix/binary-cache-v3.sqlite*
The text was updated successfully, but these errors were encountered: