Linux: remove snap completely

snap is yet another system for installing software on Linux computers.

Whether you need it or not, at the moment (2021) the snap store is under the sole control of Canonical (Ubuntu) and the source code is proprietary, so nobody can check what the snap store actually delivers and installs.

For me this is a security risk, which is why I completely remove snap as one of the first steps in every Linux installation. Unfortunately, this is not that easy because snap nests in the system like an octopus.

This example was done with the Odroid C4 running Ubuntu Mate (as delivered by Hardkernel).

This process must be strictly adhered to:

all work in a terminal:

odroid @ odroid: ~ $ snap list
Name Version Rev Tracking Publisher Notes
certbot 1.12.0 953 latest / stable certbot-eff ✓ classic
core 16-2.48.2.1 10828 latest / stable canonical ✓ core
core20 20201210 907 latest / stable canonical ✓ base
/dev/loop1 88M 88M 0 100% / snap / core / 10828
/dev/loop4 87M 87M 0 100% / snap / core / 10585
sudo systemctl stop snapd
sudo unmount /dev/loop1 (and all others too)
sudo systemctl start snapd

now snap core can be removed: sudo snap remove core
to check: snap list must not display anything anymore.

Snap is now empty and unused, but is still in the system. Now it can be removed:

sudo apt-get remove snapd

Done, my Ubuntu on the Odroid is free of software I don't want and I feel safer again.