34

I've been running out of memory on some of my small-footprint Ubuntu appliances. I noticed that snapd was running and using lots and lots of RAM. I took a chance and stopped the snapd service and things are still functioning, but I'm wondering if my machine is going to reboot properly.

What I want to know is, are there core services in a generic install of Ubuntu 16.04 server that require snaps to function?

Also, what are all the services that I need to disable with systemctl to get rid of snapd?

2 Answers 2

45

In versions of Ubuntu prior to 18.04, snapd is seeded in the default install simply to make installing snaps possible without further work. No part of the base install is a snap (snap list shows no snaps installed on a fresh system), and thus snapd can be removed with no ill effects:

sudo apt purge snapd

It will probably leave some dependencies lying around. You may want to remove them as well:

sudo apt autoremove

As of Ubuntu 18.04, fresh installs actually contain snaps. Purging snapd like above will remove those snaps. In 18.04 specifically, this wasn't that big of a deal-- the parts of the system shipped as a snap were things like the calculator, that you could still install as a Debian package. However, as of Ubuntu 22.04, more critical things like Firefox are shipped as a snap, and you can't just simply install the Debian package: the Firefox Debian package will just install the snap again. You'll need to find another way to obtain Firefox (e.g. a PPA you trust).

7
  • Using Ubuntu 19.04 with LXDE, removed snapd and system still works after a reboot
    – Fusseldieb
    Jan 17, 2020 at 12:24
  • 1
    Server 20.04 comes with some snaps installed. I had to do snap remove on lxd, core18 and snapd. Possibly in that order, due to dependencies.
    – mwfearnley
    Oct 15, 2021 at 18:15
  • 2
    @mwfearnley I believe purging snapd would have done that for you, did you try it?
    – kyrofa
    Oct 15, 2021 at 18:27
  • Alas, I did not. If I have another opportunity, I will try it. Thanks.
    – mwfearnley
    Oct 15, 2021 at 18:29
  • 1
    Purge should remove that as well, @Apollo.
    – kyrofa
    Dec 6, 2021 at 16:37
8

Bug #1642068 was logged against this issue and has recently been fixed: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1642068

4
  • That only happens if you're constantly installing and removing snaps (the bug reported installed/removed a snap every 3 seconds) Feb 1, 2017 at 9:11
  • Some of the work involved here was to fix the generic case of snapd's memory utilization, so I believe the fix was wider than the original bug report issue. Feb 1, 2017 at 9:49
  • 2
    Either way, it seemed like it was using a fairly large chunk of the available ram for something that wasn't doing anything. Feb 1, 2017 at 15:43
  • Indeed. Daemons should be relatively compact and lightweight for sure. Feb 1, 2017 at 16:08

You must log in to answer this question.

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