Applies to: apt on Ubuntu 24.04 LTS (apt 2.8.3), Ubuntu 26.04 LTS (apt 3.2.0) and Debian 13 (apt 3.0.3)
E: Unable to locate package NAME means apt looked through the package lists stored on your server and found no package with exactly that name. In most cases one of four things is wrong: the package lists were never downloaded (run sudo apt update), the name is misspelt or is not the real package name, the package is in a repository section you have not enabled (such as universe on Ubuntu or non-free on Debian), or the package does not exist for your release. Work through the checks below in that order.
sudo apt update apt-cache policy PACKAGE sudo apt install PACKAGE
On Ubuntu 26.04 and Debian 13, the apt command prints the same error as Error: Unable to locate package NAME; apt-get still prints E:. The causes and fixes are the same.
1. Download the package lists with apt update
apt only knows the packages listed in /var/lib/apt/lists/. New container images, some minimal cloud images and freshly installed servers start with that folder empty or out of date. Lab example from a new Ubuntu 24.04 container:
$ sudo apt install nginx Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package nginx $ sudo apt update ... Fetched 33.5 MB in 32s (1059 kB/s) Reading package lists... $ sudo apt install nginx # now found: nginx 1.24.0-2ubuntu7.18
Read the output of apt update. If it shows Err:, W: Failed to fetch or does not have a Release file, the lists did not download and every install will keep failing until that is fixed. In our tests apt update still returned exit code 0 in that case, so a script will not stop on its own. Fixes for download errors are in our article on apt "Failed to fetch" errors, and key and repository errors are covered in how to add, enable and remove repositories on Ubuntu.
2. Check the exact package name
- Names are case-sensitive.
apt install Nginxfails with "Unable to locate package Nginx"; the package isnginx. - A command is not always a package. There is no
ifconfigpackage, for example. Search the package lists by name or description:apt search --names-only '^php8' apt-cache search --names-only '^php[0-9.]+-fpm$'
- Find the package that contains a command with
apt-file. Its index is large:apt-file updatedownloaded 207 MB in our Ubuntu 24.04 lab.$ sudo apt install apt-file $ sudo apt-file update $ apt-file search bin/ifconfig net-tools: /sbin/ifconfig $ apt-file search --regexp 'bin/dig$' bind9-dnsutils: /usr/bin/dig
Sosudo apt install net-toolsgives youifconfig, andbind9-dnsutilsgives youdig. - "Couldn't find any package by glob" or "by regex" lines appear under the error when the name contains a dot or a wildcard, for example
php8.3. apt also tried the name as a pattern and found nothing. The fix is the same: find the right name.
3. Enable the repository section that has the package
Ubuntu splits its archive into main, restricted, universe and multiverse. Many common tools are in universe. apt-cache policy shows where a package comes from:
$ apt-cache policy cowsay
cowsay:
Installed: (none)
Candidate: 3.03+dfsg2-8
Version table:
3.03+dfsg2-8 500
500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages
When we removed universe from /etc/apt/sources.list.d/ubuntu.sources in the lab and ran apt update, apt install cowsay failed with "Unable to locate package cowsay". Putting universe back on the Components: lines and running apt update fixed it. Check your lines with:
grep -E '^(Suites|Components)' /etc/apt/sources.list.d/ubuntu.sources
How to enable universe on both Ubuntu releases is in how to add, enable and remove repositories on Ubuntu. Older Ubuntu releases keep the same information in /etc/apt/sources.list.
Debian: the Debian 13 container image we tested lists only Components: main. A package from non-free such as unrar then fails with "Package 'unrar' has no installation candidate". After we changed both Components: lines in /etc/apt/sources.list.d/debian.sources to main contrib non-free non-free-firmware and ran apt update, it installed from trixie/non-free. Our Debian sources.list article has the full standard repository lines for Debian 13 and 12.
4. "Unable to locate" or "has no installation candidate"?
The second message means apt knows the name, because another package mentions it, but no enabled repository offers it. Lab examples from Ubuntu 24.04:
$ sudo apt install docker-ce Package docker-ce is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'docker-ce' has no installation candidate
docker-cecomes from Docker’s own repository, not Ubuntu’s. Add it first: install Docker on Debian and Ubuntu from the official repository. The same applies to other vendor packages.pythonon Ubuntu 24.04 prints "However the following packages replace it: 2to3 python-is-python3". Installpython3, orpython-is-python3if a script needs thepythoncommand.python2on Ubuntu 24.04 has no installation candidate at all: Python 2 is not available in that release.
5. The package does not exist for your release
Each release ships its own set of packages and versions. First check which release you run:
$ grep VERSION_CODENAME /etc/os-release VERSION_CODENAME=resolute
(noble is Ubuntu 24.04, resolute is Ubuntu 26.04, trixie is Debian 13.) Examples from our tests:
- PHP: the PHP-FPM package is
php8.3-fpmon Ubuntu 24.04,php8.5-fpmon Ubuntu 26.04 andphp8.4-fpmon Debian 13.apt install php8.3on Ubuntu 26.04 fails with "Unable to locate package php8.3". Use the version your release ships, or a third-party repository for another version: how to add an APT repository. - neofetch is not in Debian 13 or Ubuntu 26.04;
fastfetchis (2.40.4 on Debian 13, 2.57.1 on Ubuntu 26.04).
To see which releases have a package before you try, search packages.ubuntu.com or packages.debian.org. If you need an exact older or newer version from the archive, see how to install a specific package version with apt.
Unable to locate package software-properties-common
software-properties-common provides the add-apt-repository command.
- Ubuntu: it is in
main(0.99.49.4 on Ubuntu 24.04, 0.120.1 on Ubuntu 26.04 in our tests). If apt cannot find it, the package lists are missing: runsudo apt updateand install it again. - Debian 13: the package is not in the Debian 13 archive, so even after
apt updateyou getUnable to locate package software-properties-common. Add repositories by hand with a.sourcesfile, or useextrepo, as shown in add-apt-repository: command not found.
Quick checklist
- Run
sudo apt updateand make sure it shows noErr:orW:lines. - Check spelling and case, then search with
apt searchorapt-file search. - Run
apt-cache policy PACKAGE: no output means no enabled repository lists it. - Enable
universe(Ubuntu) orcontrib non-free(Debian) if the package lives there. - Check that the package exists for your release; if not, use the release’s version or the vendor’s repository.
On a Ucartz VPS or dedicated server you can also open a support ticket: small tasks like installing a package are covered by our Free Basic Managed Support (best effort).
Related articles: how to add an APT repository, repositories on Ubuntu (ubuntu.sources and PPAs), apt-get: command not found and list installed packages on Ubuntu and Debian.