A copy of the C library was found in an unexpected directory

Sorry guys, tech related post.

I had an issue on one of my OpenVZ VMs for a long time that I just never bothered to fix. Today I logged in and took a whirl at fixing it, turns out it was really simple.

I run Debian, and a dist-upgrade on this server would consistently fail to upgrade libc6 with the above error, complaining about libc6 being exactly where it was supposed to be. I found the solution on ServerFault, with thanks to user “holms”

Here is the fix:

cd /lib/x86_64-linux-gnu
mv libc-2.13.so libdl-2.13.so libm-2.13.solibpthread-2.13.so librt-2.13.so /root
LD_PRELOAD=/root/libc-2.13.so:/root/libdl-2.13.so:/root/libm-2.13.so:/root/libpthread-2.13.so:/root/librt-2.13.so bash
apt-get -f dist-upgrade

Once this is done, no further problems should be experienced!

How it works:

Apt/dpkg was failing because it was finding the files in a place it didn’t like them, but simply removing them breaks things. By moving them to /root and then using a variable to tell bash where to find them, things worked while the upgrade happened and the upgrade was happy not seeing the files in /lib/x86_64-linux-gnu. Which also makes me happy!

Leave a Reply