无法在 Debian Jessie 上安装 openjdk-8-jre-headless

无法在 Debian Jessie 上安装 openjdk-8-jre-headless

这个星期五,当我运行时,我发现有 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,我的用户也没有搜索功能。发生了什么事?我该如何解决这个问题?

答案1

这对我有用:

apt install -t jessie-backports  openjdk-8-jre-headless ca-certificates-java

参考:https://unix.stackexchange.com/questions/342403/openjdk-8-jre-headless-depends-ca-certificates-java-but-it-is-not-going-to-be

答案2

  1. 首先您需要添加jessie-backportsrepo。

    echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
    
  2. 安装命令

    sudo apt-get update
    sudo apt-get install -t jessie-backports openjdk-8-jre-headless
    
  3. 切换到新的 Java

    sudo /usr/sbin/update-java-alternatives -s java-1.8.0-openjdk-amd64
    

参考: https://github.com/OpenTreeOfLife/germinator/wiki/Debian-upgrade-notes:-jessie-and-openjdk-8

答案3

我在 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

答案4

这对我有用

apt-get install software-properties-common
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main"
apt-get update
apt-get install oracle-java8-installer

指导

相关内容