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?

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

  • This answer helped me to solve a problem regarding a Jenkins installation on a Debian Jessie (docker container). Just saying :). – ivanleoncz Jan 19 '18 at 19:31
  • -t is crucial. – fracz Mar 4 '18 at 20:23
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 at 17:53
-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

  • Your answer contains ubuntu xenial but the question is tagged debian – SeinopSys Aug 29 '17 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.