WSL: libc-bin update error

Please use the following bug reporting template to help produce issues which are actionable and reproducible, including all command-line steps necessary to induce the failure condition. Please fill out all the fields! Issues with missing or incomplete issue templates will be closed.

If this is a console issue (a problem with layout, rendering, colors, etc.), please post to the console issue tracker.

Important: Do not open GitHub issues for Windows crashes (BSODs) or security issues. Please direct all Windows crashes and security issues to secure@microsoft.com. Ideally, please configure your machine to capture minidumps, repro the issue, and send the minidump from "C:\Windows\minidump".\

See our contributing instructions for assistance.

Please fill out the below information:

  • Your Windows build number: (Type ver at a Windows Command Prompt) Microsoft Windows [Version 10.0.18363.535]

  • What you’re doing and what’s happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.) sudo apt-get update; sudo apt-get dist-upgrade

  • What’s wrong / what should be happening instead: libc-bin update fails with errors (maybe a Canonical problem, not sure) Only solution I know of at this point is to reset the app and reinstall everything into Ubuntu WSL so I can do apt-get updates in the future.

Copy paste what is on my screen: sudo apt-get dist-upgrade Reading package lists… Done Building dependency tree Reading state information… Done Calculating upgrade… Done The following packages will be upgraded: dmeventd dmsetup libdevmapper-event1.02.1 libdevmapper1.02.1 liblvm2app2.2 liblvm2cmd2.02 lvm2 7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. Need to get 0 B/2191 kB of archives. After this operation, 2048 B of additional disk space will be used. Do you want to continue? [Y/n] y Setting up libc-bin (2.27-3ubuntu1) … Aborted (core dumped) /sbin/ldconfig.real: Can’t stat /usr/local/lib/x86_64-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 /usr/local/lib: /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 Errors were encountered while processing: libc-bin E: Sub-process /usr/bin/dpkg returned an error code (1)

  • Strace of the failing command, if applicable: (If some_command is failing, then run strace -o some_command.strace -f some_command some_args, and link the contents of some_command.strace in a gist here).

  • For WSL launch issues, please collect detailed logs.

Annotation 2019-12-14 184607

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 20
  • Comments: 81

Commits related to this issue

Most upvoted comments

This fix my problem 👍 :+1 if this working for you.

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/

I have recently run into this problem. The solution for my case turns out to be surprisingly easy: for each Can't stat , manually run ls that directory, and then run the same apt again.

To my absolute shock and amazement, this is indeed the solution. Except for one caveat: ls -alh didn’t quite cut it. Instead, this is what worked for me: for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;

This fix my problem 👍 :+1 if this working for you.

Not in my case. I used:

sudo  dpkg --remove --force-remove-reinstreq --force-remove-essential --force-depends libc-bin
sudo dpkg --purge --force-remove-reinstreq --force-remove-essential --force-depends libc-bin
sudo mv /var/lib/dpkg/info/libc6\:amd64.* /tmp/
sudo apt install -f libc-bin
sudo mv /tmp/libc6\:amd64.* /var/lib/dpkg/info/

Faced similar problem on Kali Linux, this helped:

dpkg: warning: ‘ldconfig’ not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable


~# apt download libc-bin
~# dpkg -x libc-bin*.deb unpackdir/
~# cp unpackdir/sbin/ldconfig /sbin/
~# mv /var/lib/dpkg/info/libc6\:amd64.* /tmp/
~# apt install -f libc-bin
~# mv /tmp/libc6\:amd64.* /var/lib/dpkg/info/

This worked for me

for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;
sudo apt install libc-bin -y
sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/
sudo apt install libc-bin -y

It does not stop it from happening but when it does I ruin this little script i found on another post. It allows it to set back up and work. So every time it bonks out i run “fixme” shell script as follows.

#/bin/bash
sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/
sudo dpkg --remove --force-remove-reinstreq libc-bin
sudo dpkg --purge libc-bin
sudo apt -y install libc-bin
sudo mv /tmp/libc-bin.* /var/lib/dpkg/info/

It works for me. Someone a while ago posted it here, it is not my script, I just use it (a lot).

This fix my problem 👍 :+1 if this working for you.

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/

in my win10 20H2 19042 worked

I have recently run into this problem. The solution for my case turns out to be surprisingly easy: for each Can't stat , manually run ls that directory, and then run the same apt again.

I had the issue today.

Could not install anything else because apt is trying to fix the installation of libc-bin. I tried the above instructions, but it failed at the reinstallation of libc-bin, so now there is no more libc, ldconfig, or anything else to get the system working.

I had to completely reinstall the WSL distribution.

This issue should not be closed.

Do you want to continue? [Y/n] y
Setting up libc-bin (2.27-3ubuntu1) ...
Aborted (core dumped)
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-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
/usr/local/lib:
/lib/x86_64-linux-gnu:
Aborted (core dumped)

That fail (particularly the segfault) is all in userspace so there is (unfortunately) no WSL actionable. Standard operating procedure is doing various apt rain dances of questionable efficacy and reinstall when all else fails. Hat tip for the ubuntu forum link above.

Finally I solved this by uninstalling ubuntu of WLS.

I reboot the computer,but the problem just still there

This fix my problem 👍 :+1 if this working for you.

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/

Since it’s buried so far down I’m requoting it - had this issue today randomly on debian testing, this was the only solution that worked!

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.31-0ubuntu9.4) ...
Aborted (core dumped)
/sbin/ldconfig.real: Path `/usr/lib32' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib' given more than once
/usr/lib/x86_64-linux-gnu/libfakeroot:
        libfakeroot-0.so -> libfakeroot-tcp.so
/usr/lib/wsl/lib:
/usr/local/lib:
        libnanosleep.so -> libnanosleep.so
/lib32:
        libutil.so.1 -> libutil-2.31.so
        libthread_db.so.1 -> libthread_db-1.0.so
        libstdc++.so.6 -> libstdc++.so.6.0.28
        libSegFault.so -> libSegFault.so
        librt.so.1 -> librt-2.31.so
        libresolv.so.2 -> libresolv-2.31.so
        libpthread.so.0 -> libpthread-2.31.so
        libpcprofile.so -> libpcprofile.so
        libnss_nisplus.so.2 -> libnss_nisplus-2.31.so
        libnss_nis.so.2 -> libnss_nis-2.31.so
        libnss_hesiod.so.2 -> libnss_hesiod-2.31.so
        libnss_files.so.2 -> libnss_files-2.31.so
        libnss_dns.so.2 -> libnss_dns-2.31.so
        libnss_compat.so.2 -> libnss_compat-2.31.so
        libnsl.so.1 -> libnsl-2.31.so
        libmemusage.so -> libmemusage.so
        libm.so.6 -> libm-2.31.so
        libgcc_s.so.1 -> libgcc_s.so.1
        libdl.so.2 -> libdl-2.31.so
        libc.so.6 -> libc-2.31.so
        libBrokenLocale.so.1 -> libBrokenLocale-2.31.so
        libanl.so.1 -> libanl-2.31.so
/sbin/ldconfig.real: /lib32/ld-2.31.so is the dynamic linker, ignoring

        ld-linux.so.2 -> ld-2.31.so
/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
Errors were encountered while processing:
 libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

As other comments said, try these things:

for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;
sudo apt-get dist-upgrade
sudo apt-get autoremove

all methods above would cause errors below (I only found this problem on wsl ubuntu18 version)

dpkg: error processing package libc-bin (--configure):
 installed libc-bin package post-installation script subprocess returned error exit status 134
Errors were encountered while processing:
 libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

This happened to me after trying to install nmap on WSL. In my case, ldconfig was segfaulting (choking on libpcap) and causing libc-bin to appear broken. I’ll provide my troubleshooting journey since yours will likely be slightly different:

Attempting to run ldconfig yielded the following:

[~/build/libc]$ ldconfig -v
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-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

<... blah blah blah...>

/usr/lib/x86_64-linux-gnu:
[1]    1528 abort (core dumped)  ldconfig -v

Well, OK. Let’s uninstall nmap and try again:

[~]$ sudo apt remove nmap
<... etc ...>
Package 'nmap' is not installed, so not removed

That looks promising. Let’s see which of its dependencies might be naughty:

[~]$ apt show nmap
<... blah blah blah...>
Depends: libc6 (>= 2.15), libgcc1 (>= 1:3.0), liblinear3 (>= 2.01+dfsg), liblua5.3-0, libpcap0.8 (>= 0.9.8), libpcre3, libssl1.1 (>= 1.1.0), libstdc++6 (>= 5.2), zlib1g (>= 1:1.1.4)

Those all look fairly innocuous with the exception of libpcap. Let’s see if it’s dropped anything in that path ldconfig was complaining about:

[~]$ mkdir /tmp/pcap
[~]$ dpkg -x /var/cache/apt/archives/libpcap0.8_1.8.1-6ubuntu1.18.04.1_amd64.deb /tmp/pcap
[~]$ ls /tmp/pcap/usr/lib/x86_64-linux-gnu
libpcap.so.0.8  libpcap.so.1.8.1

Right then. Out they go!

[~]$ sudo rm /usr/lib/x86_64-linux-gnu/libpcap.so.*
[~]$ sudo apt install libc-bin

And all was well. You probably don’t need to reinstall libc-bin unless you (like me) casually delete system files in the process of troubleshooting. Don’t forget to clean up after that partially removed package:

[~]$ sudo apt remove libpcap0.8

tl;dr: Some libs apparently break ldconfig. Manually remove the offending library and clean up the mess. In my case it was libpcap0.8.

This fix my problem 👍 :+1 if this working for you.

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/

It works. Thank you

This worked for me

for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;
sudo apt install libc-bin -y
sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/
sudo apt install libc-bin -y

FINALLY this was the first one out of countless error 134 thanks

I solved this by sudo apt autoremove .

Solved by running:

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

If you encounter the following error:

dpkg: warning: 'ldconfig' not found in PATH or not executable

Then run:

wget http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc-bin_2.27-3ubuntu1.2_amd64.deb
dpkg-deb -R ./libc-bin_2.27-3ubuntu1.2_amd64.deb tmp
 sudo cp tmp/sbin/ldconfig* /sbin

This is ldconfig that dumps core. ldconfig -v and then listing directory (ls) after which core is dumped is a workaround. You might need multiple iterations of ldconfig -v and ls

I have recently run into this problem. The solution for my case turns out to be surprisingly easy: for each Can't stat , manually run ls that directory, and then run the same apt again.

To my absolute shock and amazement, this is indeed the solution. Except for one caveat: ls -alh didn’t quite cut it. Instead, this is what worked for me: for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;

This fixed it, thanks!

it’s fixed on my side by 👍 sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/ sudo apt install libc-bin

I just ran “sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/” and apt-get update subsequently to fix this issue.

Can’t say I understood the issue but went on a limb and did the following that fixed the issue.

ln -s /usr/lib/x86_64-linux-gnu/ /usr/bin/x86_64-linux-gnu

I have recently run into this problem. The solution for my case turns out to be surprisingly easy: for each Can't stat , manually run ls that directory, and then run the same apt again.

To my absolute shock and amazement, this is indeed the solution. Except for one caveat: ls -alh didn’t quite cut it. Instead, this is what worked for me: for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;

Thanks, it worked for me too with WSL1 and Debian 10 on Windows 20H2

Well, it just happened again, and wsl.exe --shutdown did not fix it. For what it’s worth. Why does this happen to me and almost no one else? Is no one else even trying to update their Ubuntu WSL on a regular basis? I imagine they would want to do so, for security fixes if nothing else.

I suspect this is a Canonical problem?

Probably not, narrowly speaking. I imagine the problem, educated guess, applies to any Debian based distro (ubuntu or otherwise). Whatever (scary quote) “the problem” is/was. Once a distro is hooped down at the ldconfig and libc system layer that’s a deep hole to climb out of. It is almost certainly possible to recover without resorting to a reinstall (because anything possible), but likely you would be chasing diminishing returns in the effort. Note you can get the equivalent of a reboot with a wsl.exe --shutdown if you (or anyone else) bangs on it further. You don’t need to resort to the red button. Bonne chance.

This fix my problem 👍 :+1 if this working for you. docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes

https://github.com/docker/buildx/issues/1170#issuecomment-1159350550

On WSL2/Ubuntu 20.04 updating for the first time in like a year; the below let other packages update but left libc-bin as “not fully installed” and apt would try to install libc-bin, and print ldconfig messages and crash “Aborted (core dumped)”, if you try to install anything else or do apt autoremove.

sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/
sudo dpkg --remove --force-remove-reinstreq libc-bin
sudo dpkg --purge libc-bin
sudo apt -y install libc-bin
sudo mv /tmp/libc-bin.* /var/lib/dpkg/info/

Running sudo ldconfig crashed “Aborted (core dumped)”.

Updating ldconfig cache while ignoring /var/cache/ldconfig/aux-cache fixed it for me. (I didn’t have the foresight to backup the binary aux-cache file so it could be attached to a bug report about ldconfig somewhere.) source

Solution:

sudo ldconfig -i

Edit: Actually ignoring/removing aux-cache was mentioned early in the thread.

This fix my problem 👍 :+1 if this working for you.

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/

I have this issue pop up on me every now and then. Just made this a bash script and run it when it happens. Fixes every time. I just have to remember I have that script when it happens lol.

Run “sudo apt-get dist-upgrade” on root user on Ubuntu and it will fix the issue.

Not solving it for me

NAME=“Ubuntu” VERSION=“20.04.2 LTS (Focal Fossa)” ID=ubuntu ID_LIKE=debian PRETTY_NAME=“Ubuntu 20.04.2 LTS” VERSION_ID=“20.04” HOME_URL=“https://www.ubuntu.com/” SUPPORT_URL=“https://help.ubuntu.com/” BUG_REPORT_URL=“https://bugs.launchpad.net/ubuntu/” PRIVACY_POLICY_URL=“https://www.ubuntu.com/legal/terms-and-policies/privacy-policy” VERSION_CODENAME=focal UBUNTU_CODENAME=focal

The following solution fixed my issue:

  1. apt update
  2. apt autoremove libc-bin

Faced similar problem on Kali Linux, this helped:

dpkg: warning: ‘ldconfig’ not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable


~# apt download libc-bin
~# dpkg -x libc-bin*.deb unpackdir/
~# cp unpackdir/sbin/ldconfig /sbin/
~# mv /var/lib/dpkg/info/libc6\:amd64.* /tmp/
~# apt install -f libc-bin
~# mv /tmp/libc6\:amd64.* /var/lib/dpkg/info/

Fixed issue on my WSL2 Ubuntu-20.04

I have recently run into this problem. The solution for my case turns out to be surprisingly easy: for each Can't stat , manually run ls that directory, and then run the same apt again.

To my absolute shock and amazement, this is indeed the solution. Except for one caveat: ls -alh didn’t quite cut it. Instead, this is what worked for me: for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;

This fixed it, thanks!

December 2020, Debian 10 (Buster) on WSL2, this was the only solution that worked for me.

This fix my problem 👍 :+1 if this working for you.

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/

This is not working, as the system is not allowing to remove the libc-bin Getting below error:

dpkg: error processing package libc-bin (–remove): this is an essential package; it should not be removed Errors were encountered while processing: libc-bin

dpkg: error processing package libc-bin (–purge): this is an essential package; it should not be removed Errors were encountered while processing: libc-bin

Try: sudo apt-get --fix-broken install

I have recently run into this problem. The solution for my case turns out to be surprisingly easy: for each Can't stat , manually run ls that directory, and then run the same apt again.

To my absolute shock and amazement, this is indeed the solution. Except for one caveat: ls -alh didn’t quite cut it. Instead, this is what worked for me: for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;

I want to confirm tha this worked for me on Ubuntu-20.04. One note only is that I needed to execute command multiple times (3-4) untill problem was resolved.

Thank you for your help.

Just sudo apt install libc-bin did the trick - problem solved. Thanks! P.S. Removing the package didn’t work - for each I got an error “this is an essential package; it should not be removed”

This fixed it for me (thanks @SkyLeach for the first part):

for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;
sudo rm /etc/ld.so.conf.d/x86_64-linux-gnu.conf
sudo ldconfig -v

Solved by running:

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

If you encounter the following error:

dpkg: warning: 'ldconfig' not found in PATH or not executable

Then run:

wget http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc-bin_2.27-3ubuntu1.2_amd64.deb
dpkg-deb -R ./libc-bin_2.27-3ubuntu1.2_amd64.deb tmp
 sudo cp tmp/sbin/ldconfig* /sbin

This worked for me on WSL2, Ubuntu 20.04… not sure what broke libc, ldconfig was segfaulting

I have recently run into this problem. The solution for my case turns out to be surprisingly easy: for each Can't stat , manually run ls that directory, and then run the same apt again.

To my absolute shock and amazement, this is indeed the solution. Except for one caveat: ls -alh didn’t quite cut it. Instead, this is what worked for me: for PROBDIR in "" "/usr" "/usr/local"; do find "${PROBDIR}/lib/x86_64-linux-gnu" -type f -ls; done;

Worked for me.