E: Unable to locate package (apt / apt-get install)
apt can’t find the package name in its package lists — the lists are stale, the repository isn’t enabled, or the name is wrong for this distro version.
Meaning
apt only knows packages from the indexes downloaded by apt update. Fresh servers and Docker images ship with empty lists, so install fails until you update. Package names also differ between Ubuntu/Debian releases, and some live in universe/contrib or a third-party repo.
Common causes
- apt update never run (fresh server / Dockerfile without update)
- Package in a repository component not enabled (universe, multiverse, contrib)
- Name differs on this release (python vs python3)
- Third-party repo not added
- Architecture-specific package
⚡ Quick fix
- Run sudo apt update first
- Search the real name: apt search <term> / apt-cache policy
- Enable universe: sudo add-apt-repository universe
Detailed fix by platform
Ubuntu
- bash
sudo apt update apt search nginx | head sudo add-apt-repository universe && sudo apt update
Dockerfile
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
How to diagnose
- Lists — When was apt update last run?
- Name — packages.ubuntu.com / packages.debian.org for your release
- Release — lsb_release -a
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- did not complete successfully failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: 1
- dpkg lock E: Could not get lock /var/lib/dpkg/lock-frontend — is another process using it?
- dpkg was interrupted E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem
Most viewed in Linux
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Report a correction or suggest an improvement
Last updated 7 Oct 2026