Can't upgrade Ubuntu

Ubuntu Upgrading issues 

If you trying you trying to upgrade Ubuntu from an older / out of support version to a new one, like 14.04 to 16.04 or 16.04 to 18.04 it's likely you get some of the following error messages when you run do-release-upgrade

Invalid package information
has no installation candidate

It's likely your software source somewhere here /etc/apt/sources.list is outdated and this happens because most cloud providers, like in my case Digital Ocean, change the original sources.list to their repositories but because the version you trying to upgrade from is out of support your sources are also out of support, nothing to worry much about, ubuntu.com provides an archive support list.

How to fix this?

First, make a snapshot for your instance/droplet and then try to replace the source.list with the archived versions, something like:

sudo sed -i 's/mirrors.digitalocean.com/us.archive.ubuntu.com/' /etc/apt/sources.list
 
and then try to run do-release-upgrade, if you still face some problems it's likely you need to update dependency packages and you should do the following:

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

Once finished, it's a good idea to revert the file back to the original Digital Oceans mirrors, in my case.

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

This resource Is also helpful to understand the end of life of a specific Ubuntu version.

peace outcool