FOD hash mismatches

Two times already I’ve received a hash mismatch error when trying to update nixpkgs. I’ve created issues about them: #583018 and #581100. I find it pretty weird, especially because I tried downloading and comparing the release assets through Tor Browser, and they do match the ones nix downloaded. That can only mean that the hashes in nixpkgs is wrong.

Has anyone hit the same issue? What’s going on?

Oh, and I also just the same error for a bunch of other packages:

error: hash mismatch in fixed-output derivation '/nix/store/zi0xmzsqnkfmsbznmfdk5302ysiyz2p6-openapv-1.1-compat.patch.drv':
         specified: sha256-ENpPDEHtl3kj/UF52hfV+LwvO7CUaK8UvTy+OAYlWFw=
            got:    sha256-M3Zz5GMJrVIS83MDmYGreuzyb8VMC+jDgRoIRTvSf0U=
error: hash mismatch in fixed-output derivation '/nix/store/mkj3kfdhwq0skd3jzf4pfc59rmakcjaa-source.drv':
         specified: sha256-Y5O/KkYYNDysZ3H0vk0qj2DOkmx/Z4vJELr9oydxpt8=
            got:    sha256-azIFZx4CVQWuVjSP13WojFqNCQNMBTXTcvlla9NHjU8=
error: hash mismatch in fixed-output derivation '/nix/store/xa8dh64238c5s3r3nqlqwf9idvfv6ygb-tor-browser-linux-x86_64-16.0.tar.xz.drv':
         specified: sha256-3jNwtnOJwoSHOM3VFbsuOyMqSukykOrnQYXExDopGiQ=
            got:    sha256-w3PJdBFLlHscftjwZBewpQqaXV+RmJZKP7mjkjrGzqI=

Update: and another one

error: hash mismatch in fixed-output derivation '/nix/store/a9lsg0400h2z7nwywn3bj4kb935w9kvz-regular-libdir-includedir.patch.drv':
         specified: sha256-Cn7rvg1FI7H/26GzSe4pv5VW/gvwbwGqivAqEeawkwk=
            got:    sha256-unPDAwW0F6ZSjSNLRiO3zcTHPKZKflK+2Yu8SYX1e8Q=

That can happen sometimes when upstream sources force push git tags. Which they really shouldn’t do… but sometimes they do it anyway, assuming it won’t really cause a problem.

However, I just checked both of the packages you’ve reported, and I don’t see any hash mismatches. It does seem that it is specific to you in some way. Hard to imagine a way that would apply even through tor, though. (EDIT: I flubbed this test somehow. Once I did it right, I got hash mismatches for both reported packages.)

Well that’s extremely weird… Have I been MITMed? I mean, I’m in Russia, and considering the recent CA compromise, anything could happen, but I find it unlikely that an attacker could be sophisticated enough to patch Tor Browser, but not enough to patch nix. A more likely scenario is that my nix store is borked, but this failure consistently occurs on both my workstation, and my server… What on earth?

Here’s a tarball of the build directory nix left after the hash fail:

583018-tarball.tar.gz

Ok, honestly seems like the entirety of nixpkgs is just dead

Though some of it could be explained by, for example the QT downloads server being down. (Update: they are just not available in Russia. I don’t know which side decided to do that, but it’d be an equally stupid decision regardless) Anyway, this is about hash mismatches.

I can replicate #581100 locally, so something strange is going on.

That’s nice to hear. What country are you from? Maybe that matters. Can you replicate the other failures?

I think it is a force-push that is causing the mismatch.

For amf-headers, Tag v1.5.3 was pushed October 16, but Nixpkgs updated to that tag September 29.

Yep.

Comparing the source file used on Hydra:

nix copy --from https://cache.nixos.org /nix/store/91rqhn5vazjcnck4jqjnvwcn94alyzik-source

with a checkout of the same tag from GitHub, and they have changed things such as #define AMF_VERSION_RELEASE 2 in amf/public/include/core/Version.h, replacing the 2 with 3.

Ok, there was something wrong with my local testing methodology. Sorry to send you down the wrong rabbit hole. I’m now replicating both build failures you originally reported (with the same “got” hashes, too), so yeah, tag force-pushes are probably to blame here.

$ nix build nixpkgs-unstable\#amf-headers.src --rebuild
error: hash mismatch in fixed-output derivation '/nix/store/sak4if1lyky0rj82mbm1bj732bql5gqw-source.drv':
         specified: sha256-DykkYTMfCkXUmq3kM/z0jA6027yAlezsc4KBcKGvlOc=
            got:    sha256-A2zO8XE8ndMzjSlbM1QWOvrhFOzfO6x9JTjMVtW2h/g=
$ nix build nixpkgs-unstable\#pwvucontrol.src --rebuild
error: hash mismatch in fixed-output derivation '/nix/store/mkj3kfdhwq0skd3jzf4pfc59rmakcjaa-source.drv':
         specified: sha256-Y5O/KkYYNDysZ3H0vk0qj2DOkmx/Z4vJELr9oydxpt8=
            got:    sha256-azIFZx4CVQWuVjSP13WojFqNCQNMBTXTcvlla9NHjU8=

I guess nobody had hit the same issue because nobody is insane enough to actually build NixOS from source… What about, for example, Tor Browser? I doubt that torproject would force-push it.

nix build nixpkgs-unstable\#tor-browser.src --rebuild succeeds without issue for me.

This kind of thing is why nixpkgs CI needs to be checking FODs periodically. GitHub - multivac61/fod-oracle · GitHub exists, so I’d hope that would get set up…

I can replicate another one.

It is a patch in pkgs/os-specific/linux/minimal-bootstrap/gcc/common.nix.

I can replicate that too (the hash on master is sha256-Cn7rvg1FI7H/26GzSe4pv5VW/gvwbwGqivAqEeawkwk=).

nix-repl> :b legacyPackages.x86_64-linux.fetchurl {name = "regular-libdir-includedir.patch";url = "https://inbox.sourceware.org/gcc-patches/2025071717491
1.1536129-1-git@JohnEricson.me/raw";hash = "";}
error: hash mismatch in fixed-output derivation '/nix/store/spv0qkbw7yss9z80c6pyrxsb4czzzjac-regular-libdir-includedir.patch.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-unPDAwW0F6ZSjSNLRiO3zcTHPKZKflK+2Yu8SYX1e8Q=

Since the creation of this post my VPN got blocked, so I am no longer able to reproduce the tor-browser hash mismatch (by which I mean that it just fails to download anything at all). This also blocks my ability to use the nix cache, as that is blocked too, so I’ll have to build everything from source. I guess I’m the canary in the coalmine for FOD mismatches now. I’ll go package up all that have occured so was in a PR

Just wanted to chime in and say that I did run source built nixos for a while, and this issue was pretty common. Force pushing and privating repos seemed pretty common. I opened some issues about it (that are wildly out of date now) here for some examples:

I don’t think catching these would be too hard (I had a script that traversed nixpkgs looking for packages and tried to build each’s src attribute: GitHub - DieracDelta/srcbot · GitHub). Fixing them seems a bit more involved – each needs its own PR detailing what happened to the repo which is often non obvious.

Building from source definitely makes upgrading more painful than it should be. But, most issues are usually a hash mismatch like that, or some python package’s checkPhase failing, and correctable with an small overlay. It’s became more feasible to build from source with AI, because AI can spin and make these tiny, simple auditable corrections. It turns out source bumps (and finding pre-existing issues) is something it can do reasonably well

Try the TUNA mirror if you don’t want to rebuild the world:

I would like to see more projects make use of Immutable Releases, which I think would prevent many of the issues we see.

Alas, I have only seen one project that uses them.

@kmein did a talk at this year’s NixCon about airgapped re-building all of nixpkgs, so he must have encountered similar issues. Maybe coordinate how to deal with this?