![如何解决 apt“无法配置软件包,因为软件包的版本不同”错误?](https://linux22.com/image/1077404/%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3%20apt%E2%80%9C%E6%97%A0%E6%B3%95%E9%85%8D%E7%BD%AE%E8%BD%AF%E4%BB%B6%E5%8C%85%EF%BC%8C%E5%9B%A0%E4%B8%BA%E8%BD%AF%E4%BB%B6%E5%8C%85%E7%9A%84%E7%89%88%E6%9C%AC%E4%B8%8D%E5%90%8C%E2%80%9D%E9%94%99%E8%AF%AF%EF%BC%9F.png)
我说不出是什么让我陷入这样的境地:
→ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: error processing libtiff4 (--configure):
libtiff4:i386 3.9.5-1ubuntu1.1 cannot be configured because libtiff4:k386 is in a different version (3.9.5-1ubuntu1)
Errors were encountered while processing:
libtiff4
E: Sub-process /usr/bin/dpkg returned an error code (1)
以下命令都会导致相同的错误:
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get --fix-broken install
sudo apt-get --fix-missing install
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove
如何解决此类问题?我做错了什么?
更新 我设法通过降级到以前的版本 (3.9.5-1ubuntu1) 让 apt 再次工作。然而,下一次升级导致了同样的问题。但现在有更多信息:
(Reading database ...
dpkg: warning: files list file for package `libtiff4:k386' missing, assuming package has no files currently installed.
(Reading database ... 281166 files and directories currently installed.)
Preparing to replace libtiff4 3.9.5-1ubuntu1 (using .../libtiff4_3.9.5-1ubuntu1.1_i386.deb) ...
Unpacking replacement libtiff4 ...
dpkg: error processing libtiff4 (--configure):
libtiff4:i386 3.9.5-1ubuntu1.1 cannot be configured because libtiff4:k386 is in a different version (3.9.5-1ubuntu1)
No apport report written because MaxReports is reached already
Errors were encountered while processing:
libtiff4
所以真正的问题似乎是缺少libtiff4:k386
包。而且k386
似乎某个地方有一个愚蠢的打字错误。
我找到了导致拼写错误的文件:
**/var/lib/dpkg/status**
Package: libtiff4
Status: install ok half-configured
Multi-Arch: same
Priority: optional
Section: libs
Installed-Size: 528
Maintainer: Ubuntu Developers <[email protected]>
Architecture: k386
Source: tiff
Version: 3.9.5-1ubuntu1
Config-Version: 3.9.5-1ubuntu1
Depends: libc6 (>= 2.11), libjpeg62 (>= 6b1), zlib1g (>= 1:1.1.4)
Pre-Depends: multiarch-support
Description: Tag Image File Format (TIFF) library
libtiff is a library providing support for the Tag Image File Format
(TIFF), a widely used format for storing image data. This package
includes the shared library.
Homepage: http://libtiff.maptools.org
Original-Maintainer: Jay Berkenbilt <[email protected]>
修正拼写错误即可解决问题。
答案1
sudo dpkg -r --force-all <package-name>
sudo apt-get install <package-name>
答案2
通常,我会先删除有问题的软件包,然后再尝试重新安装软件包。更可能的是,你启用了其他提供相同软件包的存储库,这会导致冲突。
如果这不起作用,并且您确定这是来自基础存储库,则可以强制执行 (--force-yes)。但是,只有当您确定所需的软件包不会损害系统的完整性时,才应执行此操作。
答案3
我认为你说的没错,该版本的软件包有一个拼写错误,i386 写成了 :k386。该问题已在当前版本中修复。
我在安装 libtiff4:i386 时遇到了一个稍微不同的问题。我不得不重新安装 libtiff4,然后它才能正常工作。(在从 10.04 升级到 12.04 期间)。