I am looking for a way to remove snap packages that are no longer depended upon, similar to apt autopurge/apt autoremove for .deb/dpkg packages.

What does apt autoremove do?

It removes packages that were installed as dependencies, recommendations, or suggestions of other packages, but are no longer marked as such after an update, or because the original package has since been uninstalled.

But snap packages are dependencyless

Contrary to this common misconception, anyone who installs a common snap (eg. snap install firefox), will see that several other snaps are installed as its dependency, such as gtk-common-themes, gnome-<version>, core<version>, and others that are in turn dependencies of these.

So, this question has been incorrectly marked as a duplicate.

Just remove the snap

The question is not how to remove a snap, but how to remove all automatically installed ones that are no longer needed. Finding out which snaps are no longer depended on is non-trivial when there are hundreds of them installed.

  • 3
    @guiverc This is clearly incorrect, which you can see yourself if you install a snap, for example snap install firefox and it will also install gtk-common-themes, gnome-3-38-2004 or similar, core20 or core18, and bare. So the question stands
    – P Varga
    Commented May 16, 2022 at 1:44
  • 1
    Those are not dependencies which was a design purpose of snap packages. Yes it's easy to think of them that way (esp. if thinking in deb package terms) but they're not called dependencies. Snap packagers can implement everything internally; or build using shared/common packages to save disk space/resources... This can be seen in the file /snap/firefox/current/snap/snapcraft.yaml for firefox; but they're not dependencies (but plugs). The base is different; snap packages built for Ubuntu Core 16 will require core16.. but that's still an important plug called base.
    – guiverc
    Commented May 16, 2022 at 1:56
  • 3
    Regardless of terminology, after an update, people end up with several versions of core for example that no other snap needs any more, because it moved to core18, then core20, etc etc. So core16 will still be installed but unnecessarily. So the question is, how to remove these stale packages that are left behind?
    – P Varga
    Commented May 16, 2022 at 2:04
  • 1
    @PabloBianchi I think that removes disabled snaps and I'm looking to remove "unused" or "orphaned" ones. Unless that's the same thing, but I don't think so.. it looks like I have enabled but unused snaps for example gnome-3-38-2004
    – P Varga
    Commented May 28, 2022 at 23:35
  • 1
    In other words, snapd doesn't track plugs/dependencies/prerequisites and users have to manually clean up the mess left behind by uninstalled snaps?
    – SArcher
    Commented Jun 20, 2022 at 18:13


Browse other questions tagged .