Ubuntu is distributing more applications as the universal Snap package, but some users don’t like them. So I’m writing this tutorial for those want to completely get rid of Snap and prevent it from being installed back.
NOTE: Before getting started, please backup your app data, e.g., Firefox bookmarks. Attention that Ubuntu Software will also be removed after following this tutorial.
Step 1. Remove Snap apps and the Daemon
Press Ctrl+Alt+T on keyboard to open a terminal window. When it opens, run the commands below one by one.
1.) List all installed snap applications:
They are by default Snap Store (Ubuntu Software), Firefox, default theme, and few core packages.
2.) Remove the apps one by one, Firefox and Snap-store go first, then theme package, gnome platform (in sandbox), and finally base packages and snapd daemon. NOTE: the package names may vary depends on “snap list” output.
sudo snap remove --purge firefox
sudo snap remove --purge snap-store
sudo snap remove --purge gnome-3-38-2004
snap remove command to remove “gtk-common-themes”, “snapd-desktop-integration”, “bare”, “core20”, and finally “snapd”.
3.) Finally remove the Snap daemon package via apt:
sudo apt remove --autoremove snapd
Step 2. Block Snap package
After completely removed snap packages, you may prevent Ubuntu from installing them back by settings low priority for the
Snapd package. Here’s how to do the trick inspired by the way Linux Mint 20 did.
1.) Press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the command below to create and open a configuration file:
sudo gedit /etc/apt/preferences.d/nosnap.pref
When the file opens, paste lines below to tell refuse
snapd from any repository:
# To prevent repository packages from triggering the installation of snap,
# this file forbids snapd from being installed by APT.
Pin: release a=*
2. After save the file, refresh package cache via command:
sudo apt update
Now, whenever you try to installed a Snap package or the daemon, it outputs either unmet dependencies (snapd) or package has no installation candidate.
How to Restore:
If you change your mind, run the commands below at any time will install back the Snap apps.
Firstly, run command in terminal (Ctrl+Alt+T) to unblock the daemon:
sudo rm /etc/apt/preferences.d/nosnap.pref
Then, install Ubuntu Software via command:
sudo snap install snap-store
And install Firefox as snap if you want by running command:
sudo apt install firefox