ubuntupackagesnapshotpackage-managerssnap

E: Package 'snapd' has no installation candidate . Can't install snap package manager


When I'm trying to run

sudo apt install snapd

It shows the error as below:

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

How to resolve this and install snap store in ubuntu ?

I tried to consult official documentation of snap at : https://snapcraft.io/docs/installing-snap-on-ubuntu

and it says:

Snap is pre-installed and ready to go on all recent releases of Ubuntu.

This means, if you’re running Ubuntu 16.04 LTS (Xenial Xerus) or later, including Ubuntu 22.04 LTS (Jammy Jellyfish) and Ubuntu 23.04 (Lunar Lobster), you don’t need to do anything.

But why isn't it in my system then !!


Solution

  • The above error is happening because APT Package Manager blocks the installation of snap packages.

    To enable snap support, we have two options:

    Option 1: Delete the nosnap.pref file in the directory /etc/apt/preferences.d by running the command:

    sudo rm /etc/apt/preferences.d/nosnap.pref
    

    Option 2: Comment the three lines of code in the same file.

    Package: snapd
    Pin: release a=*
    Pin-Priority: -10
    

    Now, install snapd:

    sudo apt install snapd
    

    And then, you can install any snap apps:

    sudo snap install <app-name>