OS: Ubuntu 20.04

The following is the output of snap list on a new install of Ubuntu 20.04:

$ snap list
Name                             Version             Rev   Tracking         Publisher   Notes
core18                           20200311            1705  latest/stable    canonical✓  base
gnome-3-34-1804                  0+git.2c86692       27    latest/stable/…  canonical✓  -
gtk-common-themes                0.1-36-gc75f853     1506  latest/stable/…  canonical✓  -
snap-store                       3.36.0-74-ga164ec9  433   latest/stable/…  canonical✓  -
snapd                            2.44.3              7264  latest/stable    canonical✓  snapd

And this is what I see after installing a variety of snaps (and removing some):

$ snap list
Name                             Version                     Rev   Tracking         Publisher   Notes
core                             16-2.44.3                   9066  latest/stable    canonical✔  core
core18 •                         20200427                    1754  latest/stable    canonical✔  base
firefox *                        77.0b2-1                    358   latest/beta      mozilla✔    -
gnome-3-28-1804                  3.28.0-16-g27c9498.27c9498  116   latest/stable    canonical✔  -
gnome-3-34-1804 •                0+git.2c86692               27    latest/stable/…  canonical✔  -
gnome-system-monitor *           3.32.0-27-g32ed970e06       135   latest/stable    canonical✔  -
gtk-common-themes •              0.1-36-gc75f853             1506  latest/stable/…  canonical✔  -
kanagram *                       20.04.0                     51    latest/stable    kde✔        -
kcolorchooser *                  20.04.0                     57    latest/stable    kde✔        -
kde-frameworks-5                 5.47.0                      27    latest/stable    kde✔        -
kde-frameworks-5-core18          5.61.0                      32    latest/stable    kde✔        -
kde-frameworks-5-qt-5-14-core18  5.68.0                      4     latest/stable    kde✔        -
kolourpaint *                    20.04.0                     56    latest/stable    kde✔        -
ksnip *                          1.7.0                       46    latest/edge      dporobic    -
okular *                         20.04.0                     98    latest/stable    kde✔        -
snap-store •                     3.36.0-74-ga164ec9          433   latest/stable/…  canonical✔  -
snapd •                          2.44.3                      7264  latest/stable    canonical✔  snapd

For ease of discussion, let's call

  • the five original snaps (tagged with next to their names) "system snaps"
  • the snaps I knowingly installed (tagged with * next to their names) "primary snaps"
  • and the other snaps "supporting snaps"
    • core
    • gnome-3-28-1804
    • kde-frameworks-5
    • kde-frameworks-5-core18
    • kde-frameworks-5-qt-5-14-core18

Given that a snap and a minimum of two revisions are stored by the system, and that some supporting snaps can be a couple of hundred MB (ls -lh /var/lib/snapd/snaps), it would be worth knowing which secondary snaps can be removed if the primary snap has been already removed.

But how does one "map" the supporting snaps to the primary snaps?

In my case, I can run snap connections okular to intuit that kde-frameworks-5-qt-5-14-core18 was installed as a consequence of sudo snap install okular.

But snap connections … works only if the relevant snap is still installed. I had installed but then removed falkon, featherpad, kcalc, konversation, palapeli, and the stable version of ksnip.

Is there a log file related to installing and removing snaps akin to /var/log/dpkg.log or /var/log/apt/history.log?

If not, how else is one to know if a "supporting" snap is still required?

A related, but unanswered, question is here: How can I list manually installed snaps and remove no longer needed automatically installed ones?

  • 2
    Have you ever tried to remove one of the "supporting" snaps? I just did, if the snap is still in use by other snaps, you will get an error message. Another hint can be found in the snap.yaml-files (each snap has one) in /snap/snapname/current/meta, look for the lines base: and default-provider:, but this would be cumbersome if many snaps are installed.
    – mook765
    Commented May 6, 2020 at 14:47
  • I think your idea of trying to remove "supporting" snaps is neat. There shouldn't be too many of them and so quite feasible. Looking at the .yaml would require the primary snap to still be present.
    – DK Bose
    Commented May 6, 2020 at 15:07
  • Looking at all .yaml-file would make it possible to exclude still needed snaps. If we have a "supporting" snap installed which is not needed anymore, this snap wouldn't appear in any of the o.yaml-files of other snaps. But that's obviously cumbersome.
    – mook765
    Commented May 6, 2020 at 15:12
  • Ok, I just tested. Removing supporting snaps is possible even if the primary snap is still present. At least that's the case for all the kde-frameworks-5 ones.
    – DK Bose
    Commented May 6, 2020 at 15:12
  • Oh, good to know. I tested it with the core18-snap and got error: cannot remove "core18": snap "core18" is not removable: snap is being used by snaps gnome-3-28-1804, gtk-common-themes, snap-store and wire. Looks like we have to wait for the devs to implement an autoremove feature similar to apt.
    – mook765
    Commented May 6, 2020 at 15:16

3 Answers 3


Examining the snap.yaml files of all installed snaps may help us to know which supporting snaps are needed as dependencies:


~$ grep "default-provider:" /snap/*/*/meta/snap.yaml
/snap/snap-store/415/meta/snap.yaml:    default-provider: gnome-3-28-1804
/snap/snap-store/415/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/snap-store/415/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/snap-store/415/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/snap-store/current/meta/snap.yaml:    default-provider: gnome-3-28-1804
/snap/snap-store/current/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/snap-store/current/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/snap-store/current/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/wire/132/meta/snap.yaml:    default-provider: gnome-3-28-1804
/snap/wire/132/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/wire/132/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/wire/132/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/wire/current/meta/snap.yaml:    default-provider: gnome-3-28-1804
/snap/wire/current/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/wire/current/meta/snap.yaml:    default-provider: gtk-common-themes
/snap/wire/current/meta/snap.yaml:    default-provider: gtk-common-themes
~$ grep "base:" /snap/*/*/meta/snap.yaml
/snap/gnome-3-28-1804/116/meta/snap.yaml:base: core18
/snap/gnome-3-28-1804/current/meta/snap.yaml:base: core18
/snap/gtk-common-themes/1506/meta/snap.yaml:base: core18
/snap/gtk-common-themes/current/meta/snap.yaml:base: core18
/snap/snap-store/415/meta/snap.yaml:base: core18
/snap/snap-store/current/meta/snap.yaml:base: core18
/snap/wire/132/meta/snap.yaml:base: core18
/snap/wire/current/meta/snap.yaml:base: core18

If an installed snap does not appear on the right side of the output, then it is not a dependency to any other snap, and this snap can be removed. Of course, your manually installed snaps will not appear on the right side of the output, usually no other snaps depend on them, this are snaps you want to keep.

We can make the output a bit shorter if we check the snap.yaml-files only for the current active revision of the snaps:

grep "default-provider:" /snap/*/current/meta/snap.yaml
grep "base:" /snap/*/current/meta/snap.yaml

There is one snap installed as soon if you install your first snap and that is a snap named snapd. The snap snapd is not referenced in the lists provided by the commands above. According to https://snapcraft.io/snapd this snap is needed to install, configure, refresh and remove snap packages. This snap is not removable as long as you have any snaps installed:

~$ snap remove snapd
error: cannot remove "snapd": snap "snapd" is not removable: remove all other snaps first
  • Could you please clarify how to interpret 'Not listed "supporting" snaps can be removed'? "Not listed" means a difference between your grep result(s?) and an ls -l? Or what's the method exactly?
    – Levente
    Commented Dec 21, 2022 at 11:55
  • @Levente If you have a snap installed and this snap does not appear on the right side of the output, then no other snap dedends on this snap. If a snap appears on the right side, you will know which other snaps depend on it. In my example you see the wire-snap, it appears only on the left side, means no other snap depend on wire. Look at gtk-common-thems, it appears on the right side and you can see that snap-store and wire depend on it. the snap gtk-common-themes itself depends on core18.
    – mook765
    Commented Dec 21, 2022 at 12:21
  • Thanks for the clarification! So snap apps can indicate their dependencies in their corresponding snap.yaml files — according to current standards — in two different ways: either as default-provider:, or as base:. So: 1. I need to save the result of snap list into an array. Then 2: I need to build a second array from the results of both of those grep searches. Then 3: I need to produce the difference of these two arrays (subtract the items present in the grepped array from the one produced by snap list). If I was a bash / awk wizard, then I could contribute the code :)
    – Levente
    Commented Dec 21, 2022 at 17:32
  • @mook765 I tried to edit and clarify a bit based on the discussion on this question (which I believe is a dupe). Commented May 16 at 10:09
snap connections

shows which snap is using which or for one app e.g.:

$  snap connections snap-store
Schnittstelle             Plug                                      Slot                             Notizen
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                  -
fwupd                     snap-store:fwupd                          :fwupd                           -
gsettings                 snap-store:gsettings                      :gsettings                       -
network                   snap-store:network                        :network                         -
network-manager           snap-store:network-manager                -                                -
network-status            snap-store:network-status                 :network-status                  -
opengl                    snap-store:opengl                         :opengl                          -
packagekit-control        snap-store:packagekit-control             :packagekit-control              -
password-manager-service  snap-store:password-manager-service       :password-manager-service        -
personal-files            snap-store:dot-snap-auth-json             -                                -
snapd-control             snap-store:snapd-control                  :snapd-control                   -
system-files              snap-store:hostfs-usr-share-applications  :system-files                    -
system-observe            snap-store:system-observe                 :system-observe                  -
upower-observe            snap-store:upower-observe                 :upower-observe                  -
wayland                   snap-store:wayland                        :wayland                         -
x11                       snap-store:x11                            :x11                             -
  • 1
    This appears to be inefficient: apparently one would need to run this command for each snap found in snap list, and compile the found deps. To clarify for others, I understand that the true snap dependencies here are in the third, Slot column, and are the items that have something in front of the :. The part in front of the : is the name of the snap that is a dependency of the examined one. In this snippet, e.g. gnome-3-38-2004 from gnome-3-38-2004:gnome-3-38-2004, and gtk-common-themes from e.g. gtk-common-themes:gtk-3-themes. All the other items seem to me as noise.
    – Levente
    Commented Dec 21, 2022 at 17:51

These two commands improved from the other answers might help:

snap list --all | awk '/-/{print $1}'

grep "default-provider:\|base:" /snap/*/current/meta/snap.yaml | awk '{print $NF}'

These list the non-core and non-base snaps, and list snaps currently used. A script or one-liner could be used to compare the two, but manually installed snaps (like Chromium) still show up, and I couldnt find a way to exclude them like you can with Apt. snap list --help doesnt have that info. Maybe another file does.

  • Tying those commands together will list all snaps that are not dependencies: snap list --all | awk '/-/{print $1}' | sort | uniq | grep -vhF "$(grep "default-provider:\|base:" /snap/*/current/meta/snap.yaml | awk '{print $NF}')"
    – creinig
    Commented Apr 26 at 7:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .