Skip to content

Cannot delete store path with no roots #6141

@asymmetric

Description

@asymmetric

Describe the bug

Can't delete a store path, even if it isn't reachable by any root.

Steps To Reproduce

❯ nix store delete /nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source' since it is still alive. To find out why, use: nix-store --query --roots
❯ nix-store -q --roots /nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source
{temp:3862} -> /nix/store/mqvmj5rijym5nkj0p05nddb3jaf5s85k-centrifuge-chain-2.0.0-2df8df-vendor.tar.gz.drv
{temp:3862} -> /nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source
{temp:3862} -> /nix/store/9qy3ksajzqkdm77nc3wkcc2kix3w7z83-centrifuge-chain-2.0.0-2df8df.drv
❯ rm -f `/nix/var/nix/temproots/3862
❯ nix-store -q --roots /nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source

i.e. no output

❯ nix store delete /nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source' since it is still alive. To find out why, use: nix-store --query --roots
❯ nix store delete --ignore-liveness /nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/r3n40nbgq8x9kac2lg3b1daw9g8kxp4q-centrifuge-chain-2.0.0-2df8df-source' since it is still alive. To find out why, use: nix-store --query --roots

Expected behavior

I should be able to remove the store path.

nix-env --version output

nix-env (Nix) 2.6.0

Additional context

Question posted on Discourse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugerror-messagesConfusing messages and better diagnosticsnew-cliRelating to the "nix" commandstoreIssues and pull requests concerning the Nix store

    Projects

    Status

    Defined work

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions