How to Fix Error “E: Unable to Locate Package” in Ubuntu?

One of the most common issues Ubuntu users encounter while installing software is the dreaded: E: Unable to locate package. This error typically pops up when the system cannot find the software package you’re trying to install using apt. But don’t worry—this issue is usually simple to fix once you understand the cause.

In this guide, we’ll walk you through the most effective ways to resolve the “Unable to Locate Package” error in Ubuntu.

How to Fix Unable to Locate Package in Ubuntu

E Unable to Locate Package in Ubuntu

This error often happens due to a typo, outdated package lists, or missing software sources. Luckily, it’s usually easy to fix. Here are two quick and simple solutions you can try first:

Solution 1: Check the Package Name

Make sure you’re typing the correct name of the package. Ubuntu is case-sensitive, so even small mistakes can cause this error.

sudo apt install vlc

Wrong Example Output (if the name is wrong):

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package vlc-player

Right Example Output (if the name is correct):

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed: ...
After this operation, xx MB of additional disk space will be used.
Do you want to continue? [Y/n]

Fix 2: Update Your Package List

If your system’s package information is outdated, it may not recognize the package, even if it’s valid. Run the following to refresh the list:

sudo apt update

Output:

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Fetched 228 kB in 2s (114 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

After updating, try installing the package again.

Solution 3: Enable Universe and Multiverse Repositories

Some packages are stored in optional Ubuntu repositories like universe or multiverse, which might be disabled on your system.

sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo apt update

Output:

'Universe' component enabled for 'focal'
...
Reading package lists... Done

Now, retry installing your package.

Solution 4: Check Ubuntu Version Compatibility

Not every package is available for all Ubuntu versions. Your system might be too new or too old.

lsb_release -sc

Output:

jammy

Visit https://packages.ubuntu.com, select your version (e.g., jammy), and search for the package. If it doesn’t appear, it may not be available for your version.

Solution 5: Make Sure Ubuntu Is Still Supported

If you’re using an old version of Ubuntu that’s no longer supported, its repositories may have been archived or removed.

hwe-support-status --verbose

Output:

Your Hardware Enablement Stack (HWE) is supported until April 2023.

If your version is outdated, consider upgrading to a supported version using:

sudo do-release-upgrade

Solution 6: Add a PPA or External Repository

If the package isn’t in the default repositories, it might be available from a PPA (Personal Package Archive) or external source.

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-driver-525

Output:

PPA added successfully.
...
Reading package lists... Done

Now you can install packages from that PPA.

Solution 7: Clean Cache or Fix Broken Installs

Sometimes, system issues like broken dependencies or corrupted caches block package installation.

sudo apt --fix-broken install
sudo apt clean
sudo apt update

Output:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done

These commands will clean things up and prepare your system for fresh installs.

Solution 8: Use Snap, Flatpak, or .deb Files

If the package still can’t be found using apt, try using an alternate installation method:

  • Using Snap:
sudo snap install vlc
  • Using Flatpak
flatpak install flathub org.videolan.VLC
  • Using .deb

Download from the official site and install with:

sudo dpkg -i package.deb

These are great alternatives when apt doesn’t work.

Final Words

The “Unable to Locate Package in Ubuntu” error is usually nothing to worry about. With a bit of checking, the package name, repository status, and Ubuntu version, you can typically fix it in minutes.

If you’ve gone through all these steps and the error persists, you may be trying to install something that’s not designed for your system. In such cases, community forums like AskUbuntu or StackOverflow can be very helpful.


Photo of author
Authored by Roshan Ray