Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

apt says snapd has no installation candidate

ErrorE: Package 'snapd' has no installation candidate

Short answer

apt only offers a package that its lists and pinning rules allow. On Linux Mint, a preference file named nosnap.pref deliberately blocks snapd, so move it away, run apt update and install again. On a plain Ubuntu system the package lists are usually stale or empty, so run apt update first.

  • Applies to Ubuntu 24.04, Linux Mint 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Look for the Mint block file and note which distribution you are on. If the file exists, the first cause applies; if not, go to the second.

    lsb_release -a
    ls -l /etc/apt/preferences.d/
  2. 2Match what you see, then jump to its fix

    1. 1/etc/apt/preferences.d/nosnap.pref exists on a Linux Mint 20 or later systemLinux Mint blocks snapd with nosnap.prefFix
    2. 2No nosnap.pref file, and apt has not been updated since a fresh install or an image restoreThe package lists are stale or emptyFix

What does the error look like?

  • E: Package 'snapd' has no installation candidate
  • Package snapd is not available, but is referred to by another package.

Cause 1 of 2

Linux Mint blocks snapd with nosnap.pref

1Check

List the preferences folder. Mint ships a file called nosnap.pref there, and while it is in place apt will not install snapd.

ls -l /etc/apt/preferences.d/nosnap.pref

2Fix

Rename the file so it no longer ends in .pref, refresh the package lists and install snapd. Log out and back in (or reboot) afterwards.

sudo mv /etc/apt/preferences.d/nosnap.pref /etc/apt/preferences.d/nosnap.bak
sudo apt update
sudo apt install snapd

3Verify

Install the hello-world snap and run it. It prints Hello World!

snap install hello-world
hello-world

Confirmed by snapcraft.io

Did this fix it?

Cause 2 of 2

The package lists are stale or empty

1Check

apt works from index files that apt update downloads from the sources in /etc/apt/sources.list and /etc/apt/sources.list.d/. If that download never succeeded, the index has no entry for snapd.

sudo apt update

2Fix

Run apt update until it finishes without errors, then install snapd. Fix any error it prints for a repository first, because a failed repository leaves its packages out of the index.

sudo apt update
sudo apt install snapd

3Verify

Install and run the hello-world snap after logging out and in again.

sudo snap install hello-world
hello-world

Confirmed by snapcraft.io

Did this fix it?

How do I stop it coming back?

  • Run sudo apt update before installing anything on a new or restored machine.
  • Rename rather than delete nosnap.pref, so you can put Mint's default back later.
  • Read the full apt update output once; an error on one repository line explains many 'no installation candidate' messages.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.