When running sudo apt update or attempting to install software on Ubuntu, users often run into repository errors ending with ‘E: Failed to fetch http://… 404 Not Found’ followed by ‘W: Some index files failed to download. They have been ignored, or old ones used instead.’ This error indicates that the Advanced Package Tool (APT) cannot locate package indices at the specified repository URLs. It typically occurs when using an End-of-Life (EOL) Ubuntu release, when an external Personal Package Archive (PPA) is retired, or when repository addresses are mistyped in sources lists.
Why Does APT Return 404 Not Found?
Ubuntu distributes software packages through an extensive global network of mirror servers hosting precompiled Debian archives. Each distribution release (such as Noble Numbat 24.04, Jammy Jellyfish 22.04, or older interim releases like 23.10) maintains dedicated directories on these mirrors corresponding to repository components (main, restricted, universe, and multiverse).
When APT issues an HTTP GET request for a package catalogue (such as InRelease or Packages.gz) and the server returns a 404 status code, it is generally due to:
- Your Ubuntu release has reached End-of-Life (EOL), causing Canonical to move its package trees from the primary archive to
old-releases.ubuntu.com. - A third-party Launchpad PPA has been removed by its maintainer or does not provide packages for your current Ubuntu version.
- Corrupted local repository cache files in
/var/lib/apt/lists/causing desynchronised package hash lookups. - Stale repository entries left behind after upgrading from one Ubuntu distribution version to another.
Method 1: Identify and Remove Deprecated or Missing PPAs
If the 404 error points to an external PPA (e.g., ppa.launchpadcontent.net), the repository author has likely discontinued support or never released packages for your release architecture.
- Carefully examine the terminal output of
sudo apt updateto spot the exact URL returning the 404 error. - If the failing URL contains a PPA identifier, remove it using the
add-apt-repositoryutility:sudo add-apt-repository --remove ppa:repositoryname/branch
(Replaceppa:repositoryname/branchwith the exact PPA string reported in your terminal). - Alternatively, list all active third-party repository definition files:
ls /etc/apt/sources.list.d/ - Delete or move the specific
.listor.sourcesfile triggering the 404 error:sudo rm /etc/apt/sources.list.d/failing-ppa.list - Run
sudo apt updateto confirm the error is cleared.
Method 2: Update Repository Sources for End-of-Life (EOL) Ubuntu Versions
Interim Ubuntu releases are supported for 9 months, while Long-Term Support (LTS) releases receive 5 years of standard support. When a non-LTS version reaches its end of lifecycle, Canonical archives its repositories, relocating them from archive.ubuntu.com to old-releases.ubuntu.com.
- Check your current Ubuntu release version by running:
lsb_release -a - If your version is no longer officially supported, create a backup of your current sources list:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup - Use the
sedstream editor to replace all references to official archive and security mirrors with the official legacy archive URL:sudo sed -i -r 's/([a-z]{2}\.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.listsudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list - Refresh your repository database:
sudo apt update - Once repository access is restored, plan an immediate distribution upgrade to an actively supported Long-Term Support (LTS) release using
sudo do-release-upgrade.
Method 3: Clear and Rebuild Local APT Cache Lists
Occasionally, an aborted network transfer or corrupted local list file prevents APT from reading repository indices properly.
- Remove all cached package index lists from your local storage:
sudo rm -rf /var/lib/apt/lists/* - Clean the local package cache:
sudo apt clean - Recreate the lists directory and download fresh metadata from all active mirrors:
sudo apt update
Method 4: Switch to the Main Ubuntu Mirror
If you are using a localized regional mirror (e.g., uk.archive.ubuntu.com or in.archive.ubuntu.com) that is experiencing maintenance or sync lag, redirecting queries to the primary global cluster resolves mirror 404 faults.
- Open the Software & Updates utility from your desktop application launcher.
- Under the Ubuntu Software tab, locate the Download from dropdown menu.
- Change the selection from your country mirror to Main Server.
- Click Close. Ubuntu will prompt you to reload your software lists; click Reload to pull down the updated metadata.
By purging obsolete third-party PPAs and repointing retired Ubuntu versions to the proper legacy mirrors, you can successfully eliminate the 404 Not Found error and restore full package installation capabilities in APT.