uninstall libc6 package by dpkg

I have install "libc6_2.17-0ubuntu5.1_amd64.deb" on my ubuntu server 12.04. The orginal libc6 on system is 2.15. After install the package, I check it by:

ldd --version

it shows:

ldd (Ubuntu EGLIBC 2.15-0ubuntu10.5) 2.15

not change. Then I found I can not install anything which depends on libc6 by apt-get, it will reports:

The following packages have unmet dependencies:
 libc-dev-bin : Depends: libc6 (< 2.16) but 2.17-0ubuntu5.1 is to be installed
 libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.5) but 2.17-0ubuntu5.1 is to be installed
 libnih1 : PreDepends: libc6 (< 2.16) but 2.17-0ubuntu5.1 is to be installed

So I try to uninstall the debian package, first I check:

dpkg -l | grep libc6
ii  libc6            2.17-0ubuntu5.1       Embedded GNU C Library: Shared libraries
ii  libc6-dev        2.15-0ubuntu10.5      Embedded GNU C Library: Development Libraries and Header Files

Then

dpkg -r libc6

It prints a alot of packages which depends on libc6 and tell me:

dpkg: error processing libc6 (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 libc6

It seems it doesn't know there are 2 version libc6 on system.

Use

dpkg --get-selections

gets:

libc6                                           deinstall
libc6-dev                                       install

How should I do?


I have reinstall it by aptitude. It much powerful than apt-get and dpkg, none of them reinstall works.

sudo aptitude reinstall libc6

The following packages will be REINSTALLED:
  libc6 
0 packages upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.5) but 2.17-0ubuntu5.1 is installed.
 libc-dev-bin : Depends: libc6 (< 2.16) but 2.17-0ubuntu5.1 is installed.
 libnih1 : PreDepends: libc6 (< 2.16) but 2.17-0ubuntu5.1 is installed.
E: I wasn't able to locate a file for the libc6 package. This might mean you need to manually fix this package.
The following actions will resolve these dependencies:

     Downgrade the following packages:                                                                     
1)     libc-bin [2.15-0ubuntu10.5 (now, precise-security, precise-updates) -> 2.15-0ubuntu10 (precise)]    
2)     libc-dev-bin [2.15-0ubuntu10.5 (now, precise-security, precise-updates) -> 2.15-0ubuntu10 (precise)]
3)     libc6 [2.17-0ubuntu5.1 (now) -> 2.15-0ubuntu10 (precise)]                                           
4)     libc6-dev [2.15-0ubuntu10.5 (now, precise-security, precise-updates) -> 2.15-0ubuntu10 (precise)]

Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libc-bin libc-dev-bin libc6 libc6-dev 
0 packages upgraded, 0 newly installed, 4 downgraded, 0 to remove and 0 not upgraded.
Need to get 8,852 kB of archives. After unpacking 88.1 kB will be freed.
Do you want to continue? [Y/n/?] y

As aptitude says, there are 4 packages belong to libc6, but I only install one of them by deb file. Maybe that is the reason trash the system


As @jean mentioned you need to downgrade the package to your system's needs:

  1. Check which version on ubuntu you're using
  2. Download the libc6 or related deb packages from this link.
  3. You are gonna install the .deb file you downloaded via terminal using this command: e.g.
sudo dpkg -i --auto-deconfigure '/home/your-system-name/Downloads/libc6_2.30-0ubuntu2_amd64.deb

Similarly, you can type sudo dpkg -i --auto-deconfigure & drag and drop the .deb file then you will get similar as above.**

  1. Then after it has installed, run
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install
  1. You can also use the Synaptic Package Manager to reinstall any missing packages.

You'll be okay. I had to downgrade my libc6-2.30 to libc6-2.28-10 on Zorin OS 15.2 today and it worked.