29

This Friday I saw that I had 2 held back packages for some reason when I ran apt-get upgrade, so naturally I did what any inexperienced sysadmin would do and uninstalled the packages in the hopes that I could simply re-install them and the problem would be solved.

Little did I know, I just made the situation worse. When I tried to reinstall openjdk-8-jre-headless, I got this:

$ 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.

I tried to upgrade the mentioned package manually, but to no avail.

$ 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.

Looking around I saw no mention of a solution to this exact error anywhere.

I use ElasticSearch on the server, which I restarted, but I should've expected that it wouldn't start up at this point. So now I'm without Java and my users are without search. What is going on and how can I fix this?

SeinopSys
  • 512
  • 2
  • 6
  • 19

4 Answers4

35

This worked for me:

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

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

Jason
  • 3,821
  • 17
  • 65
  • 106
22
  1. First you need to add jessie-backports repo.

    echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
    
  2. install commands

    sudo apt-get update
    sudo apt-get install -t jessie-backports openjdk-8-jre-headless
    
  3. switch to new java

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

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

  • I think you want `--jre-headless` for `/usr/sbin/update-java-alternatives` so you don't try to update things like appletviewer that are missing from headless. – MSalters Jan 22 '19 at 17:53
4

I had this problem on Debian Buster, which also doesn't have this package. Since none of the answers on this page worked for me, and the accepted answer led me to another SE answer which I also could not get to work, I just wanted to post what did work for me on Buster.

Following the instructions on the debian website, I added the following line to /etc/apt/sources.list:

deb http://security.debian.org/debian-security stretch/updates main

I was then able to sudo apt update and sudo apt install openjdk-8-jre-headless.

mttpgn
  • 141
  • 3
-1

this works for me

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

guide