Unable to run ‘apt update’ on Ubuntu 19.04

In this article, we will see the solution for Unable to run ‘apt update’ on Ubuntu 19.04.

Reason: The repositories for older releases that are not supported (like 11.04, 11.10 and 13.04) get moved to an archive server. There are repositories available at http://old-releases.ubuntu.com.

Error: We have received following when run sudo apt-get update.

Ign:1 http://security.ubuntu.com/ubuntu disco-security InRelease Ign:2 http://us.archive.ubuntu.com/ubuntu disco InRelease Err:3 http://security.ubuntu.com/ubuntu disco-security Release 404 Not Found [IP: 91.189.88.142 80] Ign:4 http://us.archive.ubuntu.com/ubuntu disco-updates InRelease Ign:5 http://us.archive.ubuntu.com/ubuntu disco-backports InRelease Ign:6 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease Err:7 http://us.archive.ubuntu.com/ubuntu disco Release 404 Not Found [IP: 91.189.91.38 80] Ign:8 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 InRelease Hit:9 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release Err:10 http://us.archive.ubuntu.com/ubuntu disco-updates Release 404 Not Found [IP: 91.189.91.38 80] Hit:11 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 Release Hit:12 http://apt.postgresql.org/pub/repos/apt disco-pgdg InRelease Err:13 http://us.archive.ubuntu.com/ubuntu disco-backports Release 404 Not Found [IP: 91.189.91.38 80] Reading package lists... Done E: The repository 'http://security.ubuntu.com/ubuntu disco-security Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils. E: The repository 'http://us.archive.ubuntu.com/ubuntu disco Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils. E: The repository 'http://us.archive.ubuntu.com/ubuntu disco-updates Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils. E: The repository 'http://us.archive.ubuntu.com/ubuntu disco-backports Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils. N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://apt.postgresql.org/pub/repos/apt disco-pgdg InRelease' doesn't support architecture 'i386' root@mongodb1:/home/r2schools# apt-get update Ign:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease Hit:2 http://apt.postgresql.org/pub/repos/apt disco-pgdg InRelease Ign:3 http://security.ubuntu.com/ubuntu disco-security InRelease Ign:4 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 InRelease Hit:5 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release Hit:6 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 Release Err:7 http://security.ubuntu.com/ubuntu disco-security Release 404 Not Found [IP: 91.189.91.39 80] Ign:8 http://us.archive.ubuntu.com/ubuntu disco InRelease Ign:9 http://us.archive.ubuntu.com/ubuntu disco-updates InRelease Ign:10 http://us.archive.ubuntu.com/ubuntu disco-backports InRelease Err:11 http://us.archive.ubuntu.com/ubuntu disco Release 404 Not Found [IP: 91.189.91.39 80] Err:12 http://us.archive.ubuntu.com/ubuntu disco-updates Release 404 Not Found [IP: 91.189.91.39 80] Err:14 http://us.archive.ubuntu.com/ubuntu disco-backports Release 404 Not Found [IP: 91.189.91.39 80] Reading package lists... Done E: The repository 'http://security.ubuntu.com/ubuntu disco-security Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils. N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://apt.postgresql.org/pub/repos/apt disco-pgdg InRelease' doesn't support architecture 'i386' E: The repository 'http://us.archive.ubuntu.com/ubuntu disco Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils. E: The repository 'http://us.archive.ubuntu.com/ubuntu disco-updates Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils. E: The repository 'http://us.archive.ubuntu.com/ubuntu disco-backports Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disa bled by default. N: See apt-secure(8) manpage for repository creation and user configuration deta ils.

Solution:

Step 1: Run below command on

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

then

sudo apt-get update && sudo apt-get dist-upgrade