[Nix-dev] How to fix corrupt .drv files in nix store?
Eelco Dolstra
eelco.dolstra at logicblox.com
Tue Jul 5 17:57:32 CEST 2016
Hi,
On 07/05/2016 05:18 PM, Bjørn Forsman wrote:
> Short version.
> This doesn't work (what else can I try?):
>
> $ sudo nix-store --verify --repair --check-contents
> reading the Nix store...
> checking path existence...
> checking hashes...
> path ‘/nix/store/1f0rxsgjcsdxj6jl6qaz555wcaxs164c-xsession.drv’ was
> modified! expected hash
> ‘2e527f6df7f00f91be1a5f2a60c811a49e434b218f78096f7d020bf37b39fca3’,
> got ‘77ac62e2629d8e45f624589c0c8bf99e24b3a722349bf1e79bc186008534e246’
> error: cannot repair path
> ‘/nix/store/1f0rxsgjcsdxj6jl6qaz555wcaxs164c-xsession.drv’
> ...
>
> Long version:
> I wanted to see how atomic and safe a NixOS update process really is,
> so I abused one of my systems by pulling the rootfs disk from it a
> number of times duing "nixos-rebuild switch" (trying to simulate a
> power cut-off at the worst possible time).
This is only safe if you set "sync-before-registering = true" in nix.conf.
However, that flag is disabled by default because it causes a significant
slowdown during evaluation (since every file written to the store needs to be
fsynced separately).
> $ sudo nixos-rebuild -I nixpkgs=. -Q build
Try passing the "--repair" flag to nixos-rebuild.
> When I get this system up again, I'll try with ext4 data=journal mount
> option and see if that makes it more robust.
Yes, that should help.
--
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
More information about the nix-dev
mailing list