The repository ‘http://old-releases.ubuntu.com/ubuntu focal-security Release’ does not have a Release file

In this article, we will find the solution for below error.

E: The repository 'http://old-releases.ubuntu.com/ubuntu focal-security Release' does not have 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 repository httpold-releases.ubuntu.comubuntu focal-security Release does not have a Release file

Reason:

I have received this error message when performing sudo apt-get update on my Ubuntu 20.04 version.

This happens because you still have somehow the sources.list file for Ubuntu older version on your machine:

Solution:
Before performing action take backup of /etc/apt/sources.list with below command. If anything went wrong we can revert the changes.

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

You can use sudo -i in terminal and copy & paste the following (complete block) into it:

cat > /etc/apt/sources.list << EOF deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse #deb http://archive.ubuntu.com/ubuntu xenial-proposed restricted main universe multiverse #deb-src http://archive.ubuntu.com/ubuntu xenial-proposed restricted main universe multiverse deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner EOF

Now perform action for which you got the error.