Categories: Ubuntu

Troubleshooting “E: Unable to locate package” Error on Ubuntu

One of the most widely used methods for installing the package on Ubuntu is apt or apt-get. Sometimes you might encounter an error while running the apt command in the terminal. The error reads “E: unable to locate package”. This error means your Linux system is unable to locate the package you want to install. Why is the system displaying this error and how to resolve it? Let’s discuss some of the fixes for this error.

Fixing “E: Unable to locate package” Error on Ubuntu

Below we have mentioned a few possible fixes for the error on Ubuntu:

1: Check the Package Name

Sometimes you can make a typo mistake while running the command in the terminal. The first thing you should see is the spelling of the package name, for example, if you are trying to install htop and you type thop. These kinds of mistakes are common so ensure you type the correct spelling of the package.

2: Update the Repository Cache

When we execute the install command the apt package manager searches the cache to get the package information and then downloads it from the repositories. If the package you want to install on your system is not available the command will not work. Updating the cache is a good idea for the repository to install the latest versions of the packages:

sudo apt update

3: Check if the Package Is Available for Your Distro Version

It might be possible that the package you want to install is not available for your Ubuntu’s current version. To check the availability of the package, first, run the following command to find the name and version of your system:

lsb_release -a

After the execution of the command, open the Ubuntu website to find the available packages. Scroll down and head towards the search for the contents of the package sections. In the keyword field add the name of the package, type the Distribution, and hit the Search button after setting these details:

The results will show you that either the package is available or not, and if it is available then which repository it belongs to. In my case, I have searched htop for jammy distribution, and here is what it showed me:

4: Check if the Ubuntu You Are Using Is Active

Ubuntu has two major releases; one was active for nine months and the other one was for five years. If you are using the Ubuntu release that is about to end, you won’t be able to install packages on the system. Use the below simple command to find out if your version is active or not:

hwe-support-status –verbose

My supported version showed the above result.

Bottom Line

Linux users mostly perform the installation and package management through the command line. One of the widely used package managers is apt, but sometimes while installing the package you might get an error E: unable to locate the package. In the above guide, we have provided you with the solutions for being unable to locate the package.

Ubuntu Server Admin

Recent Posts

Predict, compare, and reduce costs with our S3 cost calculator

Previously I have written about how useful public cloud storage can be when starting a…

18 hours ago

One Thread to Poll Them All: How a Single Pipe Made WaterDrop 50% Faster

This is Part 2 of the "Karafka to Async Journey" series. Part 1 covered WaterDrop's…

22 hours ago

A year of documentation-driven development

For many software teams, documentation is written after features are built and design decisions have…

2 days ago

Announcing FIPS 140-3 for Ubuntu Core22

With the release of the FIPS 140-3 certified cryptographic modules for Ubuntu 22.04 LTS, Canonical…

3 days ago

The foundations of software: open source libraries and their maintainers

Open source libraries are repositories of code that developers can use and, depending on the…

6 days ago

From inspiration to impact: design students from Regent’s University London explore open design for their dissertation projects

Last year, we had the opportunity to speak at Regent’s UX Conference (Regent’s University London’s…

7 days ago