Subject: Re: bug#47748: Packages which cant be find/removed by guix remove

From: Mark H Weaver <[email-masked]>
Date: Thu, 15 Apr 2021 15:34:05 -0400

bo0od <[email-masked]> writes:

>  > You seem to want it to do something different than it was intended to
>  > do, although I'm not precisely sure what that is.  Do you want it to try
>  > to purge all copies of the given package from /gnu/store?  If so, that
>  > might require deleting (or modifying) older system generations and older
>  > user profiles, which would interfere with rollback functionality.
>
> Isnt this the standard understanding of deleting a package whether in 
> GNU/Linux or Windows or Mac? If user has the root rights he should be 
> able to delete software x,

The command in Guix that most closely matches what you seem to be asking
for is "guix gc --delete", which will try to delete a given set of store
items.  In your original bug report, it looks like 'avahi' was one of
the things you were trying to remove, so I'll use that as an example:

--8<---------------cut here---------------start------------->8---
mhw@jojen ~$ guix gc --delete /gnu/store/…-avahi-0.8
finding garbage collector roots...
guix gc: error: cannot delete path `/gnu/store/…-avahi-0.8' since it is still alive
--8<---------------cut here---------------end--------------->8---

If you get this error, you can use "guix gc --referrers" to find out
what's keeping it alive:

--8<---------------cut here---------------start------------->8---
mhw@jojen ~$ guix gc --referrers /gnu/store/…-avahi-0.8
/gnu/store/…-geoclue-2.5.7
/gnu/store/…-gvfs-1.40.2
/gnu/store/…-pulseaudio-14.0
/gnu/store/…-cups-filters-1.27.4
/gnu/store/…-guile-avahi-0.4.0-1.6d43caf
/gnu/store/…-avahi-0.8
/gnu/store/…-cups-2.3.3
/gnu/store/…-grilo-plugins-0.3.11
--8<---------------cut here---------------end--------------->8---

So, it looks like I won't be able to remove avahi from my store, at
least not if I want to keep GNOME, CUPS, or Pulseaudio.

For similar reasons, I can't remove Avahi from my Debian server either:

--8<---------------cut here---------------start------------->8---
root@world:~# dpkg -r libavahi-client3
dpkg: dependency problems prevent removal of libavahi-client3:amd64:
 libvirt0:amd64 depends on libavahi-client3 (>= 0.6.16).
 libcups2:amd64 depends on libavahi-client3 (>= 0.6.16).

dpkg: error processing package libavahi-client3:amd64 (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 libavahi-client3:amd64
--8<---------------cut here---------------end--------------->8---

Anyway, I agree that it would be good to have a user-friendly way to ask
Guix why a given piece of software is in their store, and to help them
find ways to remove it, if possible.  We have some tools to help with
this, e.g. "guix gc --referrers", "guix graph --type=reverse-package",
"guix graph --type=reverse-bag", and "guix graph --path", etc, but
there's plenty of room for improvement.

      Mark