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: 80]
Err:7 http://archive.ubuntu.com/ubuntu eoan-updates Release
404 Not Found [IP: 80]
Err:8 http://archive.ubuntu.com/ubuntu eoan-backports Release
404 Not Found [IP: 80]
Err:9 http://archive.ubuntu.com/ubuntu eoan-security Release
404 Not Found [IP: 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.

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

source : https://veducate.co.uk/ubuntu-apt-update-fails/
Posted on: August 1, 2022, by :  | 37 views