how to Fix E Unable to Locate Package Error on Ubuntu
General Linux Topic

Ubuntu’s support for different packages is one of its most valuable features because it allows you to install and run different packages based on your needs. But in contrast to this valuable feature of Ubuntu, when installing packages, you sometimes encounter the “E: Unable to Locate Package” error, which is nothing to worry about.

“E: Unable to Locate Package” is a common error when installing various software and packages in Ubuntu using theapt-getoraptcommand. There are various reasons for receiving this error. Choosing the wrong package installation format or not supporting the relevant information to install the desired package can be common reasons for receiving the “E: Unable to Locate Package” error.

But we have to remind you once again that Linux does not fail in front of any problem and has solutions for every problem. Due to its unique features, Ubuntu has become the most popular operating system for servers among Linux users. It is not without reason that Ubuntu Linux VPS has become the priority of users when buying Linux VPS because, with Ubuntu, any problem can be solved, and it does not allow any problem to remain unsolved. You just need to be familiar with Linux commands and use various commands and the Ubuntu Package Manager (APT) to solve problems related to installing packages in Ubuntu.

This guide will walk you through the steps of fixing this error on Ubuntu by explaining the causes and solutions. After reading this guide, you can rest assured that you will be able to successfully install the software of your choice in Ubuntu.

Reasons for getting the “E: Unable to Locate Package” error in Ubuntu

Ubuntu uses the comprehensive and advanced APT package management tool to install, remove, and upgrade packages in the default Ubuntu repository. As a Linux administrator, you are probably already familiar with the APT package manager and how to use it.
Sometimes, when you install a new package in Ubuntu using the apt command line tool, you will get the following error:

sudo apt-get install package_name


Reading package lists... Done
Building dependency tree      
Reading state information... Done
E: Unable to locate package package_name

The “E: Unable to Locate Package” error means that you have not succeeded in finding the package you are looking for. The first step in fixing this issue is figuring out why you’re getting this error, and then doing what needs to be done to fix it. You might be asking what the issue is or why we are getting this error.

There are several reasons for receiving this error, including:

  • The Ubuntu repository cache does not support new packages
  • Non-availability of the main repositories to install the desired package
  • A misspelling in the package name
  • Unavailability of the package for the version of Ubuntu you are using
  • Expiration of the version of Ubuntu and end of the support period for the desired version
  • The problem with the resource list

After identifying the problem using the apt package manager and the solutions we will provide, your problem will be solved.

How can we fix Ubuntu’s “E: Unable to Locate Package” error?

Without wasting time, we will go directly to solving the problem of installing various packages in Ubuntu. First, you must identify the causes of this problem and then use appropriate solutions to solve it.

1. Updating packages and repository cache

When installing the desired software package, the apt package manager tool first checks the cache to find the package and version information, and then downloads and installs the desired package through the network and its repositories. If the cache does not support the package you want, Ubuntu will have problems installing the software and the package.

The first suggestion we have for this problem is to update and upgrade the package list of the default Ubuntu repositories to support new and updated packages and software. Run the following commands to ensure that the packages in the Ubuntu repository are up-to-date:

sudo apt update && sudo apt upgrade -y

With the update of Ubuntu repositories, apt cache is no longer out-of-date and supports new and updated packages.
After updating, install the desired package. If you get the “E: Unable to Locate Package” error again, try other solutions.
Note: We recommend that you download and install the packages you need from.deb files. You can also remove the lines from the/etc/apt/sources.list after installing the desired package.

2. Adding main repositories to install packages

One of the common problems in old versions of Ubuntu is not pre-installing the main repositories for installing various software and packages. Fortunately, this problem does not happen in the new version because new versions of Ubuntu (such as LTS 22.04) are provided to users along with the main repositories. Anyway, if you are using an old version of Ubuntu, don’t forget to add the main repositories to the Ubuntu operating system to avoid possible errors when installing various programs. Add the main repositories for installing packages to Ubuntu by running the following commands:

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

After adding the main repositories to Ubuntu OS, if you have problems installing apps, try other solutions.

3. Checking the package name

Since Ubuntu is case-sensitive, you must pay attention to uppercase and lowercase letters when running commands. Because misspelling the actual package name can cause problems. Therefore, when running commands in Ubuntu, check the spelling of the package name several times and ensure that the package name is typed correctly.

Also, note that the package’s name may differ from the name of the software you want; for example, the installable package zlib in Ubuntu is zlib1g. When installing, you should pay attention to upper and lower case letters and the actual name of the package.

If you are sure the package is spelled correctly when running the installation command, then the reason for receiving the “E: Unable to Locate Package” error is not a mistake in typing the package name.

4. Checking the availability of the package for the Ubuntu version

If you have tried the previous solutions and your problem is not resolved, it may be that the package you are looking for is not really available for the version of Ubuntu you are using. How can we find out if the package is available in the Ubuntu version we are using?

It’s not complicated, first, get complete information about the version of Ubuntu you are using:

lsb_release -a


No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

As the command output shows, the version of Ubuntu we are using is 22.04.1 LTS with a jammy codename. Your version of Ubuntu may be different from ours, however, you should now look for packages for your Ubuntu version by visiting the official Ubuntu Packages website.

On the official Ubuntu website, scroll down to find the search section. Type the name of the package you want to download in Ubuntu in the keyword field. Then enter the code name for the Distribution field and set the section to any. Finally, click on the search button.

how to fix Ubuntu's "E: Unable to Locate Package" error

In the output, you will find out whether the package you want to install is available for the version of Ubuntu you are using or not.
If the desired package is available for your version of Ubuntu, check the repository it belongs to.
If the package is available in the universe or multiverse repository, but these repositories are not available in the Ubuntu system, you will see the error “E: Unable to Locate Package” again when installing the package. Therefore, as in Solution 2, you need to add the relevant repositories to Ubuntu:

sudo add-apt-repository universe multiverse

And to notify these repositories of new packages, you need to update the repositories cache with the following command:

sudo apt update

By doing these steps, your problem should be solved when installing the new software, if not, we hope that other solutions will fix Ubuntu’s “E: Unable to Locate Package” error.

The question that arises for most users is what to do if the package you want to install is not available for the Ubuntu version.

Sometimes some software is not updated, and new versions of Ubuntu do not support the packages of some software. You can use third-party repositories like PPA to install such software. We have already introduced you to what PPA is, so you are well familiar with its use. If there is no official PPA for the desired package, by checking the official Ubuntu website, you can somehow install your desired package with alternative methods such as using DEB files or snap packages for some projects.

5. Checking the activation of the Ubuntu version

Most likely, you are familiar with the regular and LTS versions of Ubuntu, so you know that the regular versions of Ubuntu are supported for up to 9 months; after 9 months, you will have to update the version of Ubuntu. While the long-term version of Ubuntu receives support for up to 5 years.

If you use the regular version, you must update the Ubuntu version every 9 months. If the Ubuntu version is not supported and has expired, you will receive the error “E: Unable to Locate Package” when installing new packages.

To check the status of the Ubuntu version and ensure that it is supported, use the following command:

hwe-support-status --verbose


You are not running a system with a Hardware Enablement Stack. Your system is supported until April 2025.

In the output you receive, you can ensure that your system is actively supported until what date. If it has not expired, then the reason for receiving the “E: Unable to Locate Package” error is not the expiration and lack of support for the Ubuntu version.

6. Fixing the repository

Ubuntu’s source.list file contains all repository-related data. The source lists are in charge of tracking down the requested package from the repository for installation. When you fail to install a package using the apt command, you can check the apt source list to locate the packages. apt looks for available packages using the source list in the /etc/apt/sources.list file. Therefore, open the desired file with super privileges and the desired editor and find the following lines:

# deb bullseye main
# deb-src bullseye main

After ensuring that the distro’s official source repositories are added, you can safely get a list from the official mirror’s on the distro’s site.

Both of our lines have been commented out, as we can see. This means that apt cannot find packages because there are no source repositories available. So if apt doesn’t use the source repository to search for packages, we comment/remove out the above lines in the /etc/apt/sources.list file. To see how it would look without the comments, we uncomment both lines:

deb bullseye main
deb-src bullseye main


If you need software that is not supported by the official and default Ubuntu repository, installing PPA repositories is one of the solutions to install rare software. The Ubuntu Launchpad website is useful for searching for packages and their PPAs.
If you don't find the PPA of the package you want on the site, check the official Ubuntu website so that you can use alternative methods to install the software you want.

If you are using a new version of Ubuntu, you should check whether the commands provided in the new versions have the same functionality as the old versions. Because the new versions of Ubuntu have received many updates, the way of executing commands may have changed for different purposes.

sources. list file contains information about repositories in Ubuntu, so to solve the problem, we will restore the default repositories by entirely removing the sources. list files from the /etc/apt directory and generate new sources.

This error indicates that the required net-tools package, which includes the netstat executable, is not installed on the system. You may need to manually install the net-tools package if it is not already on your system.


Getting the “Unable to locate package” error is one of the most common errors when installing some packages in Ubuntu. In this article, we tried to improve your skills in managing packages so that you don’t get such an error again. To solve this problem, you must first identify the cause of the problem and then apply the correct solution. In this article, we have provided 6 solutions to fix the “Unable to locate package” error. You can update the resource list and repository cache, check the correct typing of the package names, ensure the official source repositories of the distribution are added, check the activation of the Ubuntu version, and try other solutions to prevent you from receiving the “Unable to locate package” error when installing software in Ubuntu.

We hope this article was able to fix the “Unable to locate package” error. If you know another solution to this problem, share it with us and other users in the comments section.

Leave a Reply

Your email address will not be published. Required fields are marked.