How to Fix ‘Failed to fetch 404 Not Found’ apt Error in Ubuntu

Executing sudo apt update or attempting to install software packages on an Ubuntu system only to encounter an avalanche of red error messages stating: E: Failed to fetch http://archive.ubuntu.com/ubuntu/... 404 Not Found [IP: 91.189.91.39 80] and E: Some index files failed to download. They have been ignored, or old ones used instead prevents software installations and security patches. An HTTP 404 error during APT package updates indicates that the URL requested by APT does not exist on the mirror server. This occurs when an Ubuntu release reaches End of Life (EOL) and its repositories are migrated from the main archive mirrors to the old-releases server, or when a third-party Personal Package Archive (PPA) is deleted or does not support your specific Ubuntu version. This guide outlines how to repair package lists and resolve 404 Not Found APT errors.

What Causes “Failed to fetch 404 Not Found” in APT?

HTTP 404 repository errors in Ubuntu stem from repository lifecycle transitions and dead external PPAs:

  • End of Life (EOL) Ubuntu Release: Short-term Ubuntu releases (non-LTS builds supported for only 9 months) or older LTS versions past their support window having their packages purged from archive.ubuntu.com and moved to old-releases.ubuntu.com.
  • Deprecated or Removed Third-Party PPAs: A software developer deleting their Launchpad PPA repository, or a PPA lacking package builds for your current Ubuntu release codename.
  • Typographical Errors in sources.list: Misspelled release codenames (e.g. focal, jammy, noble) or corrupted repository component syntax.
  • Outdated or Corrupted Package List Metadata: Damaged partial lists stored in /var/lib/apt/lists/partial/ causing hash and path mismatches.

Method 1: Identify Your Ubuntu Release and Support Status

Determining whether your Ubuntu release is currently supported dictates whether you need to redirect to the old-releases repository.

  1. In your terminal, run:
    lsb_release -a
  2. Note your Release (e.g. 21.04, 22.10, 20.04) and Codename (e.g. hirsute, kinetic, focal).
  3. Check if your version is an End of Life release:
    • Standard interim releases (e.g. 21.04, 21.10, 22.10, 23.04, 23.10) reach EOL after 9 months.
    • Long Term Support (LTS) releases (e.g. 20.04, 22.04, 24.04) receive 5 years of standard support.

Method 2: Redirect EOL Releases to old-releases.ubuntu.com

If your Ubuntu version has reached End of Life, redirecting your APT sources to the official Ubuntu archive server restores full package installation capabilities.

  1. Back up your existing sources list:
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
  2. Use sed to replace all instances of archive.ubuntu.com and security.ubuntu.com with old-releases.ubuntu.com:
    sudo sed -i -e 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
    sudo sed -i -e 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
  3. Clean the existing local package cache:
    sudo apt clean
    sudo rm -rf /var/lib/apt/lists/*
  4. Run update:
    sudo apt update
    All official package repositories will now fetch cleanly from old-releases without 404 errors.

Method 3: Remove Broken Third-Party PPAs

If the 404 error references an external Launchpad PPA (e.g. http://ppa.launchpad.net/... 404 Not Found), removing the dead PPA resolves the error.

  1. Review the exact name of the failing PPA from the error output (e.g. ppa:example/testing).
  2. Remove the offending PPA using add-apt-repository:
    sudo add-apt-repository --remove ppa:username/ppa-name
  3. If add-apt-repository is not installed or fails, navigate to the PPA directory:
    cd /etc/apt/sources.list.d/
    ls -la
  4. Delete or move the .list file corresponding to the broken PPA:
    sudo rm /etc/apt/sources.list.d/broken-ppa.list
  5. Run sudo apt update to confirm clean synchronisation.

Method 4: Fix 404 Errors on Docker Official Repositories

When installing Docker or other tools on brand-new Ubuntu versions, repositories may not yet have published packages for your codename.

  1. Inspect /etc/apt/sources.list.d/docker.list.
  2. If your current Ubuntu release is very new (e.g. Noble 24.04), and Docker returns 404, temporarily change the codename in the .list file to the previous LTS release (e.g. jammy):
    sudo nano /etc/apt/sources.list.d/docker.list
  3. Save the file and run sudo apt update.

Ubuntu APT 404 Troubleshooting Matrix

Failing URL Domain Underlying Cause Immediate Remediation
archive.ubuntu.com/ubuntu Ubuntu release has reached End of Life (EOL) Replace archive URLs with old-releases.ubuntu.com
ppa.launchpad.net/... Developer deleted PPA or no builds for your Ubuntu version Remove PPA via add-apt-repository --remove or delete .list file
download.docker.com/... Package maintainer has not published builds for your codename Switch repository codename to previous LTS release in .list file
packages.microsoft.com/... Incorrect architecture (e.g. arm64 instead of amd64) Ensure [arch=amd64] flag is specified in sources.list line

Frequently Asked Questions

Can I upgrade an End of Life Ubuntu release to a supported version?

Yes. Once you have pointed your sources to old-releases.ubuntu.com and completed sudo apt update && sudo apt dist-upgrade, you can execute sudo do-release-upgrade to upgrade step-by-step to the next supported release.

Why does apt clean help with 404 errors?

APT caches package list manifests locally in /var/lib/apt/lists/. If a network disruption leaves partially downloaded index files on disk, APT may attempt to fetch individual package hashes from invalid server locations until the local lists are wiped and rebuilt.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.