Snap is a popular software package management system used by Ubuntu & Debian systems, like APT (Advanced Packaging Tool). It contains software packages as well as their dependencies. But it can take up a lot of disk space on your Ubuntu system. Many users and system administrators prefer removing snap package manager from their system, and use APT instead. This is because they can be slow at times and have security issues. It allows developers to publish software without any monitoring. In this article, we will look at how to remove Snap from Ubuntu/Debian systems.
How to Remove Snap in Ubuntu
While Snap is a promising alternative to APT, users have reported to experience performance and security issues from time to time. This has prompted many of them to drop snap from their system. Here are the steps to remove snap package manager from your system.
1. Get List of Snap Packages
Open terminal and run the following command to list all snap packages installed on your system.
$ snap list
This will show you a list of all the snap packages installed on your system.
2. Remove Snap Packages
Run the following command to remove all the snap packages from your system.
$ sudo snap remove snap-store $ sudo snap remove gtk-common-theme $ sudo snap remove gnome-3-34-1804
Please ensure to run the above commands in the same order as mentioned here.
3. Unmount Snap Core Services
Run the following command to unmount snap core services. Replace <core-id> with the core id of your Ubuntu system. You can obtain this information by running df command.
$ sudo umount /snap/core/<core-id>
Here is an example of core id obtained using df command.
$ df Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 1016364 0 1016364 0% /sys/fs/cgroup /dev/loop0 25600 25600 0 100% /snap/amazon-ssm-agent/4046 /dev/loop2 101760 101760 0 100% /snap/core/11606 /dev/loop3 101888 101888 0 100% /snap/core/11420 /dev/loop1 56832 56832 0 100% /snap/core18/2074 /dev/loop4 34176 34176 0 100% /snap/amazon-ssm-agent/3552 /dev/loop5 56832 56832 0 100% /snap/core18/2128 tmpfs 203272 0 203272 0% /run/user/1000
If you are using Ubuntu 20.04 just run the following command.
$ sudo umount /var/snap
4. Remove Snapd
Run the following command to remove snapd and its services.
$ sudo apt purge snapd
5. Remove Associated Folders
Finally, run the following command to delete the folders associated with snap.
$ sudo rm -rf ~/snap /snap /var/snap /var/lib/snapd
You may verify the removal by running the following command.
$ snap –version
That’s it. In this article, we have learnt how to remove snap package manager from Ubuntu/Debian system.
Also read:
How to Select Random Records in MySQL
How to Recursively Change Directory Owner in Linux
How to Append Text At the End of Each Line in Linux
How to Find Out Who is Using File in Linux
How to Find & Remove Unused Files in Linux
create file:
$ sudo nano /etc/apt/preferences.d/nosnap.pref
with text:
Package: snapd
Pin: release a=*
Pin-Priority: -10
and your snap can’t installation =)
check it:
$ sudo apt install firefox
And see:
The following packages have unmet dependencies:
firefox : PreDepends: snapd but it is not installable
Thank you for the tip. It is useful.