I have Gnome 3.26, 3.28 and 3.34 on my machine (Ubuntu 18.04) and want to know if I can get rid of any of them to save disk space. Is there some kind of snap command I can run that will show me?
- 191
2 Answers
Snap Commands to track connections
You may use command below to list all slots/plugs used.
snap connectionsor for specific app, example:
$ snap connections snap-store Interface Plug Slot Notes appstream-metadata snap-store:appstream-metadata :appstream-metadata - content[gnome-3-38-2004] snap-store:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 - content[gtk-3-themes] snap-store:gtk-3-themes gtk-common-themes:gtk-3-themes - content[icon-themes] snap-store:icon-themes gtk-common-themes:icon-themes - content[sound-themes] snap-store:sound-themes gtk-common-themes:sound-themes - dbus - snap-store:packagekit-svc - dbus - snap-store:snap-store - desktop snap-store:desktop :desktop - desktop-legacy snap-store:desktop-legacy :desktop-legacy - ...or probably best option with reverse search:
$ 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] 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-2004It may be worth adding, search by interface too:
$ snap interface content | grep gnome - firefox:gnome-3-38-2004 - snap-store:gnome-3-38-2004 - snapd-desktop-integration:gnome-3-38-2004 - gnome-3-38-2004:gnome-3-38-2004
Explaining snap connection
Due to the objective nature of snaps. Snap runs regular apps in confined environment. So each snap app that depends on another app, its developer has to declare the "connection" (or we may say plug-slot), mook765's answer here has used it for his approach (snap.yaml contains the dependencies declaration). The type of the connection is called "interface" content[gnome-3-38-2004]. And each connection composed of (one "slot" which is connected to either no, one or many "plugs"). Slot gnome-3-38-2004:gnome-3-38-2004 in this case is provided by gnome core snap, app declares and uses a plug ex:snap-store:gnome-3-38-2004 to that slot.
A good reference to read more: snapcraft.io: gnome-3-38-extension - plugs
Removing gnome-extension snap (Test)
Connections may auto/manually be connected or disconnected, that why I expect snap doesn't force uninstalling of dependent apps. I tested it within Ubuntu 22.04 in Virtual-box. Snap disconnects plug/slot and then removes the app. The app fails to run anyway.
$ snap remove gnome-3-38-2004
gnome-3-38-2004 removed
$ snap connections snap-store
Interface Plug Slot Notes
appstream-metadata snap-store:appstream-metadata :appstream-metadata -
content snap-store:gnome-3-38-2004 - -
content[gtk-3-themes] snap-store:gtk-3-themes gtk-common-themes:gtk-3-themes -
content[icon-themes] snap-store:icon-themes gtk-common-themes:icon-themes -
content[sound-themes] snap-store:sound-themes gtk-common-themes:sound-themes -
dbus - snap-store:packagekit-svc -
...
$ snap-store
ERROR: not connected to the gnome-3-38-2004 content interface.
$ firefox
ERROR: not connected to the gnome-3-38-2004 content interface.
- 49,176
You can find out the dependencies of a snap by examining it's snap.yaml-file which is
/snap/<snapname>/<revision>/meta/snap.yaml
The commands
~$ grep "default-provider:" /snap/*/*/meta/snap.yaml
~$ grep "base:" /snap/*/*/meta/snap.yaml
will produce a list of all needed dependencies for all installed snaps, a dependency not listed can safely be removed. See the example in this answer.
- 18,644