NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.9k stars 1.53k forks source link

nix-store --verify-path fails with no information, and sometimes spurious results #900

Open adnelson opened 8 years ago

adnelson commented 8 years ago

I've been encountering occasional errors when doing nix-copy-closure. The command sometimes fails, complaining that a path is not valid, and I can't seem to find why. The failures do not seem to have anything to do with SSH. For example, putting the path into nix-store --verify-path also fails, in one of two ways. The first is an error which has no explanation:

$ nix-store --verify-path /opt/ns/nix/store/19j1vdjqrb9yv7fwyf9rhwk44v5k1cpk-python3.4-some-package
error: path ‘/opt/ns/nix/store/19j1vdjqrb9yv7fwyf9rhwk44v5k1cpk-python3.4-some-package’ is not valid

This is not helpful at all -- why is it not valid? The store objects haven't been modified in any way.

The other message is slightly more informative, but makes no sense:

$ nix-store --verify-path /opt/ns/nix/store/19g7aaw44gpkb0jswqgj9b06lf0f4x0v-for-own-0.1.3-nodejs-4.2.3
path ‘/opt/ns/nix/store/19g7aaw44gpkb0jswqgj9b06lf0f4x0v-for-own-0.1.3-nodejs-4.2.3’ was modified! expected hash ‘0000000000000000000000000000000000000000000000000000000000000000’, got ‘5d3ead5d0fa9c1ff34c14bec36c5319895d171a5efd96519067c29e663279b99’

This to me indicates that nix is storing hashes incorrectly. It also calls into question whether the other type of error is valid.

Unfortunately, there's no easy way to provide steps to reproduce the error, as it seems to be completely arbitrary which paths break. At the very least, there needs to be more informative error messages here.

domenkozar commented 8 years ago

Is your hdd drive all good?

adnelson commented 8 years ago

Yes. Also this happens on multiple machines, including OSX and Centos, and on VMs.

adnelson commented 8 years ago

A potential issue I see is that I'm using a non-standard nix directory (/opt/ns/nix instead of /nix)

domenkozar commented 8 years ago

@adnelson this one is really hard to debug, because I can not reproduce. Any steps to get http://sscce.org would help :)

srid commented 6 years ago

I hit this while trying to install NixOS from rescue mode. Instructions here - except I do this on a ovh.com dedicated server (their rescue mode).

$ nixos-install
[...]
importing serialized closure /tmp/tmp.lA5cW2B0Jp/channel.closure to /mnt...
error: path '/nix/store/gy4yv67gv3j6in0lalw37j353zdmfcwm-nix-1.11.16' is not valid
#
# nix-store --verify-path /nix/store/gy4yv67gv3j6in0lalw37j353zdmfcwm-nix-1.11.16
path ‘/nix/store/gy4yv67gv3j6in0lalw37j353zdmfcwm-nix-1.11.16’ was modified! expected hash ‘0000000000000000000000000000000000000000000000000000000000000000’, got ‘6a1d3f98ebed460e04191e3f308105f5e42fa3fc9fa818145c27b0803f56fb61’
#
canndrew commented 6 years ago

I'm getting this as well. I can't rebuild my system because of it :(

$ nixos-rebuild build
.
.
.
ln: failed to create symbolic link '/nix/store/hnr5cvavqcd12iiclcpqy2vvwz2pry7d-neovim-ruby-env/bin/bundle': File exists
builder for ‘/nix/store/lv4khjybbjhh4dgzbjg2xk3bgrgiw4za-neovim-ruby-env.drv’ failed with exit code 1
$ nix-store verify-path /nix/store/hnr5cvavqcd12iiclcpqy2vvwz2pry7d-neovim-ruby-env
error: path ‘/nix/store/hnr5cvavqcd12iiclcpqy2vvwz2pry7d-neovim-ruby-env’ is not valid
$ NIX_REMOTE= nix-store --repair-path /nix/store/hnr5cvavqcd12iiclcpqy2vvwz2pry7d-neovim-ruby-env
error: path ‘/nix/store/hnr5cvavqcd12iiclcpqy2vvwz2pry7d-neovim-ruby-env’ is not valid

Any ideas how I can at least fix the "file exists" error?

chreekat commented 5 years ago

I have one near-sscce that has one confounding factor: Vagrant.

https://github.com/chreekat/invalid-path-test

For some reason, glibc is considered an invalid path when using export+import to copy a closure to a VM, but everything is fine if nix-copy-closure is used directly.

I ran into this when working on a system where nix-copy-closure isn't immediately available, possibly for bad reasons. That doesn't seem relevant, though -- export+import should work, I think!

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

stale[bot] commented 2 years ago

I closed this issue due to inactivity. → More info

a-h commented 10 months ago

I think this issue persists into the very latest versions of Nix, as per https://github.com/NixOS/nix/issues/9052#issuecomment-1884841737