6

I tried to upgrade few packages and then it's failed on libc upgrade. And now it's impossible to upgrade anything at all. here's things I've done:

# apt-get dist-upgrade

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libc6 : Depends: libc-bin (= 2.13-37) but 2.13-38 is installed
E: Unmet dependencies. Try using -f.

root@pagalbadaiktais:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libc6
Suggested packages:
  glibc-doc
The following packages will be upgraded:
  libc6
1 upgraded, 0 newly installed, 0 to remove and 71 not upgraded.
Need to get 4339 kB of archives.
After this operation, 1024 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://ftp.lt.debian.org/debian/ testing/main libc6 amd64 2.13-38 [4339 kB]
Fetched 4339 kB in 0s (30.5 MB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Preconfiguring packages ...
dpkg: warning: files list file for package 'libc6:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'gcc-4.7-base:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liblzma5:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgcc1:amd64' missing; assuming package has no files currently installed
(Reading database ... 26345 files and directories currently installed.)
Preparing to replace libc6:amd64 2.13-37 (using .../libc6_2.13-38_amd64.deb) ...

A copy of the C library was found in an unexpected directory:
  '/lib/x86_64-linux-gnu/libc-2.13.so'
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/x86_64-linux-gnu' and try again.

dpkg: error processing /var/cache/apt/archives/libc6_2.13-38_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/libc6_2.13-38_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've googled for this problem so much.. people who tried to solve this problem, after restarting machine, ended up reinstalling whole disto - which is not an option for me, because this project is quite highly loaded to have a downtime.

Some additional info from irc help:

# dpkg -S /lib/x86_64-linux-gnu/libc-2.13.so
dpkg-query: warning: files list file for package 'libc6:amd64' missing; assuming package has no files currently installed
dpkg-query: warning: files list file for package 'gcc-4.7-base:amd64' missing; assuming package has no files currently installed
dpkg-query: warning: files list file for package 'liblzma5:amd64' missing; assuming package has no files currently installed
dpkg-query: warning: files list file for package 'libgcc1:amd64' missing; assuming package has no files currently installed
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libc-2.13.so
# ls -l /var/lib/dpkg/info/libc*
-rw-r--r-- 1 root root     87 Dec 30 17:36 /var/lib/dpkg/info/libc-bin.conffiles
-rw-r--r-- 1 root root   1790 Mar  8 22:06 /var/lib/dpkg/info/libc-bin.list
-rw-r--r-- 1 root root   2874 Dec 30 17:36 /var/lib/dpkg/info/libc-bin.md5sums
-rwxr-xr-x 1 root root    246 Dec 30 17:36 /var/lib/dpkg/info/libc-bin.postinst
-rw-r--r-- 1 root root     40 Nov 19 01:07 /var/lib/dpkg/info/libc6.conffiles
-rw-r--r-- 1 root root  13341 Feb  1 15:45 /var/lib/dpkg/info/libc6.list
-rw-r--r-- 1 root root  21675 Nov 19 01:07 /var/lib/dpkg/info/libc6.md5sums
-rwxr-xr-x 1 root root  10114 Nov 19 01:07 /var/lib/dpkg/info/libc6.postinst
-rwxr-xr-x 1 root root   1117 Nov 19 01:07 /var/lib/dpkg/info/libc6.postrm
-rwxr-xr-x 1 root root  17327 Nov 19 01:07 /var/lib/dpkg/info/libc6.preinst
-rwxr-xr-x 1 root root   2015 Nov 19 01:07 /var/lib/dpkg/info/libc6.prerm
-rw-r--r-- 1 root root    996 Nov 19 01:07 /var/lib/dpkg/info/libc6.shlibs
-rw-r--r-- 1 root root 106948 Nov 19 01:07 /var/lib/dpkg/info/libc6.symbols
-rw-r--r-- 1 root root  64982 Nov 19 01:07 /var/lib/dpkg/info/libc6.templates
-rw-r--r-- 1 root root    267 Feb  1 15:47 /var/lib/dpkg/info/libcap2:amd64.list
-rw-r--r-- 1 root root    281 Aug 11  2012 /var/lib/dpkg/info/libcap2:amd64.md5sums
-rwxr-xr-x 1 root root    135 Aug 11  2012 /var/lib/dpkg/info/libcap2:amd64.postinst
-rwxr-xr-x 1 root root    132 Aug 11  2012 /var/lib/dpkg/info/libcap2:amd64.postrm
-rw-r--r-- 1 root root     27 Aug 11  2012 /var/lib/dpkg/info/libcap2:amd64.shlibs
-rw-r--r-- 1 root root    338 Feb  1 15:47 /var/lib/dpkg/info/libck-connector0:amd64.list
-rw-r--r-- 1 root root    322 Jul 30  2012 /var/lib/dpkg/info/libck-connector0:amd64.md5sums
-rwxr-xr-x 1 root root    135 Jul 30  2012 /var/lib/dpkg/info/libck-connector0:amd64.postinst
-rwxr-xr-x 1 root root    132 Jul 30  2012 /var/lib/dpkg/info/libck-connector0:amd64.postrm
-rw-r--r-- 1 root root     35 Jul 30  2012 /var/lib/dpkg/info/libck-connector0:amd64.shlibs
-rw-r--r-- 1 root root    350 Jul 30  2012 /var/lib/dpkg/info/libck-connector0:amd64.symbols
-rw-r--r-- 1 root root    395 Feb  1 15:46 /var/lib/dpkg/info/libclass-isa-perl.list
-rw-r--r-- 1 root root    451 Nov 24  2011 /var/lib/dpkg/info/libclass-isa-perl.md5sums
-rw-r--r-- 1 root root    247 Feb  1 15:47 /var/lib/dpkg/info/libcomerr2:amd64.list
-rw-r--r-- 1 root root    221 Jul 31  2012 /var/lib/dpkg/info/libcomerr2:amd64.md5sums
-rwxr-xr-x 1 root root    253 Jul 31  2012 /var/lib/dpkg/info/libcomerr2:amd64.postinst
-rwxr-xr-x 1 root root    247 Jul 31  2012 /var/lib/dpkg/info/libcomerr2:amd64.postrm
-rw-r--r-- 1 root root     82 Jul 31  2012 /var/lib/dpkg/info/libcomerr2:amd64.shlibs
-rw-r--r-- 1 root root    574 Jul 31  2012 /var/lib/dpkg/info/libcomerr2:amd64.symbols
-rw-r--r-- 1 root root   1553 Feb  1 15:46 /var/lib/dpkg/info/libconsole.list
-rw-r--r-- 1 root root   1556 Feb 18  2011 /var/lib/dpkg/info/libconsole.md5sums
-rwxr-xr-x 1 root root    135 Feb 18  2011 /var/lib/dpkg/info/libconsole.postinst
-rwxr-xr-x 1 root root    132 Feb 18  2011 /var/lib/dpkg/info/libconsole.postrm
-rw-r--r-- 1 root root    124 Feb 18  2011 /var/lib/dpkg/info/libconsole.shlibs
-rw-r--r-- 1 root root   3889 Feb  1 15:48 /var/lib/dpkg/info/libcrack2.list
-rw-r--r-- 1 root root   3226 Dec 13 00:00 /var/lib/dpkg/info/libcrack2.md5sums
-rwxr-xr-x 1 root root    135 Dec 13 00:00 /var/lib/dpkg/info/libcrack2.postinst
-rwxr-xr-x 1 root root    132 Dec 13 00:00 /var/lib/dpkg/info/libcrack2.postrm
-rw-r--r-- 1 root root     21 Dec 13 00:00 /var/lib/dpkg/info/libcrack2.shlibs
-rw-r--r-- 1 root root    703 Dec 13 00:00 /var/lib/dpkg/info/libcrack2.symbols
-rw-r--r-- 1 root root    432 Feb  1 15:47 /var/lib/dpkg/info/libcroco3:amd64.list
-rw-r--r-- 1 root root    558 Nov 26 15:53 /var/lib/dpkg/info/libcroco3:amd64.md5sums
-rwxr-xr-x 1 root root    135 Nov 26 15:53 /var/lib/dpkg/info/libcroco3:amd64.postinst
-rwxr-xr-x 1 root root    132 Nov 26 15:53 /var/lib/dpkg/info/libcroco3:amd64.postrm
-rw-r--r-- 1 root root     25 Nov 26 15:53 /var/lib/dpkg/info/libcroco3:amd64.shlibs
-rw-r--r-- 1 root root  15081 Nov 26 15:53 /var/lib/dpkg/info/libcroco3:amd64.symbols
-rw-r--r-- 1 root root    366 Feb  1 15:47 /var/lib/dpkg/info/libcups2:amd64.list
-rw-r--r-- 1 root root    438 Jan 11 11:57 /var/lib/dpkg/info/libcups2:amd64.md5sums
-rwxr-xr-x 1 root root    135 Jan 11 11:55 /var/lib/dpkg/info/libcups2:amd64.postinst
-rwxr-xr-x 1 root root    132 Jan 11 11:55 /var/lib/dpkg/info/libcups2:amd64.postrm
-rw-r--r-- 1 root root     19 Jan 11 11:55 /var/lib/dpkg/info/libcups2:amd64.shlibs
-rw-r--r-- 1 root root  11545 Jan 11 11:55 /var/lib/dpkg/info/libcups2:amd64.symbols
-rw-r--r-- 1 root root    834 Feb  5 12:12 /var/lib/dpkg/info/libcurl3-gnutls:amd64.list
-rw-r--r-- 1 root root   1056 May 25  2012 /var/lib/dpkg/info/libcurl3-gnutls:amd64.md5sums
-rwxr-xr-x 1 root root    135 May 25  2012 /var/lib/dpkg/info/libcurl3-gnutls:amd64.postinst
-rwxr-xr-x 1 root root    132 May 25  2012 /var/lib/dpkg/info/libcurl3-gnutls:amd64.postrm
-rw-r--r-- 1 root root     33 May 25  2012 /var/lib/dpkg/info/libcurl3-gnutls:amd64.shlibs
-rw-r--r-- 1 root root   2390 May 25  2012 /var/lib/dpkg/info/libcurl3-gnutls:amd64.symbols
-rw-r--r-- 1 root root   4336 Feb  1 15:46 /var/lib/dpkg/info/libcwidget3.list
-rw-r--r-- 1 root root   3462 Jun 17  2012 /var/lib/dpkg/info/libcwidget3.md5sums
-rwxr-xr-x 1 root root    135 Jun 17  2012 /var/lib/dpkg/info/libcwidget3.postinst
-rwxr-xr-x 1 root root    132 Jun 17  2012 /var/lib/dpkg/info/libcwidget3.postrm
-rw-r--r-- 1 root root     25 Jun 17  2012 /var/lib/dpkg/info/libcwidget3.shlibs
#  apt-cache policy libc6
libc6:
  Installed: 2.13-37
  Candidate: 2.13-38
  Version table:
     2.13-38 0
        500 http://ftp.lt.debian.org/debian/ testing/main amd64 Packages
 *** 2.13-37 0
        100 /var/lib/dpkg/status

In conclusion from IRC help it's multiarch problem. Would be nice stick to 64bit packages.

holms
  • 1,464
  • 7
  • 20
  • 37
  • Your system is so damaged that it probably _should_ be reinstalled. Even if you get past this, you will run into other issues. – Michael Hampton Mar 09 '13 at 14:27
  • this would be probably the same.. I've even did snapshots for each stage of upgrade this happend after I've upgraded to wheezy so.. would be nice to find somebody who can handle multiarch stuff problems – holms Mar 09 '13 at 14:59
  • Why not move `/lib/x86_64-linux-gnu/libc-2.13.so` to a backup location and try again? Did you try it? Is anything actually using this library? Try something simple like `ldd /bin/ls` and check if it's actually using this library. If not, moving it is worth a try. You can alway revover this lib with a rescue shell. – Alexander Janssen Mar 18 '13 at 22:10

4 Answers4

8

ok probably found a solution.

first of all go here /lib/x86_64-linux-gnu move these files to /root: libc-2.13.so libdl-2.13.so libm-2.13.so libpthread-2.13.so librt-2.13.so

your versions maybe different already. Then lots of things will stop working, you need to launch bash with predefined LD_PRELOAD:

 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

after that dist-upgrade works:

apt-get -f dist-upgrade
holms
  • 1,464
  • 7
  • 20
  • 37
4

First, you do what it told you to do.

A copy of the C library was found in an unexpected directory:
  '/lib/x86_64-linux-gnu/libc-2.13.so'
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/x86_64-linux-gnu' and try again.

Maybe that will fix everything. But you still have enough going on there that you should have a maintenance period and reinstall the system.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • `# apt-get dist-upgrade apt-get: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory` well this killed everything – holms Mar 19 '13 at 09:50
  • ok, in this case the next thing to do is find a creative way to copy the file back in place. What happens if you export LD_LIBRARY_PATH=/where/you/moved/libc.so.6 ? – rackandboneman Mar 20 '13 at 09:07
1

You need to do 2 jobs:

1. apt-get -f dist-upgrade
2. dpkg -a --configure 

Of course repeatation of them is essential.

PersianGulf
  • 596
  • 6
  • 21
0

I would make a copy of the installation in a different location (all of the system directories, with tar or rsync) and will make the attempts to fix in a chrooted environment, until it works and then do the same on the production system.

It is also possible to reinstall the system using debbootstrap and chroot, and this way you'll have very litle downtime if any.

Didi Kohen
  • 121
  • 6