Apt Update Says Repository Does Not Have Release File 404 Fix
You're getting a 404 on apt update because the repo URL is dead or the distro version is outdated. Here's how to fix it fast.
The 30-Second Fix: Run apt update with --fix-missing
First thing's first — try this quick command and see if it cleans up the mess:
sudo apt update --fix-missing
--fix-missing tells apt to skip repos it can't reach and retry later. It won't fix a dead repo permanently, but it'll let you install stuff right now. I had a client last month whose whole server was stuck because a third-party repo went offline after an update. One run of this, and they could at least keep working while I sorted the repo.
If the error's gone, you're done. If it's still there, move on.
The 5-Minute Fix: Find and Disable the Broken Repo
That 404 means apt can't find a Release file at the repository's URL. Usually because the repo died or moved. Here's how to track it down:
- Run
sudo apt updateand look at the error line. It'll say something like:Err:8 http://old-repo.ubuntu.com/ubuntu bionic InRelease
The repo URL is right there. - Disable it by moving the
.listfile out of/etc/apt/sources.list.d/or commenting out the line in/etc/apt/sources.list. - To find which file it's in:
grep -r "old-repo.ubuntu.com" /etc/apt/ - Then either delete the file or edit it and put a
#at the start of the line.
Pro tip: Don't delete the file if you might need the repo later — just rename it with .bak extension so apt ignores it.
After disabling, run sudo apt update again. If the error's gone, you're good. If not, there's another repo causing trouble.
Common culprits I've seen:
- Ubuntu 18.04 (Bionic) repos moved to
old-releases.ubuntu.comafter EOL in 2023. - Third-party PPAs that the maintainer abandoned or took down.
- Docker, Google Chrome, or Spotify repos that changed URLs.
The 15-Minute Fix: Clean and Rebuild Apt Cache
If disabling broken repos didn't fix it, your apt cache might be corrupted or you've got leftover junk. Do this:
- Clean the cache:
sudo apt clean
This empties/var/cache/apt/archives/. Won't hurt anything. - Remove partial downloads:
sudo rm -rf /var/lib/apt/lists/partial/* - Recreate the lists directory:
sudo rm -rf /var/lib/apt/lists/*sudo mkdir -p /var/lib/apt/lists/partial - Update again:
sudo apt update
This forces apt to re-download all repo metadata from scratch. I've fixed dozens of servers with this — one time a client's cron job was half-corrupting the lists directory every night. This solved it.
If the error persists after this, you've got a repo that's genuinely gone. Time to remove it permanently.
Still Broken? Nuke the Repo from Orbit
Some repositories just aren't coming back. Here's the nuclear option:
- List all your sources:
ls /etc/apt/sources.list.d/andcat /etc/apt/sources.list - Find the exact file for the broken repo (use
grep -ras above). - Delete it:
sudo rm /etc/apt/sources.list.d/broken-repo.list - Also check for
.list.savefiles and remove those too. - Run
sudo apt update— should be clean now.
Warning: If it's a repo you installed software from (like google-chrome or docker-ce), you'll need to pin the package to avoid apt trying to remove it. Do this:
sudo apt-mark hold google-chrome-stable
Then you can safely remove the repo file.
When All Else Fails: Check Your DNS and Proxy
I once spent an hour chasing a 404 that was actually a DNS issue. The repo URL was correct, but the resolver couldn't reach it. Quick test:
curl -I http://archive.ubuntu.com/ubuntu/dists/focal/Release
If you get a 200, the repo is fine. If you get a timeout or connection refused, check:
- Your
/etc/resolv.conf— should point to a working DNS server like 8.8.8.8 or 1.1.1.1. - Any proxy settings in
/etc/apt/apt.conf.d/or environment variables (http_proxy,https_proxy). - Network connectivity —
ping 8.8.8.8works?
If curl returns 200 but apt still throws 404, you've got a corrupted local file that the clean step above should have fixed. If not, you might have a disk full error — check with df -h.
That's the full playbook. Start simple, escalate as needed. 9 times out of 10, it's a dead repo from an old PPA or an EOL Ubuntu release. Don't overthink it.
Was this solution helpful?