Ubuntu – apt-get update fails “The repository no longer has a Release file”

The Issue

Running sudo apt-get update or sudo apt update fails with the following or similar errors:

Hit:1 http://apt.postgresql.org/pub/repos/apt eoan-pgdg InRelease
Ign:2 http://archive.ubuntu.com/ubuntu eoan InRelease
Ign:3 http://archive.ubuntu.com/ubuntu eoan-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu eoan-backports InRelease
Ign:5 http://archive.ubuntu.com/ubuntu eoan-security InRelease
Err:6 http://archive.ubuntu.com/ubuntu eoan Release
404 Not Found [IP: 91.189.88.142 80]
Err:7 http://archive.ubuntu.com/ubuntu eoan-updates Release
404 Not Found [IP: 91.189.88.142 80]
Err:8 http://archive.ubuntu.com/ubuntu eoan-backports Release
404 Not Found [IP: 91.189.88.142 80]
Err:9 http://archive.ubuntu.com/ubuntu eoan-security Release
404 Not Found [IP: 91.189.88.142 80]
Reading package lists... Done
E: The repository 'http://archive.ubuntu.com/ubuntu eoan Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu eoan-updates Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu eoan-backports Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu eoan-security Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
The Cause

Older releases of Ubuntu are moved to an archive server, so you need to update your repo lists.

The Fix
# backup your sources file
cp /etc/apt/sources.list /etc/apt/sources.list.bak 

# replace the links with the archive address
sudo sed -i -re 's/([a-z]{2}.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

# run update again
sudo apt-get update && sudo apt-get dist-upgrade

Regards

6 thoughts on “Ubuntu – apt-get update fails “The repository no longer has a Release file”

  1. This looks just the solution I need for updating from Ubuntu 19.04 – but getting a long response to apt update very similar to the one shown.
    (all sorts of “failed”, “not trusted”, “could not handshake” etc)

    But for the first step:
    cp /etc/apt/sources.list /etc/apt/sources.list.bak
    I get:
    cp: cannot create regular file ‘/etc/apt/sources.list.bak’: Permission denied

    I am a sole owner/user with no extra security layers (that I added knowingly)
    Any ideas ?

    Thanks very much

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.