[Nix-dev] unable to delete a store path

Marc Weber marco-oweber at gmx.de
Wed Sep 26 13:39:04 CEST 2012


Try such:

  STORE_PATH=/nix/store/jra1icncr6bfp9ysjf858z9rs3r54h4

  follow_link_rec(){
    if [ -s "$1" ]; then
      [ /nix/store == "${1:0:10}" ] && echo "$1"
      follow_link_rec "$(readlink "$1")"
    else
      echo "$1"
    fi
  }

  find /nix/var/nix/gcroots -type l | while read l; do 
    if follow_link_rec "$l" | grep  -q $STORE_PATH; then
      echo "$l" somehow references your store path $STORE_PATH
    fi
  done

In my test (using the store path referenced by /var/run/current-system)
I get this output:

  /nix/var/nix/gcroots/current-system somehow references your store path /nix/store/jra1icncr6bfp9ysjf858z9rs3r54h4
  /nix/var/nix/gcroots/booted-system somehow references your store path /nix/store/jra1icncr6bfp9ysjf858z9rs3r54h4

and this is expected. However mind that the nix-store query you ran does
not show the gc root origin:

%nix-store --query --referrers-closure  /nix/store/jra1icncr6bfp9ysjf858z9rs3r54h4l-nixos-0.1pre-git
/nix/store/jra1icncr6bfp9ysjf858z9rs3r54h4l-nixos-0.1pre-git

However like in your case it seems to reference itself (whatever this
means - don't know)

So what may have happened? Eventually you ran nix-build or such
(creating a result link) in /nix/var/nix/gcroots ?
Is this allowed? That's just a wild guess.

If you get some output we'll know more, if you don't we'll have to
continue digging for the cause.

Marc Weber


More information about the nix-dev mailing list