Skip to content

/errors/apt/unable-to-locate-package

apt: E: Unable to locate package

The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
tool
apt
exit code
100
versions
Debian 10+, Ubuntu 18.04+
os
linux

apt install foo prints E: Unable to locate package foo when foo is not in the package lists apt has downloaded. apt does not search the internet at install time; it only knows what the last apt update fetched from the repositories in /etc/apt/sources.list and /etc/apt/sources.list.d/.

Fix: update the package lists

bash
sudo apt update
sudo apt install foo

In a Dockerfile the base image ships without lists, so always combine both steps:

dockerfile
RUN apt-get update \
 && apt-get install -y --no-install-recommends curl \
 && rm -rf /var/lib/apt/lists/*

Fix: find the right name

bash
apt search --names-only 'python3-.*requests'
apt-cache policy python3-requests     # shows candidate version and repository, or nothing

Names often differ between distributions and releases: Python libraries are python3-*, development headers are lib*-dev.

Fix: enable the component or repository

bash
sudo add-apt-repository universe      # Ubuntu
sudo apt update

On Debian, add contrib non-free non-free-firmware to the Components: line of the source (see deb822 sources).

Sources