"Invalid package information" error when upgrading to Ubuntu 20.04

I am trying to upgrade from Ubuntu 19.10 to Ubuntu 20.04 but when I run the update, in the second stage this error pops:

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.


Solution 1:

I had the same problem. The solution was to add the official sources to the apt sources.list.

  1. Make a copy of your source list:

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    
  2. Get the official sources for Ubuntu 19.10 from sources.list › Wiki › ubuntuusers.de

    deb http://de.archive.ubuntu.com/ubuntu eoan main restricted universe multiverse
    deb http://de.archive.ubuntu.com/ubuntu eoan-updates main restricted universe multiverse
    deb http://de.archive.ubuntu.com/ubuntu eoan-security main restricted universe multiverse
    deb http://de.archive.ubuntu.com/ubuntu eoan-backports main restricted universe multiverse
    
  3. Open the list and add these lines at the end

    sudo nano /etc/apt/sources.list
    
  4. Update sources and install all available updates for 19.10 and reboot your system:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    sudo apt-get autoremove
    sudo reboot
    
  5. Ensure you have the lts path at the update-manager:

    $ cat /etc/update-manager/release-upgrades
    Prompt=lts
    
  6. If you upgrade over ssh: ensure your firewall allows ssh access over port 1022 (recovery-ssh-port). I didn't need to use port, it is just in case.

  7. Run the Upgrade

    sudo do-release-upgrade
    

Solution 2:

The actual solution is to run RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1 do-release-upgrade instead of the normal upgrade command.

There's no need to manually mess with sources.list (which doesn't work anyway). Just prevent the OS from disabling third-party sources, because they include packages that the OS needs in order to complete the upgrade.

Source: a comment in https://www.digitalocean.com/community/questions/cannot-update-to-19-04-the-essential-package-ubuntu-minimal-could-not-be-located-2