我正在尝试在 Ubuntu 18.04 中安装 Git,但出现错误。这是我使用的命令:
sudo apt install git
显示的错误如下:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
git : Depends: liberror-perl but it is not going to be installed
Depends: git-man (> 1:2.17.1) but it is not going to be installed
Depends: git-man (< 1:2.17.1-.) but it is not going to be installed
Recommends: less but it is not going to be installed
libegl1 : Depends: libglvnd0 (= 1.0.0-2ubuntu2.2) but 1.0.0-2ubuntu2.3 is to be installed
libgles2 : Depends: libglvnd0 (= 1.0.0-2ubuntu2.2) but 1.0.0-2ubuntu2.3 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我尝试过以下命令,但没有帮助。
sudo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
sudo apt-get install -f
以下是sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libegl1 libgles2
The following packages will be upgraded:
libegl1 libgles2
2 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.
Need to get 0 B/44.7 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 ... 102811 files and directories currently installed.)
Preparing to unpack .../libegl1_1.0.0-2ubuntu2.3_arm64.deb ...
Unpacking libegl1:arm64 (1.0.0-2ubuntu2.3) over (1.0.0-2ubuntu2.2) ...
dpkg: error processing archive /var/cache/apt/archives/libegl1_1.0.0-2ubuntu2.3_arm64.deb (--unpack):
trying to overwrite '/usr/lib/aarch64-linux-gnu/libEGL.so.1.0.0', which is also in package rockchip-mali-midgard14 1.6-1
Preparing to unpack .../libgles2_1.0.0-2ubuntu2.3_arm64.deb ...
Unpacking libgles2:arm64 (1.0.0-2ubuntu2.3) over (1.0.0-2ubuntu2.2) ...
dpkg: error processing archive /var/cache/apt/archives/libgles2_1.0.0-2ubuntu2.3_arm64.deb (--unpack):
trying to overwrite '/usr/lib/aarch64-linux-gnu/libGLESv2.so.2.0.0', which is also in package rockchip-mali-midgard14 1.6-1
Errors were encountered while processing:
/var/cache/apt/archives/libegl1_1.0.0-2ubuntu2.3_arm64.deb
/var/cache/apt/archives/libgles2_1.0.0-2ubuntu2.3_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
只需在安装期间覆盖文件:
$> dpkg -i --force-overwrite /var/cache/apt/archives/libegl1_1.0.0-2ubuntu2.3_arm64.deb
$> dpkg -i --force-overwrite /var/cache/apt/archives/libgles2_1.0.0-2ubuntu2.3_arm64.deb
是的,确实存在(在我看来很小的)风险,即之后某些事情可能无法正常运行。