snap remove A B C: cannot remove "A", "B", "C": snap "A" is not removable: snap is being used by snaps B and C.

Bug #2046579 reported by Thomas Perl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
Undecided
Unassigned

Bug Description

After removing some old snap apps that were based on core18, I wanted to clean up some unused middleware and core snaps using "snap remove" to save disk space and bandwidth.

I start out with this list of installed snaps (that application that depended on core18 has already been removed at this point):

% snap list
Name Version Rev Tracking Publisher Notes
bare 1.0 5 latest/stable canonical✓ base
core18 20231027 2812 latest/stable canonical✓ base
core20 20231123 2105 latest/stable canonical✓ base
core22 20231123 1033 latest/stable canonical✓ base
firefox 120.0.1-1 3504 latest/stable mozilla✓ -
firmware-updater 0+git.e8771be 109 latest/stable/… canonical✓ -
gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67 198 latest/stable canonical✓ -
gnome-3-34-1804 0+git.3556cb3 93 latest/stable canonical✓ -
gnome-3-38-2004 0+git.efb213a 143 latest/stable canonical✓ -
gnome-42-2204 0+git.ff35a85 141 latest/stable canonical✓ -
gtk-common-themes 0.1-81-g442e511 1535 latest/stable canonical✓ -
snapd 2.60.4 20290 latest/stable canonical✓ snapd
snapd-desktop-integration 0.9 83 latest/stable/… canonical✓ -

First, trying to simply remove core18:

% sudo snap remove core18
error: cannot remove "core18": snap "core18" is not removable: snap is being used by snaps
       gnome-3-28-1804 and gnome-3-34-1804.

Ok, that makes sense. These two snaps depend on core18.

So I try again, extending my request to remove all three packages:

% sudo snap remove core18 gnome-3-28-1804 gnome-3-34-1804
error: cannot remove "core18", "gnome-3-28-1804", "gnome-3-34-1804": snap "core18" is not
       removable: snap is being used by snaps gnome-3-28-1804 and gnome-3-34-1804.

Bummer.

What does work, however, is manually figuring out the dependency ordering and working my way up from the leaf nodes to the root of the dependency tree that I want to remove:

% sudo snap remove gnome-3-28-1804 gnome-3-34-1804
gnome-3-28-1804 removed
gnome-3-34-1804 removed

Followed by:

% sudo snap remove core18
core18 removed

Versions reported by "snap version":

snap 2.60.4+23.10.1
snapd 2.60.4+23.10.1
series 16
ubuntu 23.10
kernel 6.5.0-13-generic

Revision history for this message
Sergio Cazzolato (sergio-j-cazzolato) wrote :

Hi Thomas, thanks for raising this.

In this case, core18 is not a typical snap, it is a base snap! So gnomes snaps depend on core18. For removing core18, by design, you need to remove first all the snaps depending on this and then you are able to remove it.

To see which snaps are base snaps, you can see the last column in the `snap list` output

Changed in snapd:
status: New → Triaged
Revision history for this message
Thomas Perl (thp) wrote :

> For removing core18, by design, you need to remove first all the snaps depending on this and then you are able to remove it.

I know that the snaps depend on each other, that's not the issue.

The thing is, even when requesting to remove all the snaps depending on it (at the same time / in the same invocation), it still won't remove them, with this error message:

% sudo snap remove core18 gnome-3-28-1804 gnome-3-34-1804
error: cannot remove "core18", "gnome-3-28-1804", "gnome-3-34-1804": snap "core18" is not
       removable: snap is being used by snaps gnome-3-28-1804 and gnome-3-34-1804.

Manually removing the leaf snaps first and then their dependency works, as written above. Other package management systems usually support removing packages and their dependencies in one go when specifying all of them in the "remove" command line.

It's mostly a CLI usability issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.