Unable To Locate Package In Ubuntu

The Unable to Locate Package error can happen due to multiple reasons, ranging from incorrect package names to issues with the package index. We’ll cover all such causes as well as what you can do to fix this error in this article.

Verify Package Name

The most common reason for this error is that users enter the wrong name when trying to install a package. There could be a simple typo (e.g., Neofetch or neo-fetch when the actual package name is neofetch).

Or with a package that has a longer name, you could be getting the entire thing wrong. For instance, users often try to install Google Chrome with sudo apt install chrome when the standard package is actually google-chrome-stable.

For verification, you can look up the package online, or from the terminal as shown in the next section.

Check Package Availability

When using apt, you’re trying to install packages from the enabled Ubuntu repositories. You should make sure the package in question is actually present in the repository. You can use apt search to do this as shown below.

apt search flameshot

Alternatively, you can also search through the Ubuntu web archive.

Here, you can verify whether the package is available for your Ubuntu version or not, and which repository its present in.

At this point, there are two ways to proceed.

Enable Ubuntu Repos

By default, only the Main Ubuntu repository is enabled. But the package you’re trying to install may be located in the Universe (community-maintained software), Multiverse (copyrighted software), or Restricted repositories (proprietary drivers).

In such cases, all you need to do is add the appropriate repository. You can either search the web archive as mentioned earlier. Or if you know the package name, you can use apt policy to find which repo it belongs to.

apt policy flameshot

Now, enable the appropriate repository (or all of them). 

sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo add-apt-repository restricted

Finally, update your package index to enable the installation of packages from the new repos.

sudo apt update

Install Package from Alternative Source

The second scenario is that the package isn’t available in any of the official repos. This is pretty common actually as Ubuntu doesn’t package many popular proprietary apps (e.g., Google Chrome, Discord, etc.).

In this case, you should check the package’s official website or GitHub page for info on alternative installation methods. We’ve listed the three most common methods below and each has its pros and cons. 

Snap

If the program can be installed with snap, you can either look for it in the Software Center, or search and install it from the terminal like so

snap search discord
snap install discord

The good thing about snaps is that they require no effort on your part in terms of maintenance. The snapd daemon checks for updates 4 times a day, so you won’t need to worry about keeping the packages updated.

The bad thing is that some snaps can be slower to launch or unstable.

Deb File

If the developer provides a .deb file, you can download and install said Deb file. Right-click the Deb file and select Open With Another Application > Software Install.

Or, go to the directory containing the file and install it from the terminal like so

sudo apt install ./discord-0.0.25.deb

This method is common and convenient at first, which is nice. But when it comes time to update, you’ll usually need to remove the old package, download the updated Deb file, and install it, which can be a hassle.

PPA

Personal Package Archives (PPAs) are typically used for distributing the newer versions of packages compared to what’s present in the official repos, or to distribute non-standard software.

For instance, if the Thunderbird package from the Ubuntu repo is outdated and you want the latest version, you could add the MozillaTeam PPA and install Thunderbird like so

sudo add-apt-repository ppa:mozillateam/ppa
sudo apt update && sudo apt install thunderbird

This method is very convenient too as you can manage packages with apt. But do exercise some caution when it comes to PPAs.

After all, a PPA of an obscure program made by an unknown dev can’t be held to the same level of trust as a PPA from reliable devs like the Mozilla Team, for instance. 

Anup Thapa

Senior Writer

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys reading up on a range of topics, traveling, working out, and MOBAs.