Fix "E: Unable to locate package" on Ubuntu, Debian and Mint
Most of the time apt's package lists are out of date or the name is slightly wrong. Refresh the lists, then search for the exact name before installing.
sudo apt update
apt search <keyword>
sudo apt install <exact-package-name>
If the package still is not found on Ubuntu, enable the universe component with sudo add-apt-repository universe and run sudo apt update again.
What the error means
You ran apt install (or apt-get install) and saw:
$ sudo apt install htopp
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package htopp
apt installs packages only from the indexes it downloaded during the last apt update. The error means the name you typed does not appear in any of those indexes. It does not mean the software does not exist: it means apt cannot see it from your current repository configuration. A closely related message is:
E: Package 'foo' has no installation candidate
That one means apt knows the name (another package mentions it) but nothing in your enabled repositories offers a version you can install. The causes and fixes below cover both.
Cause 1: package lists are empty or stale
On a fresh install, a new container image (Docker ubuntu and debian images ship with no package lists at all) or a system that has not been updated in a while, apt's indexes are missing or outdated.
sudo apt update
Read the output of apt update carefully. If it ends with errors or warnings such as NO_PUBKEY or does not have a Release file, the indexes for those repositories were not refreshed. Fix those first: see fixing NO_PUBKEY signature errors and "does not have a Release file".
Cause 2: the package name is wrong
Package names are case-sensitive and often differ from the program name. Common examples:
| You typed | Package on Ubuntu/Debian |
|---|---|
python, pip | python3, python3-pip |
Chrome, google-chrome | Not in the repositories; use Chromium (snap on Ubuntu) or Google's own .deb |
node | nodejs |
vscode, code | Not in the repositories; Microsoft's APT repo or snap |
ifconfig | net-tools |
dig | bind9-dnsutils (or the transitional dnsutils) |
Search instead of guessing:
apt search htop
apt-cache policy htop # shows if a candidate version exists and from where
To find which package provides a file or command, use apt-file:
sudo apt install apt-file
sudo apt-file update
apt-file search bin/dig
Cause 3: the right component is not enabled
Ubuntu splits its archive into main, restricted, universe and multiverse. Thousands of common packages (for example vlc, gimp, ffmpeg and many libraries) live in universe. Debian splits into main, contrib, non-free and non-free-firmware; drivers and firmware such as nvidia-driver or firmware-iwlwifi are in non-free/non-free-firmware.
Ubuntu 24.04 and 26.04
Current Ubuntu releases keep sources in deb822 format in /etc/apt/sources.list.d/ubuntu.sources. The quickest route:
sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo apt update
Or edit the file by hand and make sure every Components: line lists all four:
Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: resolute resolute-updates resolute-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Debian 13
Debian 13 "trixie" uses /etc/apt/sources.list.d/debian.sources on new installs (upgraded systems may still use /etc/apt/sources.list). Add the components you need:
Types: deb
URIs: http://deb.debian.org/debian/
Suites: trixie trixie-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
In classic one-line format the equivalent is deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware. Run sudo apt update after saving.
Cause 4: you are installing a local .deb file without a path
If the argument is a file name, apt needs to know it is a path:
# Wrong: treated as a package name
sudo apt install google-chrome-stable_current_amd64.deb
# Right
sudo apt install ./google-chrome-stable_current_amd64.deb
Using apt install ./file.deb instead of dpkg -i also pulls in the file's dependencies automatically.
Cause 5: the package is not available for your release or architecture
Packages are added and removed between releases. Something documented for Ubuntu 22.04 may have been renamed or dropped in 26.04, and some packages exist only for amd64, not arm64 (Raspberry Pi, ARM laptops). Check:
lsb_release -cs # your codename, e.g. resolute, noble, trixie
dpkg --print-architecture # amd64, arm64, ...
Then look the package up on packages.ubuntu.com or packages.debian.org, which show which releases and architectures carry it. If it is gone, the page usually names a replacement. Some software is distributed only by its developer as a separate APT repository, PPA, snap or Flatpak; add that source following its instructions (with a signed-by keyring, since apt-key no longer exists on Ubuntu 26.04).
Distro-specific notes
- Linux Mint 22.3 is based on Ubuntu 24.04 and enables all components by default. Mint blocks Snap, so packages that Ubuntu ships only as snap transitional debs (Chromium, for example) are not installable with apt; use Flatpak from the Software Manager instead.
- Ubuntu minimal and cloud images may ship only
mainandrestricted. Enableuniverseas above. - Containers: run
apt-get updatein the sameRUNstep asapt-get install; images remove the lists to save space. - Fedora, Arch, openSUSE do not use apt. The equivalents are
dnf search,pacman -Ssandzypper search. The package manager comparison maps the commands.
How to prevent it
- Run
sudo apt updatebefore installing anything new, and fix any errors it prints rather than ignoring them. - Copy package names from
apt searchoutput rather than from old tutorials. - Keep the standard components enabled; they cost nothing if you do not install from them.
- Learn the everyday apt commands in the apt package manager guide.
Still not working?
Check which repositories apt is actually reading and whether any of them is failing:
apt-cache policy | grep -E 'http|file:'
ls /etc/apt/sources.list.d/
sudo apt update 2>&1 | grep -E '^(E|W):'
If apt-cache policy lists no archive at all, your sources files are empty or malformed; restore the default ubuntu.sources or debian.sources shown above. If the package exists but apt refuses to install it because of dependencies, that is a different problem: see "you have held broken packages".
Frequently asked questions
Why does apt say unable to locate package right after installing Ubuntu?
The package lists are empty or stale on a fresh install, and on minimal installs the universe component may not be enabled. Run sudo apt update, then sudo add-apt-repository universe if the package is still missing.
What is the difference between "Unable to locate package" and "has no installation candidate"?
"Unable to locate package" means apt has never heard of the name in any configured repository. "Has no installation candidate" means the name is known (often because another package refers to it) but no repository currently offers an installable version.
How do I find the correct package name?
Use apt search keyword or apt-cache search keyword. To find which package ships a specific file or command, install apt-file, run sudo apt-file update, then apt-file search bin/command.
Can I install a .deb file with apt install?
Yes, but you must give a path, for example sudo apt install ./package.deb. Without ./ apt treats the argument as a package name and reports Unable to locate package.
Spotted a mistake or a command that no longer works? Send a correction — pages are re-checked when reports come in.