通过 dpkg 卸载 libc6 包

jea*_*ean 8 linux debian ubuntu

我已经在我的 ubuntu 服务器 12.04 上安装了“libc6_2.17-0ubuntu5.1_amd64.deb”。系统上的原始 libc6 是 2.15。安装软件包后,我通过以下方式检查:

ldd --version
Run Code Online (Sandbox Code Playgroud)

表明:

ldd (Ubuntu EGLIBC 2.15-0ubuntu10.5) 2.15
Run Code Online (Sandbox Code Playgroud)

没变。然后我发现我无法通过 apt-get 安装任何依赖于 libc6 的东西,它会报告:

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
Run Code Online (Sandbox Code Playgroud)

所以我尝试卸载 debian 包,首先我检查:

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
Run Code Online (Sandbox Code Playgroud)

然后

dpkg -r libc6
Run Code Online (Sandbox Code Playgroud)

它打印了很多依赖于 libc6 的包并告诉我:

dpkg: error processing libc6 (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 libc6
Run Code Online (Sandbox Code Playgroud)

似乎不知道系统上有 2 个版本的 libc6。

dpkg --get-selections
Run Code Online (Sandbox Code Playgroud)

得到:

libc6                                           deinstall
libc6-dev                                       install
Run Code Online (Sandbox Code Playgroud)

我应该怎么做?

jea*_*ean 5

我已经通过 aptitude 重新安装了它。它比 apt-get 和 dpkg 强大得多,它们都无法重新安装。

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
Run Code Online (Sandbox Code Playgroud)

正如 aptitude 所说,有 4 个包属于 libc6,但我只通过 deb 文件安装其中一个。也许这就是垃圾系统的原因


小智 5

正如 @jean 提到的,您需要将软件包降级以满足系统的需要:

  1. 检查您使用的 ubuntu 版本
  2. 从此链接下载 libc6 或相关 deb 软件包。
  3. 您将使用以下命令安装通过终端下载的 .deb 文件:例如
sudo dpkg -i --auto-deconfigure '/home/your-system-name/Downloads/libc6_2.30-0ubuntu2_amd64.deb
Run Code Online (Sandbox Code Playgroud)

同样,您可以输入sudo dpkg -i --auto-deconfigure并拖放 .deb 文件,然后您将得到与上面类似的结果。**

  1. 然后安装完成后,运行
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install
Run Code Online (Sandbox Code Playgroud)
  1. 您还可以使用Synaptic 软件包管理器重新安装任何丢失的软件包。

你会没事的。今天,我必须在 Zorin OS 15.2 上将 libc6-2.30 降级为 libc6-2.28-10,结果成功了。