If you’ve used Ubuntu for any length of time, chances are you’ve run into this frustrating message at least once:
E: Unable to locate package <package-name>
It usually appears right when you’re trying to install something important—Docker, Nginx, Python modules, development libraries, or even basic utilities. For beginners, this error can feel confusing and discouraging. For experienced users, it’s still annoying because it often interrupts workflows.
The good news?
This error is not a bug. It’s Ubuntu telling you that something in your system’s package management setup isn’t aligned properly. And once you understand why it happens, fixing it becomes straightforward.
In this comprehensive guide, we’ll break down what the “E: Unable to locate package” error really means, explore all common causes, and walk through step-by-step solutions that work across Ubuntu versions.
What Does E: Unable to Locate Package Error on Ubuntu?
Ubuntu uses a package management system called APT (Advanced Package Tool). When you run a command like:
sudo apt install nginx
APT does the following behind the scenes:
- Checks your configured software repositories
- Searches for the requested package
- Verifies package availability for your Ubuntu version
- Downloads and installs it
The error “E: Unable to locate package” simply means:
This does not necessarily mean the package doesn’t exist. It usually means Ubuntu doesn’t know where to look.
Primary Causes of the Error
Before jumping into fixes, it’s important to understand why this error occurs. In most cases, it’s caused by one (or more) of the following reasons:
- Package lists are outdated
- Incorrect package name
- Required repository is missing or disabled
- Universe or Multiverse repositories not enabled
- Trying to install software not available for your Ubuntu version
- Using an End-of-Life (EOL) Ubuntu release
- Missing third-party repository (PPA)
- Network or DNS issues
Fix E: Unable to Locate Package Error on Ubuntu
1. Update Your Package Lists (Most Common Fix)
This is the most common reason—especially on fresh installs, cloud VMs, or systems that haven’t been updated in a while.
Ubuntu does not automatically refresh its package list every time you boot.
What Happens Internally
APT stores a cached list of available packages under:
/var/lib/apt/lists/
If this list is outdated or empty, Ubuntu literally doesn’t know what packages exist.
Fix
sudo apt update
You should see output like:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Reading package lists... Done
Once done, try installing the package again:
sudo apt install package-name
Why This Works
apt update syncs your system with the latest package information from configured repositories. Without this step, Ubuntu is essentially searching an old database.
Pro Tip (Especially for Servers)
On fresh VPS installations (AWS, DigitalOcean, Azure):
sudo apt update && sudo apt upgrade -y
This ensures:
- Package lists are current
- Base system is stable
- Dependency conflicts are reduced
2. Incorrect or Deprecated Package Names
Linux packages are not always named intuitively, and names change over time.
Common Mistakes
| What Users Type | Correct Package |
|---|---|
| python | python3 |
| pip | python3-pip |
| mysql | mysql-server |
| apache | apache2 |
| php | php-cli / php8.1 |
Why This Happens
- Ubuntu removes legacy packages
- Tutorials written for older releases
- Software branding ≠ package name
How to Find the Correct Package
Use search:
apt search <keyword>
Or:
apt-cache search <keyword>
Example:
apt search docker
This shows all related packages and descriptions.
3. Universe Repository Not Enabled (Very Common)
Many popular packages are stored in Ubuntu’s Universe repository, which is sometimes disabled by default—especially on minimal installations.
Ubuntu repositories are split into sections:
- main – officially supported
- universe – community-maintained (huge!)
- multiverse – restricted licensing
- restricted – proprietary drivers
Many popular tools live in Universe.
Check if Universe Is Enabled
Run:
grep universe /etc/apt/sources.list
If nothing shows up, it’s disabled.
Enable Universe Repository
sudo add-apt-repository universe
sudo apt update
Then try installing the package again.
Packages That Require Universe
Packages like:
nodejsnpmffmpegbuild-essentialsoftware-properties-common
often live in the Universe repository.
4. Enable Multiverse and Restricted Repositories
Some packages are licensed differently and live in Multiverse or Restricted repositories.
Enable All Standard Repositories
sudo add-apt-repository multiverse
sudo add-apt-repository restricted
sudo apt update
This ensures Ubuntu can access all officially supported repositories.
This is especially useful for:
- Media servers
- Desktop multimedia tools
- GPU drivers
5. Check Your Ubuntu Version Compatibility
Ubuntu releases are version-specific. A package available in Ubuntu 20.04 may not exist in 22.04, or vice versa.
Check Your Ubuntu Version
lsb_release -a
Output example:
Distributor ID: Ubuntu
Release: 22.04
Codename: jammy
Real-World Example
A tutorial written for Ubuntu 18.04 might reference:
sudo apt install php7.2
But on Ubuntu 22.04, the correct package is:
sudo apt install php8.1
Rule of Thumb
Always combine:
- Tutorial date
- Ubuntu version
- Official documentation
Some packages may not yet support newer releases, while others may drop support for older ones.
6. Installing Software That Requires a PPA
Many popular applications are not included in Ubuntu’s default repositories.
Examples include:
- Docker
- Google Chrome
- VS Code
- Node.js (latest versions)
- Yarn
- MongoDB
- PostgreSQL (newer versions)
Trying to install these directly causes the “Unable to locate package” error.
Example: Installing Node.js
Incorrect ❌
sudo apt install nodejs
(Older version or not found)
✅ Correct approach:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs
General Rule
If software has an official installation guide, follow it. Don’t assume everything is available via default apt install.
7. Using an End-of-Life (EOL) Ubuntu Release
Ubuntu releases have a support lifecycle. Once a release reaches End of Life, repositories are removed from main mirrors.
Symptoms
apt updatefails- “Unable to locate package” appears for almost everything
Check EOL Status
If you’re using something like:
- Ubuntu 16.04 (now EOL)
- Ubuntu 18.10
- Ubuntu 19.04
You’ll face repository issues.
Solutions
Option 1: Upgrade Ubuntu (Recommended)
sudo do-release-upgrade
Option 2: Switch to Old Releases (Temporary Fix)
Edit:
sudo nano /etc/apt/sources.list
Replace:
archive.ubuntu.com
With:
old-releases.ubuntu.com
Then run:
sudo apt update
8. Check Internet Connectivity and DNS
Sometimes the error is misleading. If Ubuntu cannot reach repository servers, it won’t locate packages.
Test Internet Connection
ping -c 3 google.com
If this fails, fix your network first.
Fix DNS Issues
Edit resolv.conf:
sudo nano /etc/resolv.conf
Add:
nameserver 8.8.8.8
nameserver 8.8.4.4
Restart networking:
sudo systemctl restart NetworkManager
9. Clean and Rebuild APT Cache
Corrupted APT cache can also trigger package lookup errors.
Run These Commands
sudo apt clean
sudo apt autoclean
sudo apt update
Then retry installation.
10. Fix Broken Packages and Dependencies
Sometimes APT fails because of unresolved dependencies.
Fix Command
sudo apt --fix-broken install
Followed by:
sudo apt update
sudo apt install package-name
11. Check Architecture Compatibility
Some packages are available only for specific architectures.
Check System Architecture
dpkg --print-architecture
Common outputs:
amd64arm64i386
If you’re using ARM (Raspberry Pi, some cloud servers), some packages won’t be available.
Best Practices to Avoid This Error in the Future
To prevent seeing “E: Unable to locate package” again and again:
- Always run
sudo apt updatebefore installing software - Use official documentation for third-party software
- Keep Ubuntu updated to a supported version
- Avoid mixing repositories from different Ubuntu releases
- Don’t blindly copy commands from outdated tutorials
- Regularly clean and maintain APT cache
Final Thoughts
The “E: Unable to locate package” error in Ubuntu may look intimidating at first, but it’s actually Ubuntu’s way of telling you that something small needs adjustment—whether it’s repositories, package lists, or compatibility.
Once you understand how Ubuntu’s package management works, this error becomes easy to diagnose and fix. Instead of randomly reinstalling your OS or giving up on Linux, you’ll know exactly where to look and what to do.
If you work with Ubuntu regularly—on servers, cloud instances, or development machines—mastering this error is an essential skill that will save you hours of frustration.
You can explore it directly through the official Ubuntu package index, which remains the most reliable source for verifying package availability across Ubuntu releases.
Frequently Asked Questions (FAQs)
What does “E: Unable to locate package” mean in Ubuntu?
This error means that Ubuntu’s package manager (APT) cannot find the requested package in any of the enabled software repositories. It does not necessarily mean the package doesn’t exist—only that your system doesn’t know where to look for it.
Why do I get “Unable to locate package” even after running apt update?
If the error persists after updating, it usually points to one of these issues:
- The package name is incorrect or outdated
- The required repository (such as Universe or a third-party PPA) is not enabled
- The package is not available for your Ubuntu version
- You are using an End-of-Life Ubuntu release
Running apt update alone cannot fix missing repositories or unsupported packages.
How do I know if the package name is correct?
You can search for the correct package name using:
apt search <keyword>
This command lists all related packages along with descriptions, helping you identify the exact name Ubuntu expects.
Why does Ubuntu say it can’t find a package that exists online?
Many tutorials refer to software by its application name, not its package name. Additionally, some software is not included in Ubuntu’s default repositories and requires a third-party repository or official installation script.
What are Ubuntu repositories, and why do they matter?
Repositories are servers that store software packages. Ubuntu only installs software from enabled repositories. If a repository like Universe or Multiverse is disabled, Ubuntu cannot find packages stored there—even if they are official.
How do I enable the Universe repository?
You can enable it using:
sudo add-apt-repository universe
sudo apt update
Many commonly used tools depend on the Universe repository.
Can a wrong Ubuntu version cause this error?
Yes. Packages are built specifically for each Ubuntu release. A package available on Ubuntu 20.04 may not exist on 22.04 or older versions. Always ensure that the tutorial or documentation matches your Ubuntu version.
Why does this error occur on a fresh Ubuntu server?
On fresh installations, especially cloud servers, the package list is often empty or outdated. Running:
sudo apt update
is mandatory before installing anything.
Does this error mean my system is broken?
No. This is not a system failure or corruption. It’s a configuration or availability issue related to package sources, not your operating system itself.
How do I fix this error for Docker, Node.js, or Chrome?
These tools are not fully available in Ubuntu’s default repositories. You must install them using their official repositories or installation scripts. Trying to install them directly with apt install often results in this error.

Fix WordPress asking for FTP Credentials – 7 Simple Steps