DEV Community

Cover image for Remove & Block SNAP from any Linux
Dev Programming
Dev Programming

Posted on

Remove & Block SNAP from any Linux

SNAP, The package manager for Linux is developed by Canonical offers the Linux users to install the latest version of Software Packages in the fastest & easiest way possible because Snap downloads the whole archive, with all the prerequisites inside, and install it in a confined folder that is isolated from the system. But a Large number of developers & Linux users don’t like SNAP for a lot of reasons. Before Snap, PPA was the recommended way to get third-party software on Linux System which is quite the easiest way to get third-party software and it still exists. SNAP does its task by forcing its legitimate Linux users and forcing is not something that Linux Users would tolerate and that’s the reason, Most of the Linux Users left Ubuntu & switched to other Linux distributions who don’t have the SNAP like Linux Mint 20 edition.

A Large number of developers are leaving Ubuntu because it becoming the proprietary operating system. People are using Linux not because It looks cool but These people want to be the arbiter of their own computer. Most users are switching to Linux Mint because Linux Mint removes SNAP from their 20th Editions and doesn’t come with the pre-installed SNAP in upcoming releases.

Linux users either switch to others operating systems or remove the SNAP from their Linux Systems. Let’s remove the SNAP from Ubuntu or even any Linux Operating System. So Let’s make the steps easier at least for removing & blocking the SNAP from the Linux System.

1. REMOVING SNAP PACKAGES

In the first step, You just need to check if you’ve SNAP packages installed in your system and if there are some, then Remove it all. You need to open the terminal and type :

snap list
Enter fullscreen mode Exit fullscreen mode

Image description

This command will show you the installed SNAP packages in your Linux system and after viewing the packages, remove those SNAP packages by typing the command in your terminal :

sudo snap remove --purge package-name
Enter fullscreen mode Exit fullscreen mode

You need to type the correct package name by seeing from the list to remove it completely. After removing all SNAP packages from Your System then You need to remove the SNAP cache by typing the command on your terminal :

sudo rm -rf /var/cache/snapd/
Enter fullscreen mode Exit fullscreen mode

After successfully removing the SNAP packages and their Cache from the System. Now you need to Stop the SNAP service & Unmount the SNAP Core Service. For doing that type the command :

sudo systemctl stop snapd
Enter fullscreen mode Exit fullscreen mode

This command will stop the SNAP service from your Linux System and after then Unmount the SNAP core service. To unmount the SNAP core service, You need to get the core id and for doing that type df to view the core ID, and to Unmount the SNAP core service, type the command :

sudo unmount /snap/core/<core-id>
Enter fullscreen mode Exit fullscreen mode

Now, This is the final step to Remove SNAP completely from Your Linux System. For doing that type the command :

sudo apt purge snapd* gnome-software-plugin-snap --auto-remove
Enter fullscreen mode Exit fullscreen mode

After removing SNAP completely from the Linux System then remove all of their Associated Directories by typing the command :

sudo rm -rf ~/snap /var/cache/snapd/ /var/snap /var/lib/snapd
Enter fullscreen mode Exit fullscreen mode

2. BLOCKING THE SNAP ON UBUNTU

After following all those steps to remove SNAP from Linux System completely but it’ll come back when you think you can now install chromium without SNAP which is not correct but you still did that and you’ll find that you’re installing SNAP again in your Linux System like in the picture down below.

Image description

Most people try to block the Installation of SNAP in their system by this command :

sudo apt-mark hold snapd
Enter fullscreen mode Exit fullscreen mode

If that command work for somebody then proceeds with that command but for those, that command didn’t work then you need to do it in an effective way that will strictly stop installing SNAP on your Linux System. For doing that type the command :

sudo cat << EOF > /etc/apt/preferences.d/snapd
Package: snapd
Pin: origin *
Pin-Priority: -1
EOF
Enter fullscreen mode Exit fullscreen mode

When you execute that command in your system then the possibilities are that you might see this error like in the picture down below.

Image description

To fix that error you need to get root and execute that command again for successful execution.

Image description

Now, You’ve successfully removed & blocked the SNAP from your Linux System. Enjoy the SNAP-free Linux System but You still can’t install Chromium on Ubuntu without SNAP. If You want to install chromium without snap then add the Debian Repository to do that and before doing that please acknowledge the Linux Packaging System.

Thank You for Reading This Article.

Top comments (0)