I was unable to update to Ubuntu 20 from Ubuntu 18.04

When I was updating suddenly the process aborted with the message:

Could not calculate the upgrade 

An unresolvable problem occurred while calculating the upgrade. 

This was likely caused by: 
* Unofficial software packages not provided by Ubuntu 
Please use the tool 'ppa-purge' from the ppa-purge 
package to remove software from a Launchpad PPA and 
try the upgrade again. 

If none of this applies, then please report this bug using the 
command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal. If 
you want to investigate this yourself the log files in 
'/var/log/dist-upgrade' will contain details about the upgrade. 
Specifically, look at 'main.log' and 'apt.log'. 


Restoring original system state

Aborting
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Please help me with update to Ubuntu 20.04 from 18.04.


Solution 1:

You have to remove third party repository. You can do it using one of two method:

Using the GUI (Software & Updates):

  1. Open Software & Updates app.
  2. Switch to Other Software tab.
  3. Uncheck all checkboxes (it will prompt for password first time).
  4. Retry upgrade to 20.04.

Using terminal:

  1. Issue this command on terminal:

    cd /etc/apt/sources.list.d
    
  2. Using an editor like nano or vi comment all uncommented line (put a # character at the beginning of line) in all files. (You need to use sudo) (You have to open all files one by one) (Uncommented line indicates those lines which don't start with a # character.)

  3. Retry upgrade to 20.04.

Solution 2:

Just

  • Go to Software & Updates
  • Go to Ubuntu software
  • In the Download from menu select main server

Then try to update Ubuntu. It worked very well for me.

Solution 3:

Late answer, but what I faced just mentioned here.

As the accepted answer steps didn't solve my problem completely, I checked the file

/var/log/dist-upgrade/main.log

It was mentioned there is an issue with python2.7. So I used the following command to uninstall it.

sudo apt purge -y python2.7-minimal

Then it worked fine. I was able to upgrade to Ubuntu 20.04.2 LTS.

Solution 4:

I had the same issue OP had when updating from 18.04 LTS to 20.04 LTS (x86_64 machine):

What worked for me was:

  1. I've ran release upgrade and got error messages OP had:
    $ sudo do-release-upgrade -d
  1. I've check which packages were "foreign" in /var/log/dist-upgrade/main.log:
    $ grep Foreign /var/log/dist-upgrade/main.log
    2021-10-15 16:37:07,173 DEBUG Foreign: <PACKAGE_NAME> <PACKAGE_NAME> ...

Where <PACKAGE_NAME> is name of Ubuntu package you should remove in order to proceed with distribution upgrade. In my case there were few custom vim packages I've installed, adobe flash plugin package etc.

  1. Use below command:
$ sudo apt-get remove <PACKAGE_NAME>

to remove all packages which were not removed with release upgrade tool.

Solution 5:

I was having the same issue, and this answer helped me. In short you only have to:

  1. sudo apt install synaptic - if you don't already have it installed
  2. open synaptic, go to Status and remove all obsolete packages from the list
  3. upgrade ubuntu as usual

The only drawback is that you'll lose some packages you may use, but you can take a screenshot before the uninstall and get them back after the upgrade.