I have installed a few snap packages (snap install …
). I can use snap list
to list them. However I can not tell which are manually installed, and which were installed because other packages depend on them (auto
in apt). I want to remove automatically installed packages (apt autoremove
in apt), (docker system prune
in docker).

- 661
-
4Does this answer your question? How to identify snaps on my system I no longer need? – mook765 Nov 24 '21 at 23:06
4 Answers
snap connections | grep XYZ
where XYZ is the package whose dependencies you want to check.
For instance, I have a bunch of Gnome versions in the /snap
directory. I don't know which to keep and which to get rid of. So on a whim, I uninstalled the "older" versions. Then it turns out some of the programs don't start anymore because they depended on the removed Gnome versions.
user@~ $simplenote
ERROR: not connected to the gnome-3-28-1804 content interface.
This is a bad way of knowing that you removed something needed by other apps.
When I do snap connections | grep gnome
, the output includes these lines:
user@~ $snap connections | grep gnome
content[gnome-3-38-2004] firefox:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-28-1804] simplenote:gnome-3-28-1804 gnome-3-28-1804:gnome-3-28-1804 -
This indicates the Gnome 3.28 and 3.38 versions are still being used by some programs and should not be removed.

- 222
-
2
snap connections [<snap>]
(e.g.snap connections gnome-3-38-2004
) without piping throughgrep
also works. – antichris Dec 05 '22 at 15:42
As far as I can tell, there is no prune/auto-remove feature at this time, but you can give a shot to
snap connections
It will list the connections that various snaps provide and have to each other and the system, so you can try figuring out which ones are not connected in any meaningful way to anything you actually need, and remove
them manually.
You can inspect the connections of a specific snap by running snap connections <snap>
, e.g.:
$ snap connections gnome-3-38-2004
Interface Plug Slot Notes
content[gnome-3-38-2004] firefox:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-38-2004] gimp:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-38-2004] snap-store:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-38-2004] snapd-desktop-integration:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
Keep in mind that the connections listing does not include the relationships of snaps that are the bases for other snaps (such as bare
and all core
snaps, i.e. core18
, core20
etc.).
Kudos to this answer for pointing me in the right direction.

- 205
I could do a script to show unconnected snaps:
show-unconnected-snaps
#!/bin/bash
list_connected_snaps_sorted() {
snap connections
| tail -n +2
| awk '{print $1}'
| sort
| uniq
}
list_all_snaps_sorted() {
snap list
| tail -n +2
| awk '{print $1}'
| sort
}
echo "Unconneted snaps:"
(
diff -U0 -u
<(list_connected_snaps_sorted)
<(list_all_snaps_sorted)
)
| grep '^+'
| tail -n +2
| cut -c2-
hope it helps
snap remove <snap name>
Is a sledgehammer, but will fail stating dependency if one exists.
E.g. with firefox snap installed, attempt to remove its core framework:
snap install firefox
snap remove core20
Error states snap is being used by firefox
.
There are also softer dependencies which are in connections, e.g.
snap install firefox
snap connections | grep gtk-common-themes
snap remove gtk-common-themes

- 137
-
3This is a very bad advice.
snap remove
does not error on dependency removal, it only errors on an attempted base snap removal. Connections are the snap dependencies, a snap will fail to run if a connection is broken, there's nothing "soft" about it. And if you didn't try to start such a broken GUI snap from the console, you wouldn't even see the error message why nothing happens. – antichris Dec 05 '22 at 15:32 -
-
Now you know. Are you unable do it yourself? What made you think others should be responsible for fixing your bad answers? – antichris Dec 06 '22 at 20:52