13

After upgrading to Ubuntu 16.04, I cannot update my system. After the usual:

apt-get upgrade

I get this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libc-bin (2.23-0ubuntu3) ...
Segmentation fault (core dumped)
/sbin/ldconfig.real: Can't stat /lib/i686-linux-gnu: No such file or directory
/sbin/ldconfig.real: Can't stat /usr/lib/i686-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
Segmentation fault (core dumped)
dpkg: error processing package libc-bin (--configure):
 subprocess installed post-installation script returned error exit status 139
Errors were encountered while processing:
 libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any ideas on how to fix this? apt-get clean and apt-get -f install did nothing.

Molorius
  • 151

7 Answers7

7

If it is in WSL, try (tks lifesaver.codes)

sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/

sudo dpkg --remove --force-remove-reinstreq libc-bin

sudo dpkg --purge libc-bin

sudo apt install libc-bin

sudo mv /tmp/libc-bin.* /var/lib/dpkg/info/

Artur Meinild
  • 26,018
Bigumangaba
  • 71
  • 1
  • 2
  • This fixed the issue for me. – gdf31 Aug 31 '22 at 19:35
  • Didn't work for me running Ubuntu 20.04 LTS in WSL. 2nd and 3rd commands failed saying that libc-bin was protected. What's also unexpected is that I can see those commands in my bash history but not in my terminal when I scrolled back to find the error messages. – MisterSeajay Jun 30 '23 at 09:02
  • @CharlieJoynt this should fix it. for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done; and then follow above steps – abitcode Jul 07 '23 at 20:50
  • Source: https://github.com/microsoft/WSL/issues/4760#issuecomment-716390775 – abitcode Jul 07 '23 at 20:51
5

Here the reason seemed to be a corrupted /var/cache/ldconfig/aux-cache.

The solution was to do (as root):

rm /var/cache/ldconfig/aux-cache

And afterwards execute

/sbin/ldconfig
Zanna
  • 70,465
3

I used to have the same error here, I did the following command:

 sudo apt-get --reinstall install libc-bin

And it worked, it reinstalled the libc-bin package and solved the issue.

Hope it helps

Vitor Abella
  • 7,537
0

I had this problem, it turned out to be limits related. This resolved it:

limit datasize 2000M
0

I had to run sudo rm /var/cache/ldconfig/aux-cache and sudo /sbin/ldconfig.real on WSL Ubuntu 20.04 .

  • I get Aborted (core dumped) running on Ubuntu 20.04 LTS on WSL in Windows 10 and original problem remains, similar to OP. – MisterSeajay Jun 30 '23 at 09:06
0

With rm aux-cache I got:

/lib/x86_64-linux-gnu:
Aborted (core dumped)

and only https://askubuntu.com/a/1411267/1423238 helps:

sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/

sudo dpkg --remove --force-remove-reinstreq libc-bin

sudo dpkg --purge libc-bin

sudo apt install libc-bin

sudo mv /tmp/libc-bin.* /var/lib/dpkg/info/

dragonfly
  • 1
  • 2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Pilot6 Jun 24 '22 at 10:53
  • This looks similar to another answer to this same question, but appears to be missing the first command? UPDATE: I realized that our links are actually to the same place & it was a markdown glitch hiding the first command. – MisterSeajay Jun 30 '23 at 09:08
  • dpkg didn't let me remove this in WLS Ubuntu 22.04 because it was an essential package, so I had to use dpkg --remove and --purge with "--force-depends --force-remove-protected,remove-essential". After that this solution worked otherwise. – DocWeird Mar 27 '24 at 11:33
0

I was getting a similar problem to the OP, albeit with a different error code:

$ sudo apt-get install python3.8
...
Setting up libc-bin (2.31-0ubuntu9.9) ...
Aborted (core dumped)
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
...
/lib/x86_64-linux-gnu:
Aborted (core dumped)
dpkg: error processing package libc-bin (--configure):
 installed libc-bin package post-installation script subprocess returned error exit status 134

After trying many of the other answers to this question, I found further inspiration in the answer to this question on StackOverflow.

I fixed the Can't stat /usr/local/lib/x86_64-linux-gnu error by manually creating the folder:

sudo mkdir /usr/local/lib/x86_64-linux-gnu

I then checked the /lib/x86_64-linux-gnu folder existed:

ll /lib/x86_64-linux-gnu

After which the dpkg command worked:

$ sudo dpkg --configure -a
Setting up libc-bin (2.31-0ubuntu9.9) ...