我一直在尝试更新我的 Ubuntu 机器上的标准软件包。除了我运行的一些 Windows 程序的 VirtualBox 之外,这个机器上几乎没有任何额外的东西。以下是一个输出:
$ sudo apt-get update
[...]
$ sudo apt-get upgrade
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:
libgail-3-0 : Depends: libgtk-3-0 (= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed
libgtk-3-0 : Depends: libgtk-3-common (= 3.6.0-0ubuntu3.1) but 3.6.0-0ubuntu3.2 is installed
libgtk-3-bin : Depends: libgtk-3-0 (>= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed
另一个带有 -f 选项:
$ sudo apt-get -f upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be upgraded:
libgtk-3-0 overlay-scrollbar-gtk3
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
26 not fully installed or removed.
Need to get 0 B/2,397 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 203437 files and directories currently installed.)
Preparing to replace libgtk-3-0:amd64 3.6.0-0ubuntu3.1 (using .../libgtk-3-0_3.6.0-0ubuntu3.2_amd64.deb) ...
Unpacking replacement libgtk-3-0:amd64 ...
dpkg: error processing /var/cache/apt/archives/libgtk-3-0_3.6.0-0ubuntu3.2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules', which is also in package ibus-gtk3:amd64 1.4.1-7ubuntu1
Preparing to replace overlay-scrollbar-gtk3:amd64 0.2.16+r357-0ubuntu1 (using .../overlay-scrollbar-gtk3_0.2.16+r357-0ubuntu1.1_amd64.deb) ...
Unpacking replacement overlay-scrollbar-gtk3:amd64 ...
dpkg: error processing /var/cache/apt/archives/overlay-scrollbar-gtk3_0.2.16+r357-0ubuntu1.1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/gtk-3.0/modules', which is also in package libcanberra-gtk3-module:amd64 0.29-0ubuntu2
Errors were encountered while processing:
/var/cache/apt/archives/libgtk-3-0_3.6.0-0ubuntu3.2_amd64.deb
/var/cache/apt/archives/overlay-scrollbar-gtk3_0.2.16+r357-0ubuntu1.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
apt-cache policy
以下是所有相关包的输出:pastebin d3YcjPmJ。一切似乎都来自官方quantal
发布quantal-updates
渠道和官方镜像。
我也尝试过sudo apt-get -f install
,sudo apt-get dist-upgrade
和sudo apt-get clean && sudo rm -r /var/cache/apt/archives/
,但都导致同样的错误。
答案1
好的,如果您仍然遇到这个问题,这是因为如果同行的版本不一样,某些包将无法工作。
libgail-3-0 : Depends: libgtk-3-0 (= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed
libgtk-3-0 : Depends: libgtk-3-common (= 3.6.0-0ubuntu3.1) but 3.6.0-0ubuntu3.2 is installed
libgtk-3-bin : Depends: libgtk-3-0 (>= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed
如您所见,libgail-3-0 需要 libgtk-3-0 为 3.6.0-0ubuntu3。2但是 libgtk-3-0 要求 libgtk-3-common 为 3.6.0-0ubuntu3。1.1 版本的差异。因此,由于 libgtk-family 不能是不同的版本,因此 apt-get 会收到预期的依赖性错误。那么如何解决这个问题呢?我们使用hold
包状态:
echo "libgtk-3-bin hold" | sudo dpkg --set-selections
echo "libgtk-3-0 hold" | sudo dpkg --set-selections
这样,您可以正常升级,直到 Ubuntu 存储库中的依赖冲突得到解决。
一旦您觉得可以允许升级,只需运行:
echo "libgtk-3-bin install" | sudo dpkg --set-selections
echo "libgtk-3-0 install" | sudo dpkg --set-selections
另一个选择是强制安装版本:
sudo apt-get update
sudo apt-get install libgtk-3-0=3.6.0-0ubuntu3.1 libgtk-3-common=3.6.0-0ubuntu3.1 libgtk-3-0=3.6.0-0ubuntu3.1
这将告诉 apt-get 使用相同的版本号安装所有内容。
答案2
对于仍有这些问题的人来说。
我认为它们出现在您手动删除一些软件包但没有清除它们留下的所有垃圾时。就我而言,我libgtk
仍然安装了它,而且它是比我想要安装的更新版本。所以它真的不知道如何处理不同版本的库。
删除libgtk-3-0
和其他有类似问题的软件包后,一切都正常了。
PS. 请注意,如果您已经完成
echo "libgtk-3-0 hold" | sudo dpkg --set-selections
,那么您必须这样做
echo "libgtk-3-0 install" | sudo dpkg --set-selections
才能删除此包。