If you are trying to install Snap on your Debian-based Linux system using:
sudo apt install snapd
and encounter the following error:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package snapd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'snapd' has no installation candidate
This guide will help you resolve the issue and successfully install Snap.
Why Does This Error Occur?
The error occurs because the APT package manager is blocking the installation of Snap packages. This is often due to a system setting that disables Snap support.
How to Fix the Issue
To enable Snap support, follow one of the two options below:
Option 1: Delete the ‘nosnap.pref’ File
By default, some versions of Debian-based Linux may include a configuration file that prevents Snap from being installed. To remove this restriction, delete the file:
sudo rm /etc/apt/preferences.d/nosnap.pref
Then, update your package list:
sudo apt update
After that, you can install Snap with:
sudo apt install snapd
Option 2: Modify the ‘nosnap.pref’ File
If you prefer not to delete the file, you can modify it by commenting out the restrictive lines. Open the file using a text editor:
sudo nano /etc/apt/preferences.d/nosnap.pref
Find the following lines:
Package: snapd
Pin: release a=*
Pin-Priority: -10
Comment them out by adding #
at the beginning of each line, like this:
# Package: snapd
# Pin: release a=*
# Pin-Priority: -10
Save and exit (press CTRL+X
, then Y
, and Enter
).
Now, update your package list:
sudo apt update
Then, install Snap:
sudo apt install snapd
Verifying Snap Installation
Once installed, verify that Snap is working by checking its version:
snap --version
If Snap is installed correctly, it will display output similar to:
snap 2.58
snapd 2.58
series 16
Installing Applications Using Snap
Now that Snap is installed, you can use it to install applications. For example, to install VLC:
sudo snap install vlc
You can search for available Snap packages using:
snap find <package-name>
To list installed Snap packages:
snap list
Conclusion
The “Package ‘snapd’ has no installation candidate” error occurs due to a system restriction on Snap packages. By either deleting or modifying the nosnap.pref
file, you can enable Snap support and install it successfully. Once installed, you can use Snap to install and manage various applications on Debian-based Linux distributions.
Happy coding!