← Back to all posts

Ubuntu "Unable to locate package": Why apt Can't Find It

Published October 1, 2026

⏱️ 2 min read

E: Unable to locate package <name> is apt reporting that no repository you currently have enabled contains that package. The package usually exists — your package lists just don't know about it yet (or ever, from your current sources).

The three fixes, in order

1. Refresh the lists. sudo apt update first, always. The apt cache goes stale between releases and Docker images ship with it intentionally empty-ish. If you just changed any sources.list entry, this step is mandatory, not optional.

2. Enable the right repositories. Ubuntu splits packages across main, universe, restricted and multiverse. universe holds a huge fraction of the packages people install, and minimal images (Docker ubuntu:latest, some VPS templates) enable only main. Enable it: sudo add-apt-repository universe && sudo apt update. Check what's enabled with grep -E 'universe|multiverse' /etc/apt/sources.list.

3. Check the spelling and the release. Package names are exact: it's python3-pip not pip3, nodejs not node (which is the unofficial NodeSource name). Also, every Ubuntu release has a different package set — the package exists on your laptop's 24.04 but not the server's 20.04. lsb_release -a before assuming parity.

The special cases

Docker images: arm64 images occasionally lag behind amd64 on multi-arch mirrors. PPAs and third-party repos: the package lives in a repo you never added — check the vendor's docs for the add-repo step. Old releases: EOL Ubuntu versions move to old-releases.ubuntu.com; the fix is upgrading, not fighting apt.

Fast sanity command

apt-cache policy <package> after apt update shows every repo candidate — if it prints "N: Unable to locate", no enabled repo has it, and the problem is sources, not spelling. Spin up a fresh VM to test sources safely — Vultr or DigitalOcean both have hourly billing.

Partner pick — sponsored

Sentry — our error-tracking pick for this stack

See the exact line of code that broke — before your users report it. Free tier for small teams.

Get Sentry →
Also vetted

Vultr — Spin a disposable box to replay this failure without touching prod.

Get Vultr →

We earn a commission if you buy through our links — it never costs you extra. More vetted tools on our picks hub · comparing clouds? DigitalOcean vs Vultr and vs AWS · full deals: DigitalOcean · Vultr · NordLayer · Semrush

#AmazonAssociate — As an Amazon Associate I earn from qualifying purchases. Full disclosure →