4

I am using ubuntu 20.04 LTS on my hp-notebook ( i5-6th gen, 8GB RAM, 1GB AMD Radeon graphics card). The snapd.services are causing my pc to boot slow (about 1 min 15 sec in userspace). Also, it takes about 15 sec from login screen to desktop.

Is there any way to completely remove all snaps, snappy package manager and snap files and cache without breaking any other packages?

Hades
  • 51
  • Well it depends on which snap package your removing and for the snap manager, that shouldn't be necessary! – George Udosen Jun 19 '20 at 08:36
  • 1
    I'm a fan of removing the snap completely but unfortunately the Ubuntu Software app needs snappy daemon to get launched.There are a few more examples like Software updater. You can list the installed snaps via snap list command . Here's the output from a live ubuntu ISO. And the bad news is that when you install some programs like Chromium in Ubuntu 20.04 via apt , it actually gets installed via snap.Ubuntu is now very reliant on snaps.But the good news is the situation is a little better in forks like Kubuntu. – Parsa Mousavi Jun 19 '20 at 08:54
  • 1
    You can remove the snap Software Center and install the apt version and there are ways of installing Chromium as a deb package. Search this site and you'll find ways of doing this. – To Do Jun 19 '20 at 08:56
  • @N0rbert That post is a little old. In Ubuntu 20.04 the situation is changed a bit.Some programs like Chromium now needs snappy.(unless you downloaded it manually from their website).There are also more dependencies.See my comment. – Parsa Mousavi Jun 19 '20 at 08:56
  • @ToDo What's the apt version of Software Center ? I tried Gnome-Software and it needs the snappy too.And also where's the deb package of Chromium ? – Parsa Mousavi Jun 19 '20 at 09:02
  • Here's the answer to install Chromium without snap: https://askubuntu.com/a/1206153/27968. And here's the answer to replace gnome-sofware: https://askubuntu.com/a/1241847/27968. Since you're getting rid of snap, you don't need the snap plugin. – To Do Jun 19 '20 at 10:25

3 Answers3

7

I'm currently running Ubuntu 20.04 LTS in a real enviroment and in a VM and I removed snap snapd following this steps:

# stop snapd services
sudo systemctl stop snapd && sudo systemctl disable snapd
# purge snapd
sudo apt purge snapd
# remove no longer needed folders
rm -rf ~/snap
sudo rm -rf /snap /var/snap /var/lib/snapd /var/cache/snapd /usr/lib/snapd

Then, in order to avoid that other applications may reinstall it (chromium-browser is an example of application that restores snapd even if installed via apt) you can create a file no-snap.pref by issuing:

sudo -H gedit /etc/apt/preferences.d/no-snap.pref

and then copying the following content in it:

# To install snapd, specify its version with 'apt install snapd=VERSION'
# where VERSION is the version of the snapd package you want to install.
Package: snapd
Pin: release a=*
Pin-Priority: -10

The file above prevents you from installing snapd if you type sudo apt install snapd, but allows you to install it if you run sudo apt install snapd=2.45.1+20.04.2 (the version in the command is just an example).


Original answer (2020/06/19): I'm currently running Ubuntu 20.04 in a real enviroment and in a VM and I removed snap following this article: https://www.kevin-custer.com/blog/disabling-snaps-in-ubuntu-20-04/

I've never had any kind of issue following these steps.

Note that if you receive some errors while removing some snap package, try to remove another one and then come back to the one that gave you troubles: snap packages may have some dependencies, and you cannot remove one before before another one.

Moreover, before the command sudo umount /snap/core/xxxx run sudo systemctl stop snapd

Lorenz Keel
  • 8,905
  • Thank you for helping me. Do I need to install the deb versions using apt after removing the listed snaps? – Hades Jun 19 '20 at 16:55
  • And also what are the core, core18, gnome-3-34 and gtk-themes needed for? – Hades Jun 19 '20 at 16:56
  • 1
    You have not provided the list of your snap apps, and I don't know which of them you use or not. For sure, you don't need to look for the deb version of core / core18 / gnome-3-34 and gtk-themes: they are packages connected to snap apps to make the snap apps work correctly and with the same look of "normal" applications. – Lorenz Keel Jun 19 '20 at 17:17
  • Thank you Lorenz! Well I don't have many snaps installed right now (vlc, Spotify, gnome-calculator being the imp ones). I will be starting with a fresh install of ubuntu 20.04 and would remove snappy from it. – Hades Jun 19 '20 at 19:12
  • 1
    Thanks for the re-install prevention steps, +1 – Organic Marble Nov 18 '20 at 17:45
3

You should be able to remove all snap packages, as per the normal procedure:

sudo snap remove package-name

More info here: Snap in Ubuntu 16.04

When you have removed all packages, you can remove the snap daemon:

sudo apt purge snapd; rm -rf ~/snap

This should completely remove snap, and not break anything else.

Artur Meinild
  • 26,018
  • Is removing the daemon advisable, rather stop and disable autostart instead! – George Udosen Jun 19 '20 at 08:47
  • It shouldn't really matter. You can always install it again, and it does nothing beyond managing snap images. But yes, you could also stop and disable. – Artur Meinild Jun 19 '20 at 08:48
  • And best practice would be the latter case IMO! – George Udosen Jun 19 '20 at 08:51
  • 1
    You can safely remove the snap daemon fully, so the answer on the question as expressed in the title is a "yes". – vanadium Jun 19 '20 at 09:10
  • I am not able to remove core, core18 and gnome-3-34 snaps. Are these needed, if yes, can I replace them with deb versions. – Hades Jun 19 '20 at 17:00
  • You don't need them, but check Lorenz answer below - there might be some dependencies, so that they should be removed in a specific order. Also, I would try and boot into a mode with no GUI. If I had to guess, it's probably the "gnome" snap that's used by the GUI, and then depending on core and core18. – Artur Meinild Jun 19 '20 at 19:02
0

Remove the snap package as per the answer given by Arthur but I would advise against completely removing the daemon, rather disable it so it doesn't run at startup:

sudo systemctl disable snapd

And to check if disabled:

sudo systemctl is-enabled snapd

And to re-enable at a later date:

sudo systemctl enable snapd
George Udosen
  • 36,677