我正在运行 Ubuntu 14.04 64 位。我的系统托盘中出现错误:
sudo apt-get update
运行正常。
但sudo apt-get upgrade
返回以下内容:
Reading package lists... Done
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:
libqt4-opengl:i386 : Depends: libqtcore4:i386 (= 4:) but 4:4.8.5+git192-g085f851+dfsg-2ubuntu4 is installed
E: Unmet dependencies. Try using -f.
根据建议,我尝试sudo apt-get install -f
修复它。返回了另一个错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libqt4-opengl:i386
The following packages will be upgraded:
libqt4-opengl:i386
1 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
Need to get 0 B/300 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
dpkg: error: parsing file '/var/lib/dpkg/status' near line 24899 package 'libqt4-opengl:i386':
'Depends' field, reference to 'libqtcore4': error in version: nothing after colon in version number
E: Sub-process /usr/bin/dpkg returned an error code (2)
的输出sudo apt-cache policy libqtcore4:i386
为:
libqtcore4:i386:
Installed: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
Candidate: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
Version table:
*** 4:4.8.5+git192-g085f851+dfsg-2ubuntu4 0
500 http://pt.archive.ubuntu.com/ubuntu/ trusty/main i386 Packages
100 /var/lib/dpkg/status
的输出cat -n /var/lib/dpkg/status | sed -n '/Package: libqt4-opengl/,/Depends/p'
为:
24865 Package: libqt4-opengl
24866 Status: install ok installed
24867 Priority: optional
24868 Section: libs
24869 Installed-Size: 1228
24870 Maintainer: Kubuntu Developers <[email protected]>
24871 Architecture: amd64
24872 Multi-Arch: same
24873 Source: qt4-x11
24874 Version: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
24875 Depends: libc6 (>= 2.14), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libqtcore4 (= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4), libqtgui4 (= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4), libstdc++6 (>= 4.1.1), libx11-6, libxrender1
24889 Package: libqt4-opengl
24890 Status: install ok installed
24891 Priority: optional
24892 Section: libs
24893 Installed-Size: 1220
24894 Maintainer: Kubuntu Developers <[email protected]>
24895 Architecture: i386
24896 Multi-Arch: same
24897 Source: qt4-x11
24898 Version: 4:4.8.5+git192-g085f851+dfsg-2ubuntu4
24899 Depends: libc6 (>= 2.4), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libqtcore4 (= 4:), libqtgui4 (= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4), libstdc++6 (>= 4.1.1), libx11-6, libxrender1
我该如何修复此问题?
答案1
执行以下命令:
sudo cp /var/lib/dpkg/status{,.bak}
sudo sed -i '24899s/(= 4:)/(= 4:4.8.5+git192-g085f851+dfsg-2ubuntu4)/' /var/lib/dpkg/status
sudo apt-get install -f
这应该修理它。
解释
sudo apt-get upgrade
从你的和的输出中sudo apt-get install -f
:
The following packages have unmet dependencies:
libqt4-opengl:i386 : Depends: libqtcore4:i386 (= 4:) but 4:4.8.5+git192-g085f851+dfsg-2ubuntu4 is installed
dpkg: error: parsing file '/var/lib/dpkg/status' near line 24899 package 'libqt4-opengl:i386':
'Depends' field, reference to 'libqtcore4': error in version: nothing after colon in version number
libqt4-opengl:i386
需要libqtcore4:i386
安装,但出于某种原因,它正在寻找其版本4:
(查看我请求的输出中的最后一行)。这是一个错误的版本号。我不知道是什么原因导致它这样做,但我们会尝试修复它正在寻找的版本。
根据这一页libqtcore4:i386
,我们可以看到它真正需要的版本是4:4.8.5+git192-g085f851+dfsg-2ubuntu4
(从 的输出中可以看出,您已经安装了该版本apt-cache policy libqtcore4:i386
)。因此,我们可以通过编辑文件/var/lib/dpkg/status
以使其查找正确的版本来修复此问题,然后重试该apt-get
命令。