While Linux Mint doesn’t ship with snapd preinstalled, having Flatpak installed is usually enough for most users. Some may wish to enable Snap and still use the system that Linux Mint provides. For those interested in doing this, this tutorial will cover everything you need to know to turn on Snap and ensure it’s running correctly.
Remove Snap Block (nosnap.pref)
Linux Mint allows users to add additional APT preferences when installing packages. By default, this preferences.d directory contains a configuration file named nosnap.pref, which provides instructions that prevent APT from automatically installing snaps with selected packages.
To remove the nosnap.pref file, run the following command.
sudo rm /etc/apt/preferences.d/nosnap.pref
Alternatively, you can rename the file as a backup if you wish to restore it.
sudo mv /etc/apt/preferences.d/nosnap.pref /etc/apt/preferences.d/nosnap.pref.backup
Now update your Linux Mint system packages cache list by running an apt update.
sudo apt update
Install Snapd (Snapcraft service)
Now that you have removed the block preventing Snap from being installed. You can run through the following steps, which will install Snap.
sudo apt install snapd -y
This command will install the Snap package manager and all the necessary dependencies.
After the installation is complete, you can verify that Snap is working by running:
snap 2.57.5+22.04ubuntu0.1 snapd 2.57.5+22.04ubuntu0.1 series 16 linuxmint 21 kernel 5.15.0-57-generic
You should see the version number of the Snap package manager you installed.
Before proceeding any further, enable the Snap service immediately and automatically on system reboot using the following command. Note that this may already be set, but it is always ideal for running the command to ensure it is set.
sudo systemctl enable --now snapd.service
Optionally, you can check the systemctl status using the following command.
systemctl status snapd.service
I would also advise installing the Snap core system package, which is optional.
sudo snap install core
Optionally, you can reboot, but this can be skipped; if you notice any issues, I would advise doing this.
Now test that the Snap service is working using the following command.
sudo snap install hello-world && hello-world
The output should be “Hello World!” which means the Snap service is working and installed correctly.
How to Install Snap Packages
Now that you have enabled Snap, the command to install packages is as follows.
sudo snap install <package name>
Example installing Telegram.
sudo snap install telegram
If you want to install the Snap (Snapcraft) GUI store, run the following command.
sudo snap install snap-store
To launch Snap Store, this can be found in the following path Taskbar > Administration > Snap Store.
Remove Snap and Restore nosnap.pref
One of the best things I can say about Snap, if you want to remove all Snap installations and the package manager itself, you do not need to go through each installation and remove them one by one. All you need to do is remove the snapd service, which, during removal, will uninstall all installed snap packages.
sudo apt autoremove snapd
In the above example, you can see in the output that Snap packages installed, for the case of the tutorial, Snap Store and HelloWorld were automatically removed in the cleanup. If you have installed 100 Snap applications, you do not need to remove these before from Snap itself.
Now, you can restore the block if you rename the original block file to nosnap.pref.backup, convert the file to its original name using the mv command.
sudo mv /etc/apt/preferences.d/nosnap.pref.backup /etc/apt/preferences.d/nosnap.pref
Alternatively, if you deleted the file, use the following command that will automatically create a new block file.
sudo tee /etc/apt/preferences.d/nosnap.pref<<EOF # To prevent repository packages from triggering the installation of Snap, # this file forbids snapd from being installed by APT. # For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html Package: snapd Pin: release a=* Pin-Priority: -10 EOF
In this small tutorial, you have learned how to remove the block preventing Snap from being installed, install the application, and learn some essential functions of using it, along with how to remove and restore the Snap block if required. Overall, I believe you would only install Snaps if you are an avid user of them and ported from Ubuntu or it contains better-supported software you cannot get quickly on the default APT repository, Flatpak, or a third-party repository such as LaunchPAD PPA’s, etc.