Cannot upgrade from disco 19.04 to focal 20.04 after end of life using do-release-upgrade method

This is the only instruction which helped me: Upgrading End of Life (EOL) Ubuntu Version Ubuntu 19.04

Quoting from the above link:

~# nano /etc/apt/sources.list

I got stuck trying to update php 7.2 to 7.4 because my Digital Ocean server was on an older version of Ubuntu.

If I tried to update my release I'd get the following

# do-release-upgrade
Checking for a new Ubuntu release
Your Ubuntu release is not supported anymore.
For upgrade information, please visit:
http://www.ubuntu.com/releaseendoflife

Please install all available updates for your release before upgrading.

When attempting to update my packages with apt-get update I would get these types of errors.

Err:5 http://mirrors.digitalocean.com/ubuntu disco Release
  404  Not Found [IP: 172.67.168.253 80

E: The repository 'http://mirrors.digitalocean.com/ubuntu disco Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

These occur because my Ubuntu version is not only out of date but at its end of life so updating Ubuntu to a newer version.will require me to update my repositories.

Digital Ocean uses its own mirrors for repositories so there is a little more work there in figuring out which ones to use.

What version of Ubuntu am I on?

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.04
Release:        19.04
Codename:       disco

What repositories are being used?

~# nano /etc/apt/sources.list

Example repoistory on Digital Ocean Ubuntu 19.04

deb http://mirrors.digitalocean.com/ubuntu/ disco main restricted

Let's first get our current Ubuntu version up to date

To make the server update the files, we had to edit the /etc/apt/sources.list with working repository locations.

To goal here, on this Digital Ocean server is to update the urls they use for the repositories with ones you that will have the files you need for your update

We want to replace this urls

mirrors.digitalocean.com

with

old-releases.ubuntu.com

This command will work

sudo sed -i -e 's/mirrors.digitalocean.com/old-releases.ubuntu.com/g'

/etc/apt/sources.list

Now

sudo apt-get update

will work!

Let's keep going

sudo apt-get upgrade -y
sudo apt-get dist-upgrade

Try to upgrade Ubuntu on the command line.

We are still unable to upgrade via do-release-upgrade

# do-release-upgrade

Checking package manager

Can not upgrade

An upgrade from 'disco' to 'focal' is not supported with this tool.

Frack!

So now I have my current outdated version of Ubuntu up to date, but I can't upgrade to the next version using do-release-upgrade

You can try to upgrade manually.

First go to https://changelogs.ubuntu.com/meta-release and scroll down to the release you want to upgrade to.

For example if you want to upgrade to Ubuntu 19.10 Eoan scroll to you find the url to the UpgradeTool

UpgradeTool: http://old-releases.ubuntu.com/ubuntu/dists/eoan-updates/main/dist-upgrader-all/current/eoan.tar.gz

Now pull this over to a directory on your server

wget http://old-releases.ubuntu.com/ubuntu/dists/eoan-updates/main/dist-upgrader-all/current/eoan.tar.gz
mkdir eoan_upgrade
tar -xvzf  eoan.tar.gz -C eoan_upgrade

cd eoan_upgrade

Run the upgrade script

sudo ./eoan
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

Faced the same problem after end of life. The process to upgrade to 20.04 was first to upgrade to 19.10. Following is how I upgraded 19.04 to 19.10

  1. Open /etc/apt/sources.list
  2. Delete everything and replace it with the following: (you might want to keep a backup just in case)
deb http://old-releases.ubuntu.com/ubuntu eoan main 
deb http://old-releases.ubuntu.com/ubuntu eoan-updates main 
deb http://old-releases.ubuntu.com/ubuntu eoan-security main 
  1. Finally, just run these commands one by one:
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

That's basically it. Ubuntu should now be upgraded to 19.10 (Eoan)

Now it is an easy task to upgrade from Eoan to Focal (20.04)

Note: After you update to Eoan, you may want to update your sources.list file. You can find it here:

Eoan (Ubuntu 19.10): https://gist.github.com/malikalichsan/860b8134a74c65a394efe09711d0b95f

Focal (Ubuntu 20.04): https://gist.github.com/ishad0w/788555191c7037e249a439542c53e170