Ubuntu – How to fix update problems (Ubuntu 20.04)

aptpackage-managementupgrade

I had finished the update to Ubuntu 20.04 and was trying to update the packages as well but I encountered an error with one of my packages being held. This is the output after running "sudo apt upgrade":

Reading package lists...
Done Building dependency tree
Reading state information...
Done Calculating upgrade... 
Done The following packages have been kept back:   
gdb gir1.2-peas-1.0 libpeas-1.0-0 libsmbclient libwbclient0 samba-libs 
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

I have tried running multiple commands to clear broken packages/dependencies, including:

sudo apt clean
sudo apt autoclean
sudo apt autoremove

Nothing seems to work (not even dist-upgrade does anything) and when I tried manually updating the packages I got the following message:

sudo apt-get install gdb

The following packages have unmet dependencies:
 gdb : Depends: libpython3.8 (>= 3.8.0~a1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have tried many more things without any results so I was wondering what my options are.

Running apt cache policy gbd libpython3.8 produces the output:

gdb:
  Installed: 8.1-0ubuntu3.2
  Candidate: 9.1-0ubuntu1
  Version table:
     9.1-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
 *** 8.1-0ubuntu3.2 100
        100 /var/lib/dpkg/status
libpython3.8:
  Installed: (none)
  Candidate: 3.8.2-1ubuntu1
  Version table:
     3.8.2-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

Best Answer

I had this problem too and this is how i fixed it

Befor all don't forget this two points :

-- 1 -- Do not reboot your PC until you finish all the steps

-- 2 -- Do not forget to update your grub befor rebooting by executing : sudo update-grub2

The problem here is that when you upgrade ubuntu from 18.04 to 20.04 the system did not replace every instance of bionic with focal : it did not replace libpython3.8-stdlib (3.8.2-1+bionic1) by libpython3.8-stdlib (= 3.8.2-1ubuntu1.1) So the solution is to replace it manually :) The steps to do this are :

1 - save the names of the packages that depend on the library in a text file to reinstall them later run : sudo apt-get autoremove libpython3.8-stdlib a message will show you all this packages :

(( apg apparmor apport apport-gtk ...xserver-xorg-video-vmware xwayland yelp yelp-xsl ))

copy them in a text file, then tap " yes " to uninstall the bionic version of libpython3.8-stdlib

2- install the focal version by :

sudo apt-get install libpython3.8-stdlib

3- now install the packages saved in the text file one by one : you can create a screipt file like this : (( ....

sudo apt-get install gir1.2-gck-1
sudo apt-get install gir1.2-gcr-3
sudo apt-get install gir1.2-gdm-1.0
sudo apt-get install gir1.2-geoclue-2.0
sudo apt-get install gir1.2-gnomebluetooth-1.0

... ))

Do not forget to install the ubuntu-desktop if it is not in the package text file sudo apt-get install ubuntu-desktop

4- update your grub , run : sudo update-grub2

5- finally reboot your pc

That's all :)