5 Ways to Fix “E: Unable to locate package” Error on Ubuntu

Sometimes, when installing a package on Ubuntu using the APT package manager, you might bump into the error “E: Unable to locate package“. This might seem a little confusing especially when you have checked your internet connection and are sure everything is in place.

In this tutorial, we will explore the reasons why this “E: Unable to locate package” error manifests and possible solutions to remedy it in Ubuntu.

1. Check Package Spelling/Case-Insensitive in Ubuntu

A typo in the name of the package may result in this error. In fact, this is the first thing you should check. For example, to install the Mariadb server on Ubuntu, if you type mariabd-server instead of mariadb-server, you will get the error.

$ sudo apt install mariabd-server
E: Unable to locate package Error
E: Unable to locate package Error

In addition, typing a package name in uppercase characters will also contribute to this error. For example, typing MARIADB-SERVER will result in the same error.

Therefore, it is always advisable to check the spelling of the software package in case you run into this error. In addition, ensure that the case is right (mostly lowercase).

2. Update Local Package Index in Ubuntu

If there’s no typo in the package name, and you are still experiencing the error, you might want to consider refreshing the local package index. This is especially true if you are using a fresh installation of Ubuntu which ships with an empty cache.

To update the local cache, run the apt update command as follows.

$ sudo apt update

Once the cache is updated, the APT package manager will reference the freshly built local cache and finally install the package in question from the default Ubuntu repository.

3. Check Package on Ubuntu Packages Search

Another approach you can take is to check the availability of the package on Ubuntu Packages Search, which is a website that displays information about all packages hosted on the Ubuntu Package archive.

It allows you to browse through a list of packages available for any Ubuntu release and contained in any of the four main repositories provided by Ubuntu [main, multiverse, restricted, and universe].

Before you do so, it’s prudent to, first of all, check what Ubuntu release you are using.

$ hostnamectl 
OR 
$ lsb_release -a

From the output provided, you can see that we are running Ubuntu 22.04, Jammy JellyFish.

Check Ubuntu Release
Check Ubuntu Release

Now, head over to the Keyword search box and type in the name of the package. Next, select your distribution. If you are not sure which repository the package is contained in, set the ‘Section’ option to ‘any’ and click ‘Search’.

In this example, we are searching for the availability of the Flameshot package.

Ubuntu Package Search
Ubuntu Package Search

If the package is available, you will get a match. In our case, we got an exact match detailing the OS release, a simple description of the software package, and the repository that provides it (Universe).

A positive result grants you the go-ahead to proceed with the installation of the package. If the package cannot be found, then it is not yet available in the default repositories and cannot the installed directly using the APT package manager.

Ubuntu Package Information
Ubuntu Package Information

4. Install Missing Ubuntu Repositories

As we have already seen, Ubuntu provides 4 repositories –

Each of these provides a set of packages for download on your system. If you are on an older system that is missing any of these repositories, you can add them as follows.

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

Once you have added the repository, ensure to update the local cache to notify your system of the new packages provided by it.

$ sudo apt update

Now give it another try and, this time, you should be able to install the package without an issue.

5. Check Your Active Ubuntu Release

There are two major releases provided by Ubuntu. The LTS (Long Term Support) is a release that is supported or maintained for 5 years. Support includes bug fixes, patches, and security updates. The latest LTS release is Ubuntu 22.04.

The other release is the standard or interim release, which is supported for nine months. At the moment, the latest standard release is Ubuntu 23.04.

When a release reaches end-of-life (EOL) it stops being supported by Canonical and no longer receives patches, updates, and new software.

To check if you are running an active Ubuntu release, run the following command.

$ hwe-support-status --verbose

The command provides the following output. The last sentence will tell if your system is supported or not. In our case, we are running Ubuntu 22.04 which will be supported until April 2027.

Check How Long Ubuntu Supported
Check How Long Ubuntu Supported

If your system is not supported, you will most certainly encounter the error.

Conclusion

These are some of the possible solutions to address the “Unable to locate package” Error on Ubuntu. If you are still experiencing challenges installing a package, consider trying to install it from Snap or flatpak.

You can also install packages from third-party repositories known as PPAs (Personal Package Archive). This is a repository that provides software packages maintained by individuals or groups of developers. These packages are not avaiable in Official Ubuntu repositories.

And this draws this guide to a close. We have seen various ways that you can use to troubleshoot the “Unable to locate package” error in Ubuntu.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Winnie Ondara
My name is Winnie, a Linux enthusiast and passionate tech writer in Linux and DevOPs topics. I enjoy keeping abreast with the latest technologies in the Linux ecosystem and trying out new tools provided by the FOSS community.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

1 Comment

Leave a Reply
  1. Better use gdebi, which is a package manager utility used for installing Debian package files (*.deb) packages.

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.