What to do if nix-channel --update fails?

What is the recommended way to debug when I run nix-channel --update and get

✦ ❯ nix-channel --update
unpacking channels…
warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels’ does not exist, ignoring
error: path ‘/nix/store/9gphp6kzv36z97qq7dim43gi958sz4k5-curl-7.72.0’ is not valid
error: program ‘/nix/store/na7767q23fvcl64xmkj7q5hvnn4anmfq-nix-2.3.8/bin/nix-env’ failed with exit code 1

Does nix-channel --list work?

Without sudo the output is empty, using sudo I get the nixpkgs-unstable channel as output.

Hm, then what about sudo nix-channel --update?

error above sadly.

Would rollback (via home-manager) be an option here ?

I don’t think so. As nix and related tooling is usually managed by the system configuration.

Have you tried a repair of the store? Might take a very long time though…

sudo nix-store --verify --check-contents --repair
1 Like

@NobbZ, can’t mark your suggestion as a solution technically, but that was basically what I was aiming at.

Related /nix/store corrupted