1

I recently upgraded to Ubuntu 20.04 LTS. After the upgrade, I've seen that GCC is broken. My guess is that my GCC related packages were installed from another PPA. I removed all the extra PPA to my list and I tried to reinstall the unmet dependencies.

Unfortunately, I cannot install or remove a package using apt. I always get a message:

$ sudo apt install --reinstall gcc-10-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 gcc-10-base : Breaks: gcc-10-base:i386 (!= 10-20200411-0ubuntu1) but 10.1.0-2ubuntu1~18.04 is to be installed
 gcc-10-base:i386 : Breaks: gcc-10-base (!= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libatomic1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libcc1-0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libgcc-s1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libgcc1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libgomp1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libitm1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 liblsan0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libquadmath0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libstdc++6 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libtsan0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

How can I force to reinstall dependencies?

didil
  • 181
  • 1
    The version of gcc you have isn't broken. It's merely incompatible. That happens with some PPAs and other non-Ubuntu sources. Best practice is to uninstall that incompatible version of gcc, and install the tested-and-compatible version from the Ubuntu repositories. – user535733 Jul 16 '20 at 13:59
  • I cannot uninstall this version. I always get an "unmet dependencies" error. I looks like the gcc-10-base package has circular dependencies with gcc-10-base:i386... – didil Jul 20 '20 at 10:16
  • This bug report may be of help: https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1873731 . There is a ppa at the end, you can try to add this ppa and then do the reinstall. – turbulence Jul 26 '20 at 13:01

2 Answers2

0

In my case this was related to clang-10. I would recommend to uninstall it and remove it's ppa as it is now provided by default then run something similar to the following:

sudo apt install clang-10/focal libstdc++-9-dev/focal libgcc-9-dev/focal libobjc-9-dev/focal libclang-common-10-dev/focal libclang1-10/focal llvm-10-dev/focal libomp-10-dev/focal gcc-9-base/focal libasan5/focal gcc-9-base/focal chrome-gnome-shell/focal cpp/focal  cpp-9/focal debhelper/focal dh-autoreconf/focal gdm3/focal gnome-control-center/focal gnome-initial-setup/focal gnome-settings-daemon/focal gnome-shell/focal gnome-shell-extension-appindicator/focal gnome-shell-extension-desktop-icons/focal gnome-shell-extension-prefs/focal gnome-shell-extension-ubuntu-dock/focal gnome-tweak-tool/focal gnome-tweaks/focal libtool/focal ubuntu-desktop/focal ubuntu-desktop-minimal/focal ubuntu-session/focal x11-xserver-utils/focal xorg/focal

Basically telling the package manager that yes, you really do want all the focal versions for all these things. I think someone has borked the versioning on these as I get a few downgrade warnings.

If you don't want clang-10 you could try:

sudo apt install libstdc++-9-dev/focal libgcc-9-dev/focal libobjc-9-dev/focal libclang-common-10-dev/focal libomp-10-dev/focal gcc-9-base/focal libasan5/focal gcc-9-base/focal chrome-gnome-shell/focal cpp/focal  cpp-9/focal debhelper/focal dh-autoreconf/focal gdm3/focal gnome-control-center/focal gnome-initial-setup/focal gnome-settings-daemon/focal gnome-shell/focal gnome-shell-extension-appindicator/focal gnome-shell-extension-desktop-icons/focal gnome-shell-extension-prefs/focal gnome-shell-extension-ubuntu-dock/focal gnome-tweak-tool/focal gnome-tweaks/focal libtool/focal ubuntu-desktop/focal ubuntu-desktop-minimal/focal ubuntu-session/focal x11-xserver-utils/focal xorg/focal

But I have not tested the above.

You may need to add additional packages to this line to get it to work, in any case just add the package it's complaining about and /focal to the above line.

Make sure to read the output to make sure apt hasn't decided it needs to remove a bunch of system files. That is why there are so many packages in my example.

0

I fix the problem by using aptitude. It has better experience in computing dependencies. You need to first disable the ubuntu-toolchain-r source, and then update the source and upgrade the packages with aptitude.

There will be multiple suggestions on how to upgrade the packages. Remember to choose the plan of replacing gcc-10-base and related packages with the one from the focal source, or other plans that fits your requirements.