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

Seb*_*ber 3 apt dpkg

我不记得最近在我的电脑上做过什么花哨的事情,但我不能再跑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).
Run Code Online (Sandbox Code Playgroud)
$ 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)
Run Code Online (Sandbox Code Playgroud)
$ 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
Run Code Online (Sandbox Code Playgroud)
$ 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)
Run Code Online (Sandbox Code Playgroud)

有人能告诉我如何解决这个问题吗?我做了一些尝试,但我不知道:(

Byt*_*der 6

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

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

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

sudo apt-get install libnspr4=4.10.10-0ubuntu0.12.04.1
Run Code Online (Sandbox Code Playgroud)

这应该可以解决冲突。


更新:

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

您应该关闭所有正在运行的东西,并且在删除和安装之间不做任何事情,因为我不知道您的哪些应用程序依赖于此,并且在缺少它时可能会崩溃。

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

sudo apt-get autoclean
sudo dpkg --remove --force-depends libnspr4 libnspr4:i386
sudo apt-get install -f
Run Code Online (Sandbox Code Playgroud)

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

sudo apt-get autoclean
sudo apt-get autoremove
Run Code Online (Sandbox Code Playgroud)