这个星期五,我在跑步时看到由于某种原因我有 2 个被保留的软件包apt-get upgrade
,所以我自然而然地做了任何没有经验的系统管理员都会做的事情并卸载了这些软件包,希望我可以简单地重新安装它们并解决问题。
我几乎不知道,我只是让情况变得更糟。当我尝试重新安装openjdk-8-jre-headless
时,我得到了这个:
$ apt-get install openjdk-8-jre-headless
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openjdk-8-jre-headless : Depends: ca-certificates-java but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我尝试手动升级提到的软件包,但无济于事。
$ apt-get upgrade ca-certificates-java
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... ca-certificates-java is already the newest version.
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
环顾四周,我在任何地方都没有提到解决这个确切错误的方法。
我在重新启动的服务器上使用 ElasticSearch,但我应该预料到它此时不会启动。所以现在我没有 Java,我的用户也没有搜索。发生了什么事,我该如何解决?
这对我有用:
参考:https ://unix.stackexchange.com/questions/342403/openjdk-8-jre-headless-depends-ca-certificates-java-but-it-is-not-going-to-be
首先你需要添加
jessie-backports
repo。安装命令
切换到新的Java
参考: https ://github.com/OpenTreeOfLife/germinator/wiki/Debian-upgrade-notes:-jessie-and-openjdk-8
我在 Debian Buster 上遇到了这个问题,它也没有这个包。由于此页面上的所有答案都不适合我,并且接受的答案使我找到了另一个我也无法工作的SE 答案,因此我只想在 Buster 上发布对我有用的内容。
按照debian 网站上的说明,我添加了以下行
/etc/apt/sources.list
:deb http://security.debian.org/debian-security stretch/updates main
然后我能够
sudo apt update
和sudo apt install openjdk-8-jre-headless
。这对我有用
指导