tl;dr:每个apt-get
命令都会因为这个原因失败:
Depends: libgl1-mesa-dri (= 10.5~git1411191810.9460cd~gd~u) but 10.4~git1411171930.920f87~gd~u is to be installed
我无法删除或安装任何内容。我该怎么办?
很长的故事:
我正在使用 Ubuntu 14.10,昨天我尝试按照本手册进行操作:https://github.com/MobileChromeApps/mobile-chrome-apps/blob/master/docs/Installation.md
最后把事情搞砸了。我在任务栏上的时钟旁边看到一个停止标志,上面写着“请运行包管理器”和“包有未满足的依赖关系”
sudo apt-get upgrade
停止工作(update
但似乎还在工作)。
我试图删除软件包但sudo apt-get remove
停止了工作,这是我收到的错误:
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:
libegl1-mesa : Depends: libgl1-mesa-dri (=10.5~git1411191810.9460cd~gd~u) but 10.4~git1411171930.920f87~gd~u is to be installed
libgbm1 : Depends: libgl1-mesa-dri (= 10.5~git1411191810.9460cd~gd~u) but 10.4~git1411171930.920f87~gd~u is to be installed
libgl1-mesa-glx : Depends: libgl1-mesa-dri (= 10.5~git1411191810.9460cd~gd~u) but 10.4~git1411171930.920f87~gd~u is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
运行sudo apt-get insall -f
结果如下:
libegl1-mesa : Depends: libgl1-mesa-dri (= 10.5~git1411191810.9460cd~gd~u) but 10.4~git1411171930.920f87~gd~u is installed
libgbm1 : Depends: libgl1-mesa-dri (= 10.5~git1411191810.9460cd~gd~u) but 10.4~git1411171930.920f87~gd~u is installed
libgl1-mesa-glx : Depends: libgl1-mesa-dri (= 10.5~git1411191810.9460cd~gd~u) but 10.4~git1411171930.920f87~gd~u is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
使用dpkg
也不起作用:
$ sudo dpkg -r libegl1-mesa
dpkg: dependency problems prevent removal of libegl1-mesa:amd64:
libwayland-egl1-mesa:amd64 depends on libegl1-mesa (= 10.5~git1411191810.9460cd~gd~u).
libgstreamer-plugins-bad1.0-0:amd64 depends on libegl1-mesa (>= 7.8.1) | libegl1-x11; however:
Package libegl1-mesa:amd64 is to be removed.
Package libegl1-x11 is not installed.
Package libegl1-mesa:amd64 which provides libegl1-x11 is to be removed.
libcogl20:amd64 depends on libegl1-mesa (>= 7.8.1) | libegl1-x11; however:
Package libegl1-mesa:amd64 is to be removed.
Package libegl1-x11 is not installed.
Package libegl1-mesa:amd64 which provides libegl1-x11 is to be removed.
libegl1-mesa-drivers:amd64 depends on libegl1-mesa (=> 10.5~git1411191810.9460cd~gd~u).
libqt5gui5:amd64 depends on libegl1-mesa (>= 7.8.1) | libegl1-x11; however:
Package libegl1-mesa:amd64 is to be removed.
Package libegl1-x11 is not installed.
Package libegl1-mesa:amd64 which provides libegl1-x11 is to be removed.
xserver-xorg-core depends on libegl1-mesa | libegl1; ho
dpkg: error processing package libegl1-mesa:amd64 (--remove): dependency problems - not removing Errors were encountered while processing:
libegl1-mesa:amd64
更新:
我以某种方式解决了它,但我并不完全清楚是如何解决的,所以我将描述我所做的一切:
在终端中输入software-properties-gtk
并选中 ubuntu 软件选项卡上的所有复选框,然后转到其他软件,取消选中并删除所有显示“在 utopic 上禁用”的复选框,选中所有对我来说有意义的复选框(chrome dropbox 等),然后执行此操作后sudo apt-get install -f
一切似乎都再次正常工作。
但是,重启后,我看到黑屏,光标闪烁。可能是显卡驱动有问题?
答案1
运行sudo apt-get install --reinstall ubuntu-desktop
解决了所有问题。
答案2
我遇到了类似的问题。libegl1-mesa 软件包的多个部分都缺失了。这导致 apt-get update 无法工作,我无法安装新软件包……真是一场噩梦。我尝试了上述所有方法,以及在恢复模式下启动并运行 dpkg 选项来修复损坏的软件包。但都不起作用。
我最终通过在终端中对上述命令进行一些改动来纠正了这个问题:
sudo apt-get -f install --fix-missing
其次是:
sudo apt-get update
所有这些研究都是为了得到如此简单的解决方案。天哪,我爱 Ubuntu。希望这能有所帮助。
答案3
如错误所示,尝试执行apt-get -f install
以修复未满足的依赖关系。
答案4
我将提供我的解决方案,因为其他方法都不起作用。
1.我不得不检查并删除指向冲突的来源。就我而言,sudo rm /etc/apt/sources.list.d/tuxedo-computers.list
问题已解决。sudo apt update
显然要应用更改。还有其他方法,如下所述:如何删除 PPA?
2. 显示可以安装的版本ETC。
sudo apt-cache policy libgbm1
Installed: 22.3.7-0+tux1
Candidate: 22.3.7-0+tux1
Version table:
*** 22.3.7-0+tux1 100
100 /var/lib/dpkg/status
22.2.5-0ubuntu0.1 500
500 http://ch.archive.ubuntu.com/ubuntu kinetic-updates/main amd64 Packages
22.2.1-1ubuntu1 500
500 http://ch.archive.ubuntu.com/ubuntu kinetic/main amd64 Packages
如您所见,它仍然安装着,但不再位于源列表中。
然后强制安装最新版本。
sudo apt-get -f 重新安装 libgbm1=22.2.5-0ubuntu0.1
和