14

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.

3
  • 2
    The easiest way to guarantee an update is to remove all 3rd party software (ie. return to only using Ubuntu repository software), perform the upgrade, reboot then add back any 3rd party software required. If you filed the bug it mentioned, you can look there for packages creating the issue(s) then remove, or the logs as mentioned in your paste. A re-install (without format) is actually fastest in my experience.
    – guiverc
    May 12, 2020 at 11:46
  • 2
    Did you "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'." ?
    – heynnema
    May 12, 2020 at 14:09
  • Check answer given here askubuntu.com/a/1306361/110089
    – Erick
    Jan 9, 2021 at 5:46

8 Answers 8

11

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.
6
  • i tried "Using gui method" it didn't work May 12, 2020 at 17:26
  • Please elaborate "Using terminal method" May 12, 2020 at 17:26
  • @GreekSachdeva Do you know how to use terminal and text editors like nano? If yes, then add a # character at the first of every line of every files at /etc/apt/sources.list.d . May 12, 2020 at 17:39
  • Nope i dont know May 12, 2020 at 17:53
  • how can i update to 20.04 wihout losing data May 12, 2020 at 17:54
7

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.

2
  • I am using Ubuntu Budgie 18.04 and I don't have "Software & Updates"
    – Marecky
    Jan 5, 2021 at 23:01
  • This solution does not work for me. I have multiple programs installed from PPAs and this does nothing to upgrade 18.04 to 20.04
    – Marecky
    Jan 5, 2021 at 23:35
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.

3
  • There is no Ubuntu 20. there is 20.04 and 20.10
    – David
    Apr 1, 2021 at 13:18
  • I had this exact same problem - I could not upgrade to Ubuntu 20. Thanks @Tusar. +1 for the command to purge the old python reference! Apr 13, 2021 at 16:48
  • @David Updated Ubuntu version
    – Tusar
    Apr 20, 2021 at 7:32
3

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.

1
  • Just to add. In my case packages to remove were: dalisha-icons faba-icon-theme fonts-powerline masalla-icon-theme moka-icon-theme obsidian-1-icons papirus-icon-theme powerline python3-powerline shadow-icon-theme square-icons vim vim-common vim-gtk-py2 vim-gtk3-py2 vim-gui-common vim-runtime Oct 18, 2021 at 11:12
1

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.

1

All of this did not work for me.

I checked /var/log/dist-upgrade/main.log and found failed to remove libpython-stdlib. As I already had removed python2.7-minimal I checked for other packages:

sudo apt list --installed | grep "python2"

And removed them. I also uninstalled the packages listed as "obsolete" in main.log.

sudo apt purge ocqt5125-libqt5core5a ocqt5125-libqt5dbus5 ocqt5125-libqt5gui5 ocqt5125-libqt5keychain1 ocqt5125-libqt5network5 ocqt5125-libqt5sql5 ocqt5125-libqt5sql5-sqlite ocqt5125-libqt5widgets5 ocqt5125-libqt5xml5 ocqt5125-libsqlite0 ocqt5125-qtsvg5 zoom
sudo apt purge python2.7-minimal python2.7-dev libpython2.7-dev libpython2.7-minimal libpython2.7-dev
sudo apt autoremove

After that dist upgrade crashed and did not start anymore because the sources where already changed but the packages not installed. I installed them manually with

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

Repeated that a couple of times until all updates are installed. Finally reboot.

0

This answer worked with me.

Here the workaround i use to pass this problem. We need to use app called Synaptic to remove all packages that is considered as unofficial. Steps:

  1. install synaptic with “sudo apt-get install synaptic”
  2. open synaptic app and find the list of obsolete packages by clicking on the “Status” button and selecting “Installed (local or obsolete)”.
  3. select all of the obsolete packages and mark them for removal, then click on Apply button. (Note: Your important apps my listed as obsolete packages, so make sure to backup the app data if posible. You my also need to keep the list by using screenshot,so you can install them back later after upgrade).
0

Like user said, it's probably some unsupported package installed via a package manager. For me it was python3. The solution was

sudo apt-get remove python3
sudo apt-get autoremove       # to remove python3-minimal

and then proceed to upgrade

sudo do-release-upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.