Narinfo corrupt, system in broken state

I did an update previously and now I’m in a state where I can’t update my system:

# nix-channel --update
error: NAR info file 'dg0lk3yl8ja0j71bkqyf28a3p4ax9a7f.narinfo' is corrupt
error: program '/nix/store/g8mk88hzi3igv8jy4bl0cxhxashj7yss-nix-2.3.15/bin/nix-build' failed with exit code 1

I can install software, but I also can’t use overrideDerivation on anything.

the hash dg0lk3yl8ja0j71bkqyf28a3p4ax9a7f doesn’t exist on my system, so I can’t “delete” it.

What do?

Rolling back your system profile to a non-broken version is one way of fixing it.

Otherwise, if rollback isn’t possible, check the substituters setting in your nix.conf, or run

nix show-config | grep substituters

You might have a dodgy cache in the list, or https://cache.nixos.org could be missing.

To repair your system, either edit the config file or run your nix-build / nixos-rebuild command with --option substituters https://cache.nixos.org.

1 Like