You ran sudo apt install and apt answered with one flat line: E: Unable to locate package. The unable to locate package Ubuntu error rarely means the software is gone, though.
Quick Fix: Run
sudo apt update, then retry the install. As of October 2026 that clears most cases, because apt only searches a local package index, and a new server's index is empty or stale. Still failing? Check the name withapt-cache policy NAME, then the universe component and your release's support.
Last verified: October 2026. Ubuntu 26.04 LTS (apt 3.2), 24.04 LTS and 22.04 LTS.
We wrote this guide from the support desk, so the fixes below follow the order we check on real servers. The Hostaccent Team resolves 20-30 client issues every day (UK-registered, serving customers worldwide, hosting since 2016, UK-incorporated 2018).
Unable to Locate Package Ubuntu: What the Error Means
The E: Unable to locate package apt error means apt checked its local lists and found nothing with exactly that name. It never asked the internet. (On 26.04 LTS, apt words it as Error: instead of E:.)
When you run an install command, apt reads a package index stored in /var/lib/apt/lists, and that index only changes when you run apt update. If the index is empty, stale or built from the wrong repositories, apt reports the package as missing even though Ubuntu's archive holds it. That's why an update taking about 30 seconds fixes most cases.
Why does apt say it can't find a package that definitely exists?
Four causes, ranked by how often we see them:
| # | Cause | Tell-tale sign |
|---|---|---|
| 1 | Stale or empty package index | New server or container |
| 2 | Wrong package name for your release | Old tutorial, a typo, a stray comma |
| 3 | Component or vendor repo missing | Package is in universe or a vendor repo |
| 4 | Release is end of life | apt update returns 404 |
From the Ticket Queue: According to Hostaccent's support-queue data, Linux server issues make up about 25% of monthly tickets. In the package cases our team handles, the first three causes explain nearly all.
The 3-Command apt Triage: Fix the Usual Causes
Three commands settle most cases in about 2 minutes: sudo apt update, apt-cache policy NAME and lsb_release -cs.
Fix 1: Refresh the index and read what apt update says
bashsudo apt update sudo apt install PACKAGE
Read the last lines before you retry. Temporary failure resolving is a DNS problem, No space left on device means df -h shows 100%, and a 404 points to Fix 4. A source that fails keeps its old list, so the install fails again.
Pro Tip: In a Dockerfile, keep
apt-get updateandapt-get installin oneRUNline. Base images ship with no package lists.
Fix 2: Wrong package name (apt wants the exact one)
bashapt-cache policy php8.3-fpm apt list 'php8*-fpm'
Package names on Ubuntu are exact, lower-case and often versioned. As of October 2026 the default PHP-FPM package is php8.1-fpm on Ubuntu 22.04 LTS, php8.3-fpm on 24.04 LTS and php8.5-fpm on 26.04 LTS, so a tutorial written for one release fails on the next. If apt-cache policy NAME shows no Candidate line, apt doesn't know that name.
Across the 4,000+ sites we've migrated, the classic mistake is pasting an install line written for another release. Watch for commas too: apt install openssl, rsyslog makes apt look for a package called openssl,.
Fix 3: Enable the universe repository on Ubuntu
bashsudo add-apt-repository universe sudo apt update grep -E '^(Suites|Components)' /etc/apt/sources.list.d/ubuntu.sources
Check the package's component on the Ubuntu Packages search: certbot, the usual SSL tool, sits in universe on 24.04.
On 24.04 and 26.04 the repository list lives in /etc/apt/sources.list.d/ubuntu.sources, in the deb822 layout from the sources.list manual page. The old /etc/apt/sources.list holds only comments, so guides telling you to edit it change nothing.
Insider Insight: Before adding a vendor repo or PPA, check it publishes for your codename (
lsb_release -cs) and CPU (dpkg --print-architecture). Many skiparm64or lag a new LTS, and then everyapt updateends in an error.
Still working through this server issue?
Send the symptoms, error output, and what you have already tried. We can work with Hostaccent services or infrastructure hosted with another provider.
Fix 4: When Your Ubuntu Release Has Reached End of Life
If the triage didn't help, the index can't be built at all, usually because your release has left the main archive.
As of October 2026, Ubuntu 26.04 LTS has standard support until May 2031, 24.04 LTS until May 2029 and 22.04 LTS until May 2027, while interim releases such as 25.10 get only 9 months. Once one expires, its packages move from archive.ubuntu.com to old-releases.ubuntu.com, apt update returns 404, and every install fails. Check lsb_release -ds against the Ubuntu release cycle.
One myth to drop: an expired LTS still installs packages. Ubuntu 20.04 lost free security updates in May 2025, yet its archive stayed put.
For an expired interim release, confirm your backups, then repoint apt and upgrade:
bashsudo cp -a /etc/apt /root/apt-backup for f in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do [ -f "$f" ] && sudo sed -i -E 's#//[a-z0-9.-]*(archive|security)\.ubuntu\.com#//old-releases.ubuntu.com#g' "$f" done sudo apt update sudo do-release-upgrade
Change only the hostname, never the codename, as Ubuntu's EOL upgrade guide says.
Live server and no time to experiment? Our engineers fix this exact apt error for a small one-time fee, and you see the quote before we touch anything. Hosted with Hostaccent? Then it's simply covered by support, free. Have an engineer fix it
Confirm the Fix and Stop It Coming Back
The fix worked when three things are true: sudo apt update ends with "Reading package lists... Done" and no Err lines, apt-cache policy NAME prints a Candidate version instead of (none), and the install completes. If all three pass in under 60 seconds, the repository setup is fine.
To prevent a repeat:
- Run
apt updatebefore every install, scripts included. - Put servers on an LTS: 5 years of updates beats 9 months.
- Check the name for your codename before pasting any tutorial.
Next come the runtime problems: a VPS running out of RAM, MySQL server has gone away, high TTFB in WordPress, or a slow WordPress site.
Fixed It, or Still Stuck? Your Two Next Steps
Now that you know unable to locate package Ubuntu errors usually trace back to a stale index or a missing component, you have two paths.
Fixed it? Make apt update a habit. In our experience, though, this class of problem should be support's job, not yours. The Basic plan at $7.99/mo (same price at renewal) includes full root access, a 99.99% uptime guarantee and 24/7 human engineers: start on the Basic Linux VPS plan. One caveat: no cPanel or Plesk licence is included.
Still stuck? Open a ticket with a Hostaccent engineer. It's a small one-time fee, and you'll see the exact quote before any work starts.
Frequently Asked Questions
Why do I get unable to locate package Ubuntu errors on a new server?
Fresh cloud images, minimal installs and Docker base images ship with an empty or very old package index to keep the image small. apt has nothing to search, so every install fails until the lists are downloaded. Run sudo apt update once, wait for "Reading package lists... Done", and try again. If the update prints errors, fix those first. The index stays empty until it succeeds.
Will apt update --fix-missing find a missing package?
No. The --fix-missing flag tells apt to carry on when a package file can't be downloaded or fails its integrity check, which helps with flaky mirrors during an upgrade. It does nothing when apt doesn't know the package name in the first place. For that you need a fresh index from sudo apt update, the correct name for your release, and the right component enabled.
How do I enable the universe repository on Ubuntu 24.04?
Run sudo add-apt-repository universe, then sudo apt update. On 24.04 and 26.04 the setting lives in /etc/apt/sources.list.d/ubuntu.sources, on the Components line, which should read main restricted universe multiverse if you want everything. Standard server installs have universe on by default, so check that line before changing anything. Stripped-down images are the usual exception, and some lack the add-apt-repository tool until you install the software-properties-common package.
How is this different from "has no installation candidate"?
Unable to locate means apt has never heard of that name in any enabled repository. No installation candidate means apt knows the name, usually because another package refers to it, but no installable version exists in your enabled sources. Both are fixed the same way: refresh the index, enable the missing component or vendor repository, and confirm the package is published for your release and CPU.
Is it safe to add a PPA when a package is missing?
Sometimes, but treat it as a last resort on production. A PPA is a personal archive that nobody at Ubuntu reviews, it can replace system libraries with newer builds, and it may stop publishing for your release without warning. Prefer the official archive, then the vendor's own repository, then a snap. If you do add one, take a snapshot first so you can roll back.












Discussion
Have a question or tip about this topic? Share it below — your comment will appear after review.