I have permanent problems with removing packages. nix-store --delete --ignore-liveness says it’s still alive, whereas nix-store -q --query --roots shows nothing. This problem appears pretty frequently.
jk@phonelab-desktop:/nix/store$ sudo /home/jk/.nix-profile/bin/nix-store --delete --ignore-liveness /nix/store/1jqhzqi0x92ljxgwyzm80v0j6z5fcj8n-catgirl-static-aarch64-unknown-linux-musl-2.1
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/1jqhzqi0x92ljxgwyzm80v0j6z5fcj8n-catgirl-static-aarch64-unknown-linux-musl-2.1' since it is still alive. To find out why, use: nix-store --query --roots
jk@phonelab-desktop:/nix/store$ sudo /home/jk/.nix-profile/bin/nix-store -q --query --roots /nix/store/1jqhzqi0x92ljxgwyzm80v0j6z5fcj8n-catgirl-static-aarch64-unknown-linux-musl-2.1
/proc/1913703/environ -> /nix/store/1jqhzqi0x92ljxgwyzm80v0j6z5fcj8n-catgirl-static-aarch64-unknown-linux-musl-2.1
/proc/1913720/environ -> /nix/store/1jqhzqi0x92ljxgwyzm80v0j6z5fcj8n-catgirl-static-aarch64-unknown-linux-musl-2.1
If this is the same user who asked in the discord chat recently, then this PIDs are ephemeral and change on each query, at the same time, those processes can’t be introspected, as they are gone after the query.
Oh, then they’re related to the running command that mentioned those paths on the command line, perhaps via some shell-hook integration?
You might need to dump the full dependency topology out to a file, and search through it after the fact to avoid this. But I predict that there’s nothing (else) there, and your issue is something like the above, that inherently makes the store path live while you’re trying to delete it, because you’ve mentioned it on the command line.
to rebuild what? development projects? if you use nix-direnv there’s an option to prevent garbage collection deleting the project’s downloaded derivations
I build the SpectrumOS, which contains a lot of packages. gc is a poor option, as it deletes a lot of packages, so rebuidling them takes long time. As a workaround of this bug instead of that I delete and reinstall the Nix store.