7

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?

  • Probably, there is a command that allows you to see details on a snap, including which other snaps it would need. The full documentation of snap is here: https://snapcraft.io/docs – vanadium Sep 29 '20 at 08:52
  • 1
    Yes, I expect there probably there is. And I would like to know what it is. Hence my question! snap info <snap-name> --verbose doesn't give me that dependency info. – charlesdeb Oct 27 '20 at 11:46
  • 1
    I'm not quite understanding your question. By definition, snaps are self-contained binary blobs, so there are no external dependencies. This is by design. However, if you're asking whether you can safely delete snaps such that their removal won't adversely impact your Linux environment, the command to run would be sudo snap services which lists active services employed via snaps. For validation, you can also run sudo systemctl status snap.<service name>. I hope that helps answer your question. – richbl Nov 02 '22 at 22:29
  • How do you get the list of Gnome versions? – cachius Nov 04 '22 at 13:41
  • 1
    @cachius snap list gives you the list of snaps - and I see I now have Gnome 3.38 and Gnome 42 as well on my machine! But I first spotted this looking at disk space usage. – charlesdeb Nov 04 '22 at 14:06
  • 1
    @richbi running sudo snap services lists a canonical live patch service and a desktop integration thing - but nothing that says "gnome". My question was - as you have I think worked out - is "what will happen if I delete these gnome snaps?". I think the answer is here: https://askubuntu.com/questions/1155957/two-different-versions-of-gnome-runtime. Bur I still don't know where these snaps came from or what ubuntu software relies on them. – charlesdeb Nov 04 '22 at 14:11
  • On my answer I mention that gnome-... snaps are just backends for GTK snap apps. If you don't use snaps you can remove them. Also "it's possible to remove all the snaps, and remove snapd... the desktop will function fine" (from Popey, former snap developer; now developer of unsnap). – Pablo Bianchi Nov 04 '22 at 16:44

2 Answers2

4

Snap Commands to track connections

  • You may use command below to list all slots/plugs used.

    snap connections
    

    or 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-2004 
    
  • It 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.

user.dz
  • 48,105
  • 1
    Interesting. So, for your example, it looks like the gnome-3-38-2004 snap is used for the firefox, snap-store and snapd-desktop-integration snaps. If you were to remove the gnome snap, presumably those other 3 snaps would be affected/break/need to be uninstalled as well. Do I have that right? – charlesdeb Nov 05 '22 at 14:31
  • BTW, I have no idea what connections, interfaces, plugs or slots are when it comes to snaps. I thought a snap was just a different way if installing software - so all these other terms are brand new to me. I guess I'd need to read the docs... Thanks for your help – charlesdeb Nov 05 '22 at 14:32
  • @charlesdeb You are right however you don't have to remove dependent apps, but they may have limited/partial functionality or completely break. (I didn't test it, i will soon, I have Ubuntu in a virtualbox). – user.dz Nov 05 '22 at 14:37
  • @charlesdeb About idioms, Snap create isolated runtime environment for each app. So each app needs another app, its developer has to declare the "connection", type of connection is called "interface". And each connection composed of (1 "slot" and 0 or many "plugs"). Slot in this case is provided by gnome core snap, each app that depend on gnome, declare and use a plug to that slot. – user.dz Nov 05 '22 at 14:42
  • 1
    so why is firefox and chrome also using such an old library from 2004? – rubo77 Nov 06 '22 at 16:29
  • @rubo77 Snap core is built after releasing Ubuntu. So they are released and updated in sequence: Ubuntu 22.04 -> core22 -> Apps migration. They are kind of slow in stable channel, only if some prefer installing from edge channel. – user.dz Nov 06 '22 at 16:51
  • Note that this doesn't seem to list the base (core18, core20, core22, and so on). – Flimm Mar 16 '23 at 12:41
2

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.

mook765
  • 15,925