我在尝试更新我的 Ubuntu 20.04 系统时突然收到此错误。
The following packages have unmet dependencies:
openjdk-8-jre:i386 : Depends: openjdk-8-jre-headless:i386 (= 8u272-b10-0ubuntu1~20.04) but 8u265-b01-0ubuntu2~20.04 is installed
openjdk-8-jre-headless : Breaks: openjdk-8-jre-headless:i386 (!= 8u272-b10-0ubuntu1~20.04) but 8u265-b01-0ubuntu2~20.04 is installed
openjdk-8-jre-headless:i386 : Breaks: openjdk-8-jre-headless (!= 8u265-b01-0ubuntu2~20.04) but 8u272-b10-0ubuntu1~20.04 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
尝试“apt --fix-broken install”得到以下输出:
Preparing to unpack .../openjdk-8-jre-headless_8u272-b10-0ubuntu1~20.04_i386.deb ...
Unpacking openjdk-8-jre-headless:i386 (8u272-b10-0ubuntu1~20.04) over (8u265-b01-0ubuntu2~20.04) ...
dpkg: error processing archive /var/cache/apt/archives/openjdk-8-jre-headless_8u272-b10-0ubuntu1~20.04_i386.deb (--unpack):
trying to overwrite shared '/etc/java-8-openjdk/security/java.security', which is different from other instances of package openjdk-8-jre-headless:i386
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/openjdk-8-jre-headless_8u272-b10-0ubuntu1~20.04_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我不确定这是什么意思,也不知道该怎么做才能清除这个错误。有什么建议吗?谢谢。
答案1
此问题似乎源于 OpenJDK 与 Oracle 自己的 Focal DEB 发行版之间的冲突,特别是如果您过去曾使用 webupd8 PPA 安装它。我通过强制覆盖解决了这个问题:
sudo apt -o Dpkg::Options::="--force-overwrite" --fix-broken install
你也可以直接使用 dpkg 强制执行,运行
sudo dpkg --configure --force-overwrite -a