3

I am running a VM using Vagrant. When I try to start up (provision) the VM, it keeps giving me the following error:

==> default: The following packages have unmet dependencies:
==> default:  openjdk-8-jdk : Depends: openjdk-8-jre (= 8u141-b15-2~14.04) but it is not going to be installed
==> default:                  Depends: openjdk-8-jdk-headless (= 8u141-b15-2~14.04) but it is not going to be installed
==> default: E: Unable to correct problems, you have held broken packages.
==> default: update-java-alternatives: directory does not exist: /usr/lib/jvm/java-1.8.0-openjdk-amd64
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

What does this mean because I have Java 1.8 on my machine. It is under

/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

which I found by running the command in terminal $ /usr/libexec/java_home -v 1.8

How do I fix this?

  • Same happened here just a few hours ago. `apt-get install -y --force-yes openjdk-8-jdk` resulted the exactly same error on my 2 Ubuntu 14.04 boxes. I'd say wait for `apt-get` to fix it. – Steven Jul 25 '17 at 19:29
  • Same problem for myself, looks like the package is in the middle of building. In-fact looks "stuck" https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+build/13145829 – opdude Jul 26 '17 at 10:10
  • A new amd64 builds has just started. Hopefully this is ready soon, some of the builds seem to take quite a few hours! https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+build/13150022 – amarsuperstar Jul 26 '17 at 10:35
  • 1
    Update: the new builds have been pushed and everything works as normal now – amarsuperstar Jul 26 '17 at 14:06

3 Answers3

2

The problem is not because it is looking in the wrong directory. Vagrant is trying to install OpenJdk8 and for some reason it can't install openjdk dependencies (apt-get problem). I know this because we started to have the same problem 2 hours ago.

TarekZ
  • 19
  • 3
2

We've been having exactly the same problem when running an automated build on AWS using CodeBuild:

The following packages have unmet dependencies:
openjdk-8-jdk : Depends: openjdk-8-jre (= 8u141-b15-2~14.04) but it is not going to be installed
Depends: openjdk-8-jdk-headless (= 8u141-b15-2~14.04) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

This is a snippet from the buildspec.yml we are running:

  - apt-get update
  - apt-get -y install software-properties-common
  - apt-get update
  - add-apt-repository -y ppa:openjdk-r/ppa
  - apt-get update
  - apt-get -y install openjdk-8-jdk
Brian Marsh
  • 577
  • 2
  • 6
  • 19
0

Works as normal now. My guess is the build is pushed automatically and took some time to finish. Now that the build is complete, everything is back as should be.