How to fix E: Failed to fetch ... 404 Not Found in APT

APTINTERMEDIATEHIGHUpdated Dec 29, 2025· 126 views

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
  1. Identify your Ubuntu/Debian version
  2. Backup your current sources list
  3. For end-of-life Ubuntu versions: Switch to old-releases repository
  4. For end-of-life Debian versions: Switch to Debian archive
apt — error
lsb_release -a
# or
cat /etc/os-release
E: 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

  1. Using an end-of-life (EOL) Ubuntu version (older than 9 months for standard release, or older than 5 years for LTS)
  2. Repository servers have been moved or the URL has been changed without updating /etc/apt/sources.list
  3. PPA repository is incompatible with your Ubuntu/Debian version or architecture
  4. Repository has been permanently shut down or consolidated
  5. Typo or incorrect URL in /etc/apt/sources.list or /etc/apt/sources.list.d/ files
  6. Network or firewall blocking access to the repository URL
  7. Repository undergoing maintenance (temporary, usually resolves in minutes to hours)
  8. Running on a non-standard distribution or architecture where packages are not available

How to fix "E: Failed to fetch ... 404 Not Found"

1Identify your Ubuntu/Debian version

First, determine what version of Ubuntu or Debian you are running. Use:

bash
lsb_release -a
# or
cat /etc/os-release

Check 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).

2Backup your current sources list

Before making changes, create a backup of your current sources configuration:

bash
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

This allows you to restore the original if something goes wrong.

3For end-of-life Ubuntu versions: Switch to old-releases repository

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:

bash
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

This redirects all repository requests to the archived repositories for your version.

4For end-of-life Debian versions: Switch to Debian archive

If you are running an EOL Debian version (Jessie, Stretch, Wheezy), switch to the official Debian archive:

bash
sudo sed -i -e 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list

For Bullseye which is becoming EOL, ensure sources point to deb.debian.org before transitioning to archive.debian.org when EOL is reached.

5Remove or fix problematic PPA repositories

Check /etc/apt/sources.list.d/ for third-party PPA repositories that may be causing 404 errors:

bash
ls /etc/apt/sources.list.d/

If you identify a problematic PPA, remove it:

bash
sudo add-apt-repository --remove ppa:username/ppa-name

Or manually delete the file:

bash
sudo rm /etc/apt/sources.list.d/problematic-repo.list
6Use Software & Updates GUI for easier management (Ubuntu)

For 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.

7Update package lists

After fixing your repository sources, update your package lists:

bash
sudo apt update

This 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.

8Clear apt cache if needed

If you continue to experience 404 errors even after fixing sources, clear the apt cache:

bash
sudo apt clean

Then retry the update:

bash
sudo apt update

Clearing the cache removes outdated cached package information that might be causing issues.

9For containerized environments (Docker)

If running in Docker, ensure you update package lists within the container before installing packages:

dockerfile
FROM ubuntu:16.04
RUN apt update && apt install -y curl build-essential

For containers based on EOL versions, switch to old-releases first:

dockerfile
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 curl

Advanced 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.

Official resources & further reading