E: Unable to locate package

Fixing 'Unable to locate package' in apt on Ubuntu/Debian

Linux & Unix Beginner 👁 14 views 📅 Jun 25, 2026

Your apt can't find the package. Usually it's a missing repo or outdated cache. Here's how to fix it fast.

30-second fix: update your package list

The most common reason apt can't find a package is simple: your local package index is out of date. Ubuntu and Debian don't ship with every package pre-indexed. You need to sync with the repositories first.

sudo apt update

That's it. Run this then try your install again:

sudo apt install <package-name>

Why this works: apt update downloads the latest package lists from all enabled repositories. If you just set up this system or haven't run it in a while, the index is empty or stale. No index = no packages found.

Still getting the error? Move to the next fix.

5-minute fix: check the package name and repository

If an update didn't help, the package either doesn't exist under that name, or its repository isn't enabled.

1. Verify the exact package name

You might have a typo. Use apt-cache search to find it:

apt-cache search <partial-name>

For example, if you want neovim but typed nvim, apt won't find it. Searching shows you the real names.

2. Enable the correct repository

Some packages live in universe or multiverse repos, not the default main. For example, ubuntu-restricted-extras needs multiverse. Enable it with:

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

On Debian, you might need contrib or non-free. Edit /etc/apt/sources.list and add those to your repo lines.

3. Check if you're on the right OS version

Packages are version-specific. A package that exists on Ubuntu 22.04 might not be available on Ubuntu 20.04. Run lsb_release -a to confirm your release, then search the package on the official site.

Still not found? Then it's time for the advanced fix.

15+ minute fix: add a PPA or third-party repo

Some packages aren't in the official repos at all. You need to add a Personal Package Archive (PPA) or an external repository.

1. Find the right PPA

Search for the package name plus "PPA" on Google or Launchpad. For example, to get the latest git version:

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

What's happening here: add-apt-repository adds a new source file under /etc/apt/sources.list.d/ and imports the GPG key. Without that key, apt refuses to trust the repo.

2. Manual repo setup (when PPA doesn't exist)

Sometimes you need to add a repo manually. For example, to install docker-ce:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update

Notice the signed-by part. This is how modern apt verifies the repo is legitimate. Skip the GPG step and apt will throw a warning or error.

3. Check for typos in the repo URL

I've seen people copy a repo line from a forum post and miss a slash. Verify the URL is reachable: curl -I <url>. If you get a 404, the URL is wrong.

When none of this works

Rarely, the package might be deprecated or removed. Check the package's official site — they may now distribute via Snap, Flatpak, or direct download. For example, atom editor was removed from repos. You'd download the .deb directly from GitHub.

Also, if you're on an old LTS version that's reached end-of-life (like Ubuntu 18.04 after April 2023), the repos move to old-releases.ubuntu.com. Update your sources.list or upgrade your system.

Pro tip: Always run sudo apt update after any repo change. I can't count how many times people forget that step and wonder why nothing changed.

Was this solution helpful?