How to Enable or Disable Snap in Linux Mint 20
As you may know, the snap support is disabled by default in the Linux Mint 20. The apt
package manager is prevented from using and installing span packages, and there is no span management tools installed out of the box. If you decided to go with a snap app, here is how to enable the snap support in Linux Mint.
The Linux Mint team doesn't like the idea behind the snap protocol and the way it is implemented by Canonical.
Advertisеment
The Snap Store is exclusively controlled by Canonical. It is a centralized software source. While Snap is open-source, it only works with the Ubuntu Store. You cannot create your own store, and uses a closed protocol to deliver updates. This means that Snap client works only with one store, and nobody can create his own store for redistributing span packages.
On other hand, Snap is similar to AppImage or Flatpak the Snap Store. It can be used to deliver up-to-date apps regardless of what version of Linux you are running and how old it is. The store lockdown issue of snap doesn't allow devs to audit, patch, or modify software it contains. It makes it similar to proprietary software.
These are the reasons the Linux Mint team has the span tools disabled in Mint 20.
If you are not happy with their decision, and need to use snap, it is still possible to unlock it.
To Enable Snap in Linux Mint 20,
- Open terminal as root.
- Type the following command:
# rm /etc/apt/preferences.d/nosnap.pref
. This will enable Snap. - Now, update the package cache for apt with this command:
# apt update
. - Finally, install the snapd package:
# apt install snapd
.
Note: Do not enter the #
portion. It is just an indicator for the root console in which you have to type the commands above.
You are done! The snap tools are now enabled.
Later, you may change your mind and block the snap tools again.
In this case, you need to restore the /etc/apt/preferences.d/nosnap.pref
. Here is how it can be done.
To Disable Span in Linux Mint 20
- Open terminal as root.
- Remove the snapd package: #
apt purge snapd
. - Execute the following command:
# echo 'Package: snapd' > /etc/apt/preferences.d/nosnap.pref
. - Now, run the command Pin:
# echo 'release a=*' >> /etc/apt/preferences.d/nosnap.pref
. - Finally, run the following command:
# echo 'Pin-Priority: -10' >> /etc/apt/preferences.d/nosnap.pref
. - Verify that you have everything done correctly by viewing the file contents with the command
# cat /etc/apt/preferences.d/nosnap.pref
. It should contain all the three lines.Package: snapd Pin: release a=* Pin-Priority: -10
- Now, update the package cache for apt with this command:
# apt update
.
You are done.
You can check what's new in Linux Mint 20 here:
Linux Mint 20 is out, you can download it now
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!
Advertisеment
Open terminal as root:
sudo su #this is bad practice, and inherently wrong… you should be using sudoers and ‘sudo su’ will not give you login-specific resource files such as .bash_profile .profile or .login and will be read by the shell. Neither will it drop yo u into the root ~. this will place you in the current working directory you were in prior to running sudo and enable you delete any files without any recourse whatsoever.
If this is required sudo -i or sudo -s (gives you the root user shell) would be more optimal…however you should be reading the man pages before running random commands online with no or little knowledge.
Type the following command:
rm /etc/apt/preferences.d/nosnap.pref – why are you deleting this file to later rely on it for recovery?
To disable snapd again:
Open terminal as root:
sudo su – we’re already logged in as root, says it all really.
These steps are how not to run escalated privilege tasks in any Linux distro.
Lesson to learn, do not run commands you have no idea about because someone blogged out it.
1. OK, I agree about the environment files/interactive shell. However, in this very case, it doesn’t change things. Just to remove the file, even
sudo su
is OK.2. > why are you deleting this file to later rely on it for recovery
Why not? I am not going to recover it if I need snap in Mint. Anyway, the recovery steps are below.
3.> sudo su – we’re already logged in as root, says it all really.
We are not.
4.> do not run commands you have no idea about because someone blogged out it.
That’s a good tip for everyone. Even if I find it a bit toxic in this context.
Anyway, thanks for your comment. I will update the root terminal article. There is always a way improve your posts.
I haven’t tried it, but renaming the file would be a more future-proof technique than removing it, since it would make restoring simpler. That is
> mv /etc/apt/preferences.d/nosnap.pref /etc/apt/preferences.d/nosnap.pref.bak
can replace rm for disabling and
> mv /etc/apt/preferences.d/nosnap.pref.bak /etc/apt/preferences.d/nosnap.pref
can then replace the echo stuff for restoring.
sorry, but what if i want to install snap just for one app, and than replace this nosnap.pref file in /etc/apt/preference.d/ folder, is this will work normal or i should not do this? Thanks.
That will work. But you will also have to install the snapd app if you removed it earlier.