37

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,243
  • 11
  • 45
  • 72
rtpenick
  • 471
  • 1
  • 4
  • 3
  • 1
    Please edit your question to show the complete output of sudo apt update and then of sudo apt upgrade – user535733 Feb 12 '21 at 17:50
  • 2
    As user535733 has said; you likely had warnings in your sudo apt update output, OR it provides clues as to a problem. A quick scan of the packages expected and I see 9.2 matching your =9.2 for libc6-dbg, so it could be the source isn't showing or error in sudo apt update, or your used mirror isn't up-to-date and needs checking (you start with sudo apt update detail as you update your software lists on your hardware) etc... – guiverc Feb 12 '21 at 21:58

4 Answers4

31

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
  • 449
  • 1
    Man, you nailed it. Thanks! – Alex Savenko Jun 18 '21 at 11:34
  • 3
    can you please file a bug on launchpad? I had a similar issue. got too much invested in setup now to potentially break - it seems like a wrong dependency declaration in packages - UPDATE : https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1926918 seems this is tracked. – Vincent Gerris Jun 24 '21 at 17:56
  • 2
    I am really not happy doing this but it works for now. – peterretief Nov 18 '21 at 17:56
  • thanks!, I had this issue when using the system76 driver ppa. apt-cache policy linux-libc-dev showed a non ubuntu version of this package vendored by system67 that declared incompatability with linux-libc-dev:i386 maybe wrong, anyway, the policy output gave me what version to downgrade to – ThorSummoner Mar 12 '23 at 03:13
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.

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
  • 26,018
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