40

Whenever I try to upgrade or install a new package i get the following

ibc6-dbg: Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.1 is installed \
libc6-dev: Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.1 is installed \
           Depends: libc-dev-bin (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.2 is installed
libc6-i386: Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.1 is installed


I've tried apt --fix-broken install
I've tried sudo apt-get -f install to force install.
I get the same error messages in both cases.

I'm still new to Linux and would love to learn how to fix these issues without wiping the os and reinstalling

Danatela
  • 13,384
rtpenick
  • 509

4 Answers4

32

I had similar issue on freshly installed Ubuntu 20.04.2 desktop 64bit, the difference is that libc6 ...9.3 was installed but my packages (g++ build-essential etc) could not be installed beceause libc6-dev could not be installed because it required libc6 ...9.2 which was older then the one installed

 libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.3 is to be installed

So I just downgraded libc6 (and libc-bin too, because it seems very related to me) to version 2.31-0ubuntu9.2 this way:

sudo apt install libc6=2.31-0ubuntu9.2 libc-bin=2.31-0ubuntu9.2

Now my packages could install :) so it seems to work, let's see if we don't have much problems - but I guess not because this is a tiny change in libc (on the other side libc is very important)

BUT I DON'T KNOW WHAT WILL HAPPEN IN THE FUTURE:

  • Will it in future updates hold this package fixed to still old version?
  • Does anyone know how to unfix this version?
  • Even if I could somehow unfix it from this version, then will ubuntu have this issue in the future?
  • Does anyone know if it is some bug in Ubuntu packaging repository? I repeat: this was on a totally fresh Ubuntu 20.04 desktop

Some other places to look for inspiration:

Tomeg
  • 499
6

I would like to add to the answer of Tomeg, that downgrading with aptitude helped me to keep my packages depending on libc6 installed. When downgrading with:

sudo apt install libc6=2.31-0ubuntu9.

apt would also uninstall all my packages depending on libc6.

The following packages will be DOWNGRADED:
  libc6
0 upgraded, 0 newly installed, 1 downgraded, 206 to remove and 0 not upgraded.

As I described here this did help since aptitude offered me different options:

 sudo aptitude install libc6=2.31-0ubuntu9.2

I had to decline the first two options (2x n) and then the third was to solely downgrade (y) without uninstalling other packages.

fbpolar
  • 361
0

Apart from reinstalling a specific version of libc, you may need to check out the apt sources file in /etc/apt/sources.list and see whether the apt source matches your Ubuntu OS version. If the versions don't match, you need to replace the sources.list code name with the right code name of Ubuntu, update apt source, then reinstall libc or gcc.

Artur Meinild
  • 31,035
Li ST
  • 11
0

These instructions helped me. You know you need to fix the package dependency for libc6 so:

  1. Find available versions for libc6:

    apt show -a libc6
    
  2. From the list you see after running the above command install a version (the one you need). For example, if you want version 2.31-0ubuntu9.7, run:

    sudo apt install libc6="2.31-0ubuntu9.7"  
    
  3. Now run:

    sudo apt install build-essential