How to Install and Enable Snap on Linux Mint 22, 21 or 20

Snap is a package management system that installs and manages software on Linux distributions. Snaps are self-contained applications with all their dependencies, making them easy to install and use across different Linux distributions. They update automatically and provide a secure and consistent environment for applications. Linux Mint 22, 21, and 20 do not come with Snap pre-installed, as the Linux Mint team prefers Flatpak due to its open-source nature and tight integration with the Mint ecosystem. However, enabling Snap on Linux Mint can expand the range of available software and provide an alternative method for managing applications.

Although Linux Mint prefers Flatpak, some users might enable Snap for various reasons. These reasons include access to specific applications available as Snaps, preference for Snap’s automatic updates, or familiarity with the Snap ecosystem. This guide walks users through the steps to install and enable Snap on Linux Mint.

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 follow the following steps to 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 version

Example output:

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, use the following command to enable the Snap service immediately and automatically on system reboot. Note that this may already be set, but it is always ideal to run 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

Example output:

I would also advise installing the Snap core system package, which is optional.

sudo snap install core

You can optionally reboot, but this can be skipped; if you notice any issues, I would advise doing this.

reboot

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!” meaning the Snap service works and is 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>

For 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, you can find it in the following path: Taskbar > Administration > Snap Store.

Example:

Remove Snap and Restore nosnap.pref

One of the best things I can say about Snap is that 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 individually. All you need to do is remove the snapd service, which, during removal, will uninstall all installed snap packages.

sudo apt autoremove snapd

Example output:

In the above example, you can see in the output that Snap packages were installed; for the tutorial case, 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.

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

Conclusion

With Snap installed and enabled on Linux Mint, users can easily access and manage a wide range of applications through the Snap Store. While Linux Mint favors Flatpak for its open-source nature and integration, Snap offers an alternative that some users may find beneficial for specific applications or automatic updates. Regularly updating Snap ensures access to the latest features and security enhancements. Users will appreciate the convenience and flexibility that Snap brings to the Linux Mint experience, making it easier to install and use their favorite software.

1 thought on “How to Install and Enable Snap on Linux Mint 22, 21 or 20”

Leave a Comment