Installed Snap package earlier and now you want to uninstall it?
To remove a snap package, use the command in the following fashion:
sudo snap remove package_name
But what if you don’t like Snap and want to delete not just the applications but also the Snap packaging support?
In this tutorial, you’ll learn to:
- Remove Snap applications
- Delete Snap entirely from Ubuntu and other distributions
Let’s see it in detail.
Uninstall Snap packages
You need the exact package name to remove it. The tab completion works too.
For that, list all the snap packages installed on your system:
snap list
Do you notice some entries with ✓ check marks or asterisks in the screenshot below? They are ‘verified’ snap packages from official developers.
If there are too many packages, you can grep with an appropriate search term.
Once you get the package name, use it to uninstall the package.
sudo snap remove package_name
At least on the Ubuntu desktop, if you don’t use sudo with snap remove, it prompts for the password graphically. But it’s better to use sudo because you need elevated privileges for removing snap applications anyways.
In my case, I installed Spotify on Ubuntu in snap format. Now, I remove it like this:
sudo snap remove spotify
It takes a few seconds and you should see some messages about the removal. By the end of the process, you only see the completion message.
And that’s how you remove applications installed in snap format.
But what about removing snap entirely? Not the snap applications but the snap daemon itself.
Remove Snap entirely (Distros other than Ubuntu)
For non-Ubuntu distributions, where you manually installed Snap support, removing snapd should not create any problems.
First, make sure that you don’t have any snap packages installed.
snap list
If there are any, remove those snap packages first.
sudo snap remove package1 package2 package3
On Debian, Linux Mint, elementary OS etc, use the apt command to remove snapd:
sudo apt remove --purge snapd
On Fedora-based distributions, use the DNF command:
sudo dnf remove snapd
Later on, you can remove the snap folder from your home directory and /var/cache/snapd if you are particular about that.
Remove Snap entirely from Ubuntu (Use with extreme caution)
The latest releases of Ubuntu has snap integrated deeply. Also, many Ubuntu-specific features, like livepatch, will only work with snap enabled. As a suggestion, do not perform this on your main production machine, unless you know what you are doing.
You can always choose another distribution, like Linux Mint or Pop!OS, if you don’t love Ubuntu, just because of the Snap.
The below-mentioned method is tested on Ubuntu 22.04 LTS. To eradicate the snap from Ubuntu, first you need to know what packages are installed as snaps. To do this, enter:
snap list
You will get a list of installed applications. Assuming you have not installed any other snap packages, other than the default, it will look like this:
Before removing all the packages, first, stop the snapd services running. use the following commands one by one:
sudo systemctl disable snapd.service
sudo systemctl disable snapd.socket
sudo systemctl disable snapd.seeded.service
After this step, you can remove all the snap packages installed. One issue you may encounter is the cycle of dependencies, where you cannot remove a package because another depending on it is running in the background. This happens when you try to remove the snaps in the order they appear.
As said earlier, if you have no additional snaps installed other than the default, you can remove them without error in the following order. Else, you remove those snap packages also.
sudo snap remove --purge firefox
sudo snap remove --purge snap-store
sudo snap remove --purge gnome-3-38-2004
sudo snap remove --purge gtk-common-themes
sudo snap remove --purge snapd-desktop-integration
sudo snap remove --purge bare
sudo snap remove --purge core20
sudo snap remove --purge snapd
This step removes all the snaps installed. You can verify this by using snap list
Once snaps are removed,, you can clear the leftover data by issuing the following command:
sudo rm -rf /var/cache/snapd/
Now, completely remove snapd from your system using the command:
sudo apt autoremove --purge snapd
If you notice, even after purging, the snap directory is left on your home directory. Remove it either with Nautilus:
Or use:
rm -rf ~/snap
At this point, all the snapd services in the system will be stopped. You can check this by running:
systemctl list-units | grep snapd
Getting Firefox and Software Center back
You have removed snap apps and disabled services. But since snap is deeply integrated, an update command may bring all those removed items back. Also, while removing, you removed two crucial pieces of software, Firefox and GNOME software center.
To avoid the re-entry of the snap, you need to create a preference file to block it. To do the same, open a terminal and enter the following commands:
sudo nano /etc/apt/preferences.d/nosnap
And enter the following lines and save the file (CTRL+X and press ‘y’ and Enter in nano editor).
Package: snapd
Pin: release a=*
Pin-Priority: -10
After saving the file, update your system:
sudo apt update
Now, if you want to install the GNOME Software center, use the following command:
sudo apt install --install-suggests gnome-software
Where, --install-suggests
ensures that the snap version is not installed.
Luckily, the Mozilla team maintains a PPA, to install the latest Firefox in Ubuntu as a DEB package. You can refer to our dedicated article on installing Firefox as a DEB package in Ubuntu.
Before proceeding, make sure that you have not installed Firefox transitional package from the Ubuntu repository.
sudo apt purge firefox
Also, to avoid any snap Firefox being installed, create a file “firefox-no-snap” in /etc/apt/preferences.d/
and save a couple of code lines as given below:
sudo nano /etc/apt/preferences.d/firefox-no-snap
Package: firefox*
Pin: release o=Ubuntu*
Pin-Priority: -1
Now install Firefox, from PPA using the command below:
sudo add-apt-repository ppa:mozillateam/ppa
sudo apt update
sudo apt install -t 'o=LP-PPA-mozillateam' firefox
To enable auto-updates to PPA, where unattended-upgrade
s will not upgrade it automatically, use the command:
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
As the last step, to avoid any inclusion of a snap version of Firefox, you should give high priority to the newly added Firefox PPA. Otherwise, Ubuntu may install Firefox from its own repository, which will lead to more and more snaps. To do so, create a file in /etc/apt/preferences.d/
and enter the below lines of code and save.
sudo nano /etc/apt/preferences.d/mozillafirefoxppa
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501
That’s it. You completely removed snap from Ubuntu. But, as from a practical point of view, this is just a fun task. Because, there are a lot of distributions available based on Ubuntu, without snap pre-installed. So, it will be better to use something like that in real life, other than going the painful way.
Conclusion
Some people strongly dislike Snap because of its “closed” nature. Personally, I don’t have any particular liking or dislike for it. I prefer using apt but when I don’t get the required package or version, I go for other formats like Snap, Flatpak, and AppImage.
As I mentioned earlier, please don’t remove the snap daemon from Ubuntu, if you are unsure about it. It may leave you with a broken system and neither of us wants that.