[Solved] “E: Unable to locate package” Error on Ubuntu

Ubuntu comes with lots of different packages that you can install for your benefit, but sometimes you can face an error saying “E: Unable to locate package”. This usually happens when you need to follow the proper format of installing that package, or your Ubuntu distribution needs to include the relevant information needed to install that package.

This article will enlist all the possible methods to fix the error “E: Unable to locate package” Error on Ubuntu. There are 4 common methods that you can perform to resolve these issues, as listed below and will be described in this post.

So, let’s discuss each of these methods in detail in the section below.

Note: In this guide, all the solutions are tested on the latest LTS release of Ubuntu, that is, Ubuntu 22.04 (codenamed Jammy Jellyfish).

Solution 1: Check the Package Spelling

Top 10 Linux Distros

You should know that Ubuntu is case-sensitive, which means that a command should be written in the same way when it was designed in the first place. For example, if a command is in small letters, then you need to write it in the same way and not in capital letters and avoid misspellings as well. One of the examples is mentioned below where you can face such a problem.

$ sudo apt install package

Whereas “package” is a general word that needs to be replaced with the actual package name that you want to install:

We will be explaining all the solutions in no specific order, so any solution can work for you depending on the reason that causes it.

Solution 2: Update and Upgrade All Packages

The first thing that you should always do in such scenarios is to update and upgrade your system packages. This will ensure that you are running the latest version of all the packages and that everything is up to date:

$ sudo apt update && sudo apt upgrade -y

Now, try to install your desired package, and if still, the problem persists, then you can follow the second method.

Solution 3: Add Missing Repositories

Another cause is that the relevant repositories are not in which the package you want to install is available. Although the latest versions of Ubuntu, such as 22.04 LTS come with pre-installed repositories, it can happen if you use an older version. So, some of the major repositories that you should consider adding to your operating system are:

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

These are the four main repositories that you should consider for installation and after that trying to install the package again. If the problem still prevails, then you can consider the next method.

Solution 4: Verify the Package Using the Office Ubuntu Packages Website

In this method, you need to visit the official website for Ubuntu packages to find if the required package is available or not:

Now, scroll down and find the “Search Package Directories” option. In the Keyword tab, you need to type the package name you are looking for. After that, you need to select the distribution, which is “jammy” in our case, and hit the search button:

Note: To check which version of Ubuntu you are using, you can execute the below-mentioned command:

$ lsb_release -a

As you can see that, I am using Ubuntu 22.04 LTS with the Jammy version in the image below, so you need to look for the relevant package for your Ubuntu.

Bonus Tip: Follow the Supported Method to Run Commands

If you are using the latest version of Ubuntu which is 22.04, then there is also a possibility that you are following the methods that are supported on older versions of Ubuntu. New versions come with many updates, and the older version commands may not be suitable for new releases. Therefore, it is recommended to run the commands of the supported versions.

That’s all from this post!


To resolve the issue “E: Unable to locate package”, we have discussed four different methods, which are “Check the Package Spellings”, “Update and Upgrade All Packages”, “Adding Missing Repositories,” and “Verify the Package using Office Ubuntu Packages Website”. This usually occurs when the command is not written properly, or your Ubuntu system does not have the package. This post has briefly explained all the possible solutions to fix the “E: Unable to locate package” error on Ubuntu.