34

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.

1

6 Answers 6

53

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

3
  • 3
    Thanks. Worked for me while doing 18.04 LTS to 20.04 @DigitalOcean.
    – cucu8
    Feb 14, 2022 at 9:23
  • 2
    ah yes. some hosts have their own local repository for optimization, and remove the canonical repository. When the do-release-update disables the "3rd party", its actually cutting off the core source.
    – ppostma1
    May 10, 2022 at 19:31
  • @cucu8 - same. The RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1 env variable got it to work for me as well. Aug 1, 2022 at 21:07
18

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
    
1
  • 7
    This is using a German mirror of the Ubuntu sources. While it may work, it is not a general solution.
    – Matthias
    Sep 1, 2021 at 18:25
7

I was having this problem on a DigitalOcean droplet. The fix from VivienM seems to have done the trick for me.

While do-release-update was paused at this message:

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]

After you see this message go to /etc/apt/sources.list and uncomment all the references to mirrors.digitalocean.com. Then press ENTER to resume the installation.

1
  • This doesn't change anything. Nov 23, 2021 at 19:29
3

This sorted it for me. It seems the automatic source.list relying on mirrors.txt functionality did not work for some reason. What comes to the archive mirror list above, the URL is:

http://<country-code>.archive.ubuntu.com/ubuntu/ 
1
  • That's a wonderful URL. How is it a solution to this problem? Nov 23, 2021 at 19:29
2

In my case both RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1 do-release-upgrade and do-release-upgrade --allow-third-party didn't work.

I had to manually convert the entries from /etc/apt/source.list file from

deb mirror://mirrors.ubuntu.com/mirrors.txt focal main restricted

to real repo URL like

deb http://ubuntu.task.gda.pl/ubuntu focal main restricted

You need to run sudo apt-get update after the change.

Then I was able to upgrade from 20.04 to 22.04 without any errors.

2
  • Thank you soooo much! You saved my day :-) I rather used "fi.archive.ubuntu.com/ubuntu" url, got it from another server of mine. But yeah, the mirror url doesn't seem to work properly...
    – Kulgar
    Feb 2 at 14:56
  • For me, to update from 20.04 to 22.04, I manually add URLs from the 22.04 version of /etc/apt/sources.list into my local version.
    – Voyager
    Feb 16 at 8:24
-2

I had a similar issue when upgrading 16.04 to 18.04.

It started upgrading when I added these lines to my sources.list:

deb http://archive.ubuntu.com/ubuntu/ xenial main universe multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-security main universe multiverse

See also https://www.linode.com/community/questions/17813/errors-when-upgrading-from-1604-to-1804#answer-68979

1
  • 1
    This is unrelated (please read the other answers, namely the accepted one) and not applicable to the actual question. Ubuntu 16.04 is out of support for a long time now. Mar 14, 2022 at 16:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .