Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to update a system of mine, with which I had no problems whatsoever, and ran into problem while executing a aptitude full-upgrade. The update ran through normally till I got this error :

 Preparing to replace libc6 2.13-21 (using .../libc6_2.13-24_amd64.deb) ...

A copy of the C library was found in an unexpected directory:
It is not safe to upgrade the C library in this situation;
please remove that copy of the C library or get it out of
'/lib' and try again.

dpkg: error processing /var/cache/apt/archives/libc6_2.13-24_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
configured to not write apport reports
                                      Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
dpkg: dependency problems prevent configuration of libc6-dev:
 libc6-dev depends on libc6 (= 2.13-24); however:
  Version of libc6 on system is 2.13-21.
dpkg: error processing libc6-dev (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libc6-i386:
 libc6-i386 depends on libc6 (= 2.13-24); however:
  Version of libc6 on system is 2.13-21.
dpkg: error processing libc6-i386 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:

Anytime now that I try to upgrade or install any package I get this error. Any attempts to move files only required more files to be moved. I also couldn't fix with dpkg.

Some Info :

Debian Linux 3.1.0-1-amd64
#dpkg -l | grep libc6
ii  libc6                                2.13-21                       
iU  libc6-dev                            2.13-24                        
iU  libc6-i386                           2.13-24    

Thank you !

share|improve this question
Have you skipped a version of debian? – pjc50 Jan 11 '12 at 16:49
2.13-21 -> 2.13-24 looks like you're upgrading within unstable or testing. /lib/ exists in stable; I think it should have been removed at some point in the upgrade chain. You will probably find that 'dpkg -S' reveals it not to be in any package. Can you confirm that? – Richard Kettlewell Jan 11 '12 at 16:57
@pjc50 No, I just didn't update my system for about 3 weeks – cete3 Jan 14 '12 at 16:55
@RichardKettlewell You are right, the output of the command is "dpkg-query: no path found matching pattern" – cete3 Jan 14 '12 at 16:56
since this is one of the top Google hits for the error message, I'm posting this to tell Knoppix users who encounter this to look here:… – jcomeau_ictx May 14 '13 at 23:27
up vote 1 down vote accepted

Following the comment response...

Start by checking that when you run a program you get a copy of the dynamic linker that does not involve that path. You should see:

$ ldd /bin/ls | grep ld-linux
    /lib64/ (0x00007fc695aef000)

(The hex address may differ.) This file should be a symlink pointing to /lib/x86_64-linux-gnu/ which should not be a symlink and certainly shouldn’t end up at

Assuming this all looks right it should be safe to go ahead and rename /lib/ out of the way (though I would have rescue media to hand nevertheless). Don’t delete it until you’re sure everything’s still OK, in case it turns out that you need to put it back!

You may well find there are complaints about other leftover files, which can be check and dealt with in much the same way.

Obviously this advice is not directly tested!

share|improve this answer

I had this problem. . .finally fixed it by

  1. chroot-ing into the damaged/ stalled system, where I
  2. mv'ed a bunch of's out of lib/i38 into a temp folder in that partitions /root and
  3. creating symlinks to each of these. At this point it became possible to
  4. boot into that partition and then
  5. upgrade as usual. ( The exact list of files does not spring to mind and will anyway probably vary from system to system - it included the GNU-threads lib and some others, each of which raised the dreaded - lib in unexpected location message) After the upgrade the new libs will be in the usual /lib/i386( or your equivalent) and the LSB dependency boot will have created fresh symlinks for you. When satisfied that all is well you can then destroy the temp folder and the .so's moved there earlier. Hope this may help...
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .