Belated upgrade from 16.04 to 18.04

I have a Digital Ocean droplet running Ubuntu Server 16.04. I tried to run a do-release-upgrade (after the mandatory apt update and apt upgrade) but it stops fairly quickly:

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease                                                                                                          
Hit http://mirrors.digitalocean.com/ubuntu xenial InRelease                                                                                                                   
Get:1 https://esm.ubuntu.com/infra/ubuntu xenial-infra-security InRelease [7476 B]                                                                                            
Get:2 https://esm.ubuntu.com/infra/ubuntu xenial-infra-updates InRelease [7475 B]                                                                                             
Get:3 http://mirrors.digitalocean.com/ubuntu xenial-updates InRelease [109 kB]                                                                                                
Get:4 http://mirrors.digitalocean.com/ubuntu xenial-backports InRelease [107 kB]                                                                                              
Get:5 http://mirrors.digitalocean.com/ubuntu xenial-security InRelease [109 kB]                                                                                               
Get:6 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 Packages [2048 kB]                                                                                     
Get:7 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 Packages [1524 kB]                                                                                      
Get:8 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 Packages [1220 kB]                                                                                 
Get:9 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe i386 Packages [1086 kB]                                                                                  
Fetched 6218 kB in 0s (0 B/s)                                                                                                                                                 
Reading package lists... Done    
Building dependency tree          
Reading state information... Done
No snaps are installed yet. Try 'snap install hello-world'.

Checking for installed snaps

Calculating snap size requirements

Updating repository information

Third party sources disabled 

Some third party entries in your sources.list were disabled. You can 
re-enable them after the upgrade with the 'software-properties' tool 
or your package manager. 

To continue please press [ENTER]

Get:1 https://esm.ubuntu.com/infra/ubuntu bionic-infra-security InRelease [7458 B]                                                                                            
Get:2 https://esm.ubuntu.com/infra/ubuntu bionic-infra-updates InRelease [7457 B]                                                                                             
Fetched 14.9 kB in 0s (0 B/s)                                                                                                                                                 

Checking package manager
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Invalid package information 

After updating your package information, the essential package 
'ubuntu-minimal' could not be located. This may be because you have 
no official mirrors listed in your software sources, or because of 
excessive load on the mirror you are using. See /etc/apt/sources.list 
for the current list of configured software sources. 
In the case of an overloaded mirror, you may want to try the upgrade 
again later. 

Is this because the software sources are no longer correct (if so what would be the correct ones)? The official DO mantra is to install a fresh version on another droplet and then switch droplets but I want to avoid this.

Edit: The standard /etc/apt/source.lst on DO points only to DO's mirrors. Peeking at it (before do-release-upgrade restores it due to failure), it appears that all entries are commented out (considered as 3rd party sources?). So where can I find a sources.lst that points to the Canonical repos?

Bonus points for a method to move to 20.04 without the 18.04 step...

PS: the do-release-upgrade on my other droplet running 18.04 worked flawlessly.


Seems like you are using Digital Ocean. Make a snapshot, then you can try replacing the source.list with the archived versions like so

sudo sed -i 's/mirrors.digitalocean.com/us.archive.ubuntu.com/' /etc/apt/sources.list

then try running do-release-upgrade again.

If hitting a snag, I also had to run this before do-release-upgrade

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

Once finished, revert the file back.

sudo sed -i 's/us.archive.ubuntu.com/mirrors.digitalocean.com/' /etc/apt/sources.list