Remove & Block SNAP from any Linux
Tags: opensource, devops, beginners, ubuntu
Published: 2022-03-29 19:34:10

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
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2bw2ewe00lp2xb5pz0k.png)

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
```

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/
```

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
```

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>
```

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
```

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
```


## 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dv6gs79095o0uy8ilfla.png)

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

```
sudo apt-mark hold snapd
```

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
```

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/imkwknvun7eb6u142q1n.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3tr7ne6jdj8954qa0ig.png)

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.