Recent versions of Ubuntu are shipping with Snapcraft by default, and some of the default applications run inside a snap as well. Snaps are application containers, similar to Docker, but designed for desktop applications.

Unfortunately Canonical seems to be pushing Snaps hard, and they are not always wanted. This is made worse by not providing an easy way to remove the snap functionality for Ubuntu.

The commands bellow will entirely remove snap from an Ubuntu installation.

sudo snap remove snap-store
sudo apt remove snapd
sudo umount /dev/loop*
sudo rm -rf /snap
sudo rm -rf /var/snap
sudo rm -rf /var/lib/snapd
sudo rm -rf /etc/systemd/system/snap*
sudo rm -rf /root/snap/ /home/*/snap
sudo apt purge snapd
echo -e 'Package: snapd\nPin: origin *\nPin-Priority: -1' | sudo tee /etc/apt/preferences.d/no_snapd

Note: by default Firefox is installed as a snap and will be removed with the above commands. So if you want to keep Firefox installed (or any other snap program you had previously installed) you will need to re-install it using apt.

sudo apt install firefox

The above commands have been successfully tested and work on Ubuntu 20.04 and 22.04.