Skip to content

empty derivation and can't repair the various wrong store paths, thus blocking nixos-rebuild #11148

Open
@teto

Description

Describe the bug

I find myself in a situation where I can't rebuild my system and I am not sure how to repair the store without manually deleting lots of derivations.

Upon nixos-rebuild, I've got an error I've never seen before:
error: error parsing derivation '/nix/store/8ihsdsn00n2p9hy9hz2jmw5z5wfl3w9r-nss-3.102.drv': error: expected string 'D'.
When I look at /nix/store/8ihsdsn00n2p9hy9hz2jmw5z5wfl3w9r-nss-3.102.drv, it's empty :/

sudo nix-store --verify --check-contents shows around ~80 failures in the store (wrong hash, which might be because of unexpected shutdowns?!. The command finishes
with the weird : warning: not all store errors were fixed.. Since it was run without --repair, i dont think it tried to fix any error so this specific message is weird: either no message or warning: no repair was done: rerun with --repair.

I then tried to actually repair the paths:

error: cannot repair path '/nix/store/aigwdcmwand90dasgsh3837p5n5zkvac-swaybg-1.2.1.drv'
path '/nix/store/apc6ihyrk677wb5q6dw80qbjz1nhvd8x-sway.conf.drv' was modified! expected hash 'sha256:15830m1af8hv8mz1y403ajh9lqibb4y3p46py9b5icviv51ghalh', got 'sha256:0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p'
error: cannot repair path '/nix/store/apc6ihyrk677wb5q6dw80qbjz1nhvd8x-sway.conf.drv'
path '/nix/store/b0llvi2bw2hhlfl1nimmbz938prf2zwg-qtlanguageserver-6.7.2.drv' was modified! expected hash 'sha256:1wy52gqzkya5qwcl6jrlgvzas6gs6ay7bg73dxq088i7368yk72f', got 'sha256:0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p'
error: cannot repair path '/nix/store/b0llvi2bw2hhlfl1nimmbz938prf2zwg-qtlanguageserver-6.7.2.drv'

It's not clear why it can't repair the path ?
( as a sidenote I also tried:

nix store repair --all 
error: operation 'repairPath' is not supported by store 'daemon'

)

so I thought I would nee

sudo nix-store --ignore-liveness --delete /nix/store/2zjwchn4vwcpbqxfzi24fmzzdcgibs9b-source.drv 
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/2zjwchn4vwcpbqxfzi24fmzzdcgibs9b-source.drv' since it is still alive. To find out why, use: nix-store --query --roots and nix-store --query --referrers

I am not sure how to proceed to unblock the repair. Maybe delete all the referrers manually ? Isn't it possible to force delete a .drv store path ? --ignore-liveness could become --force instead for a more standard flag.

nix-env --version output

nix --version         
nix (Nix) 2.23.1

Additional context

My laptop oftenu shut down unexpected recently for various reasons, which could explain the wrong store paths.

Priorities

Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Labels

    error-messagesConfusing messages and better diagnosticsstoreIssues and pull requests concerning the Nix store

    Type

    No type

    Projects

    • Status

      ⚖ To discuss

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions