How to fix E: Failed to fetch ... 404 Not Found in APT
This error occurs when apt cannot find a package or repository at the specified URL, typically due to outdated package sources, end-of-life Ubuntu versions, or incompatible PPA repositories. The solution involves updating your repository sources to point to valid repositories.
Quick fix
Fixes E: Failed to fetch ... 404 Not Found
lsb_release -a
# or
cat /etc/os-release- Identify your Ubuntu/Debian version
- Backup your current sources list
- For end-of-life Ubuntu versions: Switch to old-releases repository
- For end-of-life Debian versions: Switch to Debian archive
lsb_release -a# orcat /etc/os-releaseE: Failed to fetch ... 404 Not Found
What this error means
The "404 Not Found" error is an HTTP status code indicating that the requested resource does not exist at the specified URL. When apt encounters this error during `apt update` or package installation, it means one or more of your configured package repositories has an invalid or outdated URL. This commonly occurs when repository servers are moved, repositories are deprecated, or when using older distributions that have reached end-of-life (EOL). APT cannot proceed with updating or installing packages until you fix the invalid repository URLs.
Typical symptoms
- apt update fails with "E: Failed to fetch http://.../... 404 Not Found"
- apt install or apt upgrade commands fail immediately with 404 errors
- Running on an older Ubuntu/Debian version (16.04, 14.04, Jessie, Stretch, etc.) triggers 404 errors
- Custom PPA repositories fail to fetch with 404 errors
- Some repositories fetch successfully but others return 404 (indicates partial misconfiguration)
- Error messages include specific URLs that no longer exist
Common causes
- Using an end-of-life (EOL) Ubuntu version (older than 9 months for standard release, or older than 5 years for LTS)
- Repository servers have been moved or the URL has been changed without updating /etc/apt/sources.list
- PPA repository is incompatible with your Ubuntu/Debian version or architecture
- Repository has been permanently shut down or consolidated
- Typo or incorrect URL in /etc/apt/sources.list or /etc/apt/sources.list.d/ files
- Network or firewall blocking access to the repository URL
- Repository undergoing maintenance (temporary, usually resolves in minutes to hours)
- Running on a non-standard distribution or architecture where packages are not available
How to fix "E: Failed to fetch ... 404 Not Found"
First, determine what version of Ubuntu or Debian you are running. Use:
lsb_release -a
# or
cat /etc/os-releaseCheck if your version is still supported. Ubuntu LTS versions are supported for 5 years, standard releases for 9 months. Debian versions have different support timelines (e.g., Debian Jessie EOL was 2020-06-30, Stretch EOL was 2022-06-30).
Before making changes, create a backup of your current sources configuration:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backupThis allows you to restore the original if something goes wrong.
If you are running an EOL Ubuntu version (e.g., 16.04, 14.04), Canonical maintains an old-releases archive. Replace archive.ubuntu.com with old-releases.ubuntu.com:
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.listThis redirects all repository requests to the archived repositories for your version.
If you are running an EOL Debian version (Jessie, Stretch, Wheezy), switch to the official Debian archive:
sudo sed -i -e 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.listFor Bullseye which is becoming EOL, ensure sources point to deb.debian.org before transitioning to archive.debian.org when EOL is reached.
Check /etc/apt/sources.list.d/ for third-party PPA repositories that may be causing 404 errors:
ls /etc/apt/sources.list.d/If you identify a problematic PPA, remove it:
sudo add-apt-repository --remove ppa:username/ppa-nameOr manually delete the file:
sudo rm /etc/apt/sources.list.d/problematic-repo.listFor Ubuntu users who prefer a graphical interface:
1. Open Settings → Software & Updates
2. Review the "Ubuntu Software" tab and check enabled repositories
3. Click the "Other Software" tab
4. Look for any third-party PPAs or repositories that might be invalid
5. Uncheck or remove entries that are causing 404 errors
6. Click "Close" to refresh the package index
This method is safer if you're unfamiliar with editing sources.list directly.
After fixing your repository sources, update your package lists:
sudo apt updateThis should now complete without 404 errors. If errors persist, you may have additional problematic repositories to address. The output will show which specific repositories are still failing.
If you continue to experience 404 errors even after fixing sources, clear the apt cache:
sudo apt cleanThen retry the update:
sudo apt updateClearing the cache removes outdated cached package information that might be causing issues.
If running in Docker, ensure you update package lists within the container before installing packages:
FROM ubuntu:16.04
RUN apt update && apt install -y curl build-essentialFor containers based on EOL versions, switch to old-releases first:
FROM ubuntu:16.04
RUN sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list && apt update && apt install -y curlAdvanced notes
The 404 error specifically indicates an HTTP 404 response, distinct from connection timeouts or DNS failures. Repository 404 errors are permanent by nature—if a URL returns 404, it will continue to do so until the repository is restored. Different Ubuntu releases have different EOL timelines: Ubuntu 22.04 (Jammy) LTS is supported until 2027, while Ubuntu 20.04 (Focal) LTS is supported until 2025. Standard releases like 23.10 are only supported for 9 months. Debian follows a different model with Stable, Testing, and Unstable branches; Stable releases transition to Old-Stable for 1 year after the next release. When troubleshooting 404 errors, always check if your version is EOL first—this is the most common cause. For custom repositories or PPAs, verify the repository is compatible with your specific Ubuntu/Debian version and architecture (amd64, i386, arm64, etc.). Some repositories may not provide packages for all architectures, causing 404 errors for specific package architectures. In CI/CD pipelines, adding retry logic with exponential backoff can help when encountering temporary 404 errors caused by repository maintenance windows.
Frequently asked questions
- What does "E: Failed to fetch ... 404 Not Found" mean?
- The "404 Not Found" error is an HTTP status code indicating that the requested resource does not exist at the specified URL. When apt encounters this error during apt update or package installation, it means one or more of your configured package repositories has an invalid or outdated URL. This commonly occurs when repository servers are moved, repositories are deprecated, or when using older distributions that have reached end-of-life (EOL).
- How do I fix "E: Failed to fetch ... 404 Not Found"?
- This error occurs when apt cannot find a package or repository at the specified URL, typically due to outdated package sources, end-of-life Ubuntu versions, or incompatible PPA repositories. The solution involves updating your repository sources to point to valid repositories.
- What causes "E: Failed to fetch ... 404 Not Found"?
- Using an end-of-life (EOL) Ubuntu version (older than 9 months for standard release, or older than 5 years for LTS) Repository servers have been moved or the URL has been changed without updating /etc/apt/sources.list PPA repository is incompatible with your Ubuntu/Debian version or architecture
- Is the "E: Failed to fetch ... 404 Not Found" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.