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.

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: 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: Refresh your local Apt instance to include all the packages from the new repository. To do this, run the following command:

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: 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: 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. Image credit: Unsplash and Wikimedia Commons. Alterations and screenshots by Ramces Red. 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.