Open andir opened 2 years ago
I got into this situation on MacOS for some reason.
funnily enough nix-store --verify --repair
works but the experimental nix command trips up:
arian@Arians-MacBook-Pro ~ % sudo nix store verify --all --no-trust
error: getting status of '/nix/store/3glray2y14jpk1h6i599py7jdn3j2vns-mkdir.drv': No such file or directory
arian@Arians-MacBook-Pro ~ % sudo nix store repair --all
error: cannot repair path '/nix/store/3glray2y14jpk1h6i599py7jdn3j2vns-mkdir.drv'
I then touched the file to solve. But repair doesn't handle when .drv
files are corrupted:
% sudo nix store repair /nix/store/3glray2y14jpk1h6i599py7jdn3j2vns-mkdir.drv
error: error parsing derivation '/nix/store/3glray2y14jpk1h6i599py7jdn3j2vns-mkdir.drv': error: expected string 'Derive(['
so i then copied another .drv
file but now nix
segfaults:
arian@Arians-MacBook-Pro store % sudo cp zzwv8gdmaia5pwllm6kwcr7y0bs8yjav-apple-framework-AudioUnit-11.0.0.drv /nix/store/3glray2y14jpk1h6i599py7jdn3j2vns-mkdir.drv
arian@Arians-MacBook-Pro store % sudo nix store repair /nix/store/3glray2y14jpk1h6i599py7jdn3j2vns-mkdir.drv
this path will be fetched (0.03 MiB download, 0.12 MiB unpacked):
/nix/store/8likbyrypv66bhsc7jpds6j3fyj1w02p-mkdir
[0.0 MiB DL]zsh: segmentation fault sudo nix store repair /nix/store/3glray2y14jpk1h6i599py7jdn3j2vns-mkdir.drv
:shrug:
Still the same with 2.11.0
:
$ nix-store --verify --repair
reading the Nix store...
checking path existence...
error: path '/foo/nix/store/005wyppmhxmbwc9lj8vy26bjms0mc0n6-unit-gnome-session.target' is not in the Nix store
$ nix --version
nix (Nix) 2.11.0
I'm also getting
error: getting status of '/nix/store/p6dnqlq09jwcka4acqyrxpja284yzlss-bash-5.1.tar.gz.drv': No such file or directory
from a sudo nix store verify --all
on
"x86_64-linux"
Linux 6.1.52, NixOS, 23.05 (Stoat), 23.05.20230917.5d017a8
yes
yes
nix-env (Nix) 2.13.3
""
"nixpkgs-unstable-19.09pre170896.6e5caa3f8ac, nixos-unstable-small-19.03pre161392.50bb0afa7ce, nixos-unstable-21.03pre246062.420f89ceb26"
/etc/nix/inputs/nixpkgs
I'm also running into this having used an alternative store path previously. Is there any workaround?
Describe the bug
I've just ran
nix-store --verify --repair
on my system to check the integrity of my store. Unfortunately that didn't work as Nix complained about a path that isn't in the (current?) store:I am certain that at some point I had used
/foo
to test with an alternative store path. Nix should still try to verify the rest of the (valid) store paths regardless of the database containing whatever it currently contains.Steps To Reproduce
This is my best guess as this likely happened a while ago.
/foo/nix/store
path in your sqlite db.nix-store
command should fail as posted above.Expected behavior
Invalid paths should / can be reported but it should really try to verify the other still valid paths in the store instead of bailing on some path that doesn't exist.
nix-env --version
output2.4