You’ve tried to install something, but Ubuntu can’t bring it onboard. Apt mentions something about “no installation candidate.” What does this mean, what’s the source of the problem, and is it fixable? Here are some ways you can fix it.
Also read: The Ultimate Guide to Apt and Apt-Get Commands
What Does It Mean?
If you try to install a package that Apt does not know how to install, it will inform you it’s unable to locate it. This can happen if you mistype the name of a package or try to install an application that is not in the default repository.
There’s also another case of missing packages: Apt can’t find it in its usual location but knows it exists since another package references it.
For example, Ubuntu does not ship with any docker-related packages in its repositories. Despite this, there are a multitude of other packages that refer to it in the default repository. This, in turn, can be an issue if you are trying to create a WordPress site through Docker in Ubuntu.
Tip: Should the system crash on you, try these solutions to get Ubuntu back up.
How Can You Fix It?
Start by checking whether the package was removed during the last update/upgrade you performed. You don’t have to hunt it down in cryptic logs and only need to update and upgrade your system to get the latest versions of your installed software. In the process, Apt’s database will be updated:
sudo apt update && sudo apt upgrade
This issue happens because Apt does not automatically check whether your local repository is currently in sync with the upstream remote. Whenever your machine gets behind with updates, any identified remote links will break and produce a “no installation candidate” error.
Once your system is up to date, you can immediately install any package that is available in your default repository.
Add a Third-Party Repository
If that didn’t work, you’ll probably find the particular package in a currently unlisted repository. You only have to find and add it to your distribution’s software sources.
The Internet is your friend in finding the missing repository. For example, you can copy Docker’s Personal Package Archive (PPA) links from its websites to include its repositories in your local Apt instance.
Once located, you can add the repository to Ubuntu with the command:
sudo add-apt-repository REPOSITORY_PPA
Refresh your local Apt instance to include all the packages from the new repository. To do this, run the following command:
sudo apt update && sudo apt upgrade
Also read: How to Fix “Repository Does Not Have Release File” Error
Find a Renamed Package
In some rare cases the problem isn’t a missing repository but a renamed package. This can happen whenever a package undergoes a major revision or merges with a different one. To check for available packages with similar names, use the command:
apt-cache search PACKAGE_NAME
Depending on what you’re looking for, this may bring up a huge list of available software. Here’s a trick to narrow it down: Usually, package names won’t have radical name changes. What may change is a version number or a secondary keyword. Thankfully, apt-cache
supports Regex, so you can search for packages that begin with the specific keyword.
For example, suppose you entered the above command using “firefox” as the PACKAGE_NAME. In that case, you’d see dozens of entries with the word firefox in their names or descriptions. You could try the following instead:
apt-cache search "^PACKAGE_NAME*"
The above command will return a list of all packages whose name begins with PACKAGE_NAME. If you replaced PACKAGE_NAME for firefox, you’d see a list of all packages that start with the word “firefox.” Among them, you’d probably find an alternative to the one you’re seeking.
Also read: How to Fix the Ubuntu Login Loop
Frequently Asked Questions
Is it possible to find a list of available PPAs for Ubuntu?
Yes! While there is no built-in tool for listing all available PPAs, Canonical allows users to upload details about their personal repositories through Launchpad. You can search for the name of either the package or repository that you are looking for. Run sudo add-apt-repository
along with the Launchpad link to add a particular repository to your Ubuntu system, then refresh Apt by running sudo apt update
.
Do note that because Launchpad contains user-submitted repositories, you need to verify the integrity of any of its packages and repositories that you will add to your machine.
Ubuntu did not add my custom repository during an update. What am I doing wrong?
This is mostly likely due to a missing key from the repository you are trying to add. By default, Ubuntu uses apt-key to verify every repository for checked packages, including the built-in Canonical repositories and any third-party PPAs from Launchpad. This does not apply to any non-Canonical and Launchpad repository, so you need to first find the official signing key for the repository you are trying to add.
I am using Ubuntu LTS and getting a "no installation candidate" error. Is my system broken?
No! A “no installation candidate” error can also happen if you are trying to install a package that is only available to a later version of Ubuntu. One way to solve this issue is by using Ubuntu backport, a special repository where users can submit and maintain an up-to-date version of a package for older versions of Ubuntu. It can be helpful if an upgrade is unwanted, but the latest software is needed. You can install a package through backports by using the “-t” option in apt followed by the name of your Ubuntu version and “-backports.”
Image credit: Unsplash and Wikimedia Commons. Alterations and screenshots by Ramces Red.
Our latest tutorials delivered straight to your inbox