由于“未满足依赖关系”,无法再使用“apt-get install”

由于“未满足依赖关系”,无法再使用“apt-get install”

我不记得最近在电脑上做过什么花哨的事情,但我不能apt-get install再运行了

$ sudo apt-get install phantomjs
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:
 libnspr4 : Breaks: libnspr4:i386 (!= 4.10.7-0ubuntu0.12.04.1) but 4.10.10-0ubuntu0.12.04.1 is to be installed
 libnspr4:i386 : Breaks: libnspr4 (!= 4.10.10-0ubuntu0.12.04.1) but 4.10.7-0ubuntu0.12.04.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-83-generic gir1.2-timezonemap-1.0 node-node-uuid linux-image-3.2.0-89-generic realpath efibootmgr diffstat linux-headers-3.2.0-70-generic
  linux-headers-3.2.0-65-generic linux-headers-3.2.0-26-generic libdmraid1.0.0.rc16 libdebconfclient0 linux-headers-3.2.0-91-generic linux-headers-3.2.0-86-generic linux-headers-3.2.0-26
  linux-headers-3.2.0-63 linux-headers-3.2.0-64 linux-headers-3.2.0-70 linux-headers-3.2.0-65 linux-headers-3.2.0-72 linux-headers-3.2.0-67 linux-headers-3.2.0-68 linux-headers-3.2.0-74
  linux-headers-3.2.0-69 linux-headers-3.2.0-80 linux-headers-3.2.0-75 linux-headers-3.2.0-76 linux-headers-3.2.0-77 linux-headers-3.2.0-83 linux-headers-3.2.0-84 linux-headers-3.2.0-79
  linux-headers-3.2.0-90 linux-headers-3.2.0-91 linux-headers-3.2.0-86 linux-headers-3.2.0-87 linux-headers-3.2.0-88 linux-headers-3.2.0-89 linux-headers-3.2.0-68-generic kpartx-boot
  libopts25 libv8-3.7.12.22 linux-headers-3.2.0-89-generic quilt autogen linux-headers-3.2.0-76-generic linux-tools-3.2.0-90 linux-tools-3.2.0-91 linux-tools-3.2.0-89
  linux-headers-3.2.0-63-generic linux-headers-3.2.0-84-generic linux-headers-3.2.0-79-generic kpartx linux-image-3.13.0-63-generic rdate linux-headers-3.13.0-63
  linux-headers-3.2.0-87-generic libssl-dev libdebian-installer4 linux-headers-3.2.0-74-generic linux-headers-3.2.0-69-generic libopts25-dev libssl-doc linux-image-3.2.0-90-generic
  zlib1g-dev apt-clone linux-headers-3.13.0-63-generic linux-headers-3.2.0-77-generic libev4 libv8-dev linux-headers-3.2.0-64-generic libc-ares2 linux-headers-3.2.0-90-generic libev-dev
  linux-headers-3.2.0-72-generic linux-headers-3.2.0-67-generic archdetect-deb dmraid libc-ares-dev python-pyicu linux-headers-3.2.0-88-generic linux-headers-3.2.0-80-generic
  linux-headers-3.2.0-75-generic linux-image-3.2.0-91-generic libllvm3.0:i386
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libnspr4
The following packages will be upgraded:
  libnspr4
1 upgraded, 0 newly installed, 0 to remove and 212 not upgraded.
2 not fully installed or removed.
Need to get 0 B/141 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
dpkg: error processing libnspr4 (--configure):
 libnspr4:amd64 4.10.7-0ubuntu0.12.04.1 cannot be configured because libnspr4:i386 is in a different version (4.10.10-0ubuntu0.12.04.1)
dpkg: error processing libnspr4:i386 (--configure):
 libnspr4:i386 4.10.10-0ubuntu0.12.04.1 cannot be configured because libnspr4:amd64 is in a different version (4.10.7-0ubuntu0.12.04.1)
Errors were encountered while processing:
 libnspr4
 libnspr4:i386
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ apt-cache policy libnspr4 libnspr4:i386
libnspr4:
  Installed: 4.10.7-0ubuntu0.12.04.1
  Candidate: 4.10.10-0ubuntu0.12.04.1
  Version table:
     4.10.10-0ubuntu0.12.04.1 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
 *** 4.10.7-0ubuntu0.12.04.1 0
        100 /var/lib/dpkg/status
     4.8.9-1ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
libnspr4:i386:
  Installed: 4.10.10-0ubuntu0.12.04.1
  Candidate: 4.10.10-0ubuntu0.12.04.1
  Version table:
 *** 4.10.10-0ubuntu0.12.04.1 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main i386 Packages
        100 /var/lib/dpkg/status
     4.8.9-1ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main i386 Packages

$ sudo apt-get install libnspr4=4.10.10-0ubuntu0.12.04.1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  libnspr4
1 upgraded, 0 newly installed, 0 to remove and 140 not upgraded.
5 not fully installed or removed.
Need to get 0 B/141 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: error processing libnspr4 (--configure):
 libnspr4:amd64 4.10.7-0ubuntu0.12.04.1 cannot be configured because libnspr4:i386 is in a different version (4.10.10-0ubuntu0.12.04.1)
dpkg: error processing libnspr4:i386 (--configure):
 libnspr4:i386 4.10.10-0ubuntu0.12.04.1 cannot be configured because libnspr4:amd64 is in a different version (4.10.7-0ubuntu0.12.04.1)
dpkg: dependency problems prevent configuration of libnss3:
 libnss3 depends on libnspr4 (>= 4.8.6); however:
  Package libnspr4 is not configured yet.
dpkg: error processing libnss3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libnss3:i386:
 libnss3:i386 depends on libnspr4 (>= 4.8.6); however:
  Package libnspr4:i386 is not configured yet.
dpkg: error processing libnss3:i386 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libnss3-1d:
 libnss3-1d depends on libnss3 (= 2:3.21-0ubuntu0.12.04.2); however:
 No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                           No apport report written because the error message indicates its a followup error from a previous failure.
                        Package libnss3 is not configured yet.
dpkg: error processing libnss3-1d (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libnspr4
 libnspr4:i386
 libnss3
 libnss3:i386
 libnss3-1d
E: Sub-process /usr/bin/dpkg returned an error code (1)

有人能告诉我如何解决这个问题吗?我尝试过几次,但还是不知道 :(

答案1

您必须确保库的 32 位(libnspr4:i386)和 64 位(libnspr4)版本都存在于同一版本中。

无论出于什么原因(可能只是部分升级或安装了 PPA?),似乎只有一种架构得到了升级,而另一种没有。

64 位版本仍停留在较旧的版本,甚至无法再下载。我们从存储库将其升级到与 32 位版本相同的版本updates/main

sudo apt-get install libnspr4=4.10.10-0ubuntu0.12.04.1

这应该可以解决冲突。


更新:

由于我的第一次尝试没有成功,我们现在要强制删除该包的两个体系结构,同时保留所有依赖于它们的包,然后干净地重新安装它们。

您应该关闭所有正在运行的程序,并且在删除和安装之间不执行任何操作,因为我不知道您的哪些应用程序依赖于它,并且可能会在它丢失时崩溃。

然后按以下顺序运行以下命令:

sudo apt-get autoclean
sudo dpkg --remove --force-depends libnspr4 libnspr4:i386
sudo apt-get install -f

此外,为了保持软件包系统良好运行并释放一些空间,我建议还运行这些命令。它们将从磁盘中删除过时的缓存二进制安装包,并删除不再需要的旧软件包,包括一些旧内核:

sudo apt-get autoclean
sudo apt-get autoremove

答案2

您的问题是,i386 和 amd64 版本的软件包在两种架构中都必须相同,您需要使它们匹配。您可能不想尝试删除这些软件包(这是一个坏主意),而是希望下载并安装它们:

apt-get download libnspr4:amd64 libnspr4:i386
sudo dpkg --force-depends-version -i libnspr4*.deb

这将确保两个软件包的安装都没有依赖性问题,您以后可能需要修复这些问题。

相关内容