1

Since 2017, Jenkins dropped support for Java 7 and nowadays, using Java 8.

I'm trying to install Jenkins on a Debian Jessie (docker container), and I'm using the following procedure obtained via this link:

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

In the last step of the procedure, this happened:

$ apt-get install jenkins
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:
 jenkins : Depends: default-jre-headless (>= 2:1.8) but 2:1.7-52 is to be installed or
                java8-runtime-headless but it is not installable
E: Unable to correct problems, you have held broken packages.

I found a solution here:

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

Anyway, I managed to install Jenkins, but when start Jenkins, this happens:

$ sudo /etc/init.d/jenkins start
[FAIL] Starting Jenkins Automation Server: jenkins failed!


$ tail -f /var/log/jenkins/jenkins.log 
Jenkins requires Java8 or later, but you are running 1.7.0_151-b01
from /usr/lib/jvm/java-7-openjdk-amd64/jre
  java.lang.UnsupportedClassVersionError: 51.0
    at Main.main(Main.java:124)

Do I have to install Java 8 to Debian Jessie, for example?

  • Why do you use Debian oldstable and not stable? – Michael Hampton Jan 19 '18 at 22:46
  • I have an application running over the oldstable, which I have to migrate for a host with a stable version. – ivanleoncz Jan 23 '18 at 1:04
2

I found that there were JRE packages that were causing conflicts.

Before:

$ sudo dpkg -l | grep --color 'java\|jdk\|jre'
ii  ca-certificates-java          20161107~bpo8+1            all          Common CA certificates (JKS keystore)
ii  default-jre-headless          2:1.7-52                   amd64        Standard Java or Java compatible Runtime (headless)
ii  java-common                   0.52                       all          Base of all Java packages
ii  libatk-wrapper-java           0.30.5-1                   all          ATK implementation for Java using JNI
ii  libatk-wrapper-java-jni:amd64 0.30.5-1                   amd64        ATK implementation for Java using JNI (JNI bindings)
ii  openjdk-7-jre:amd64           7u151-2.6.11-2~deb8u1      amd64        OpenJDK Java runtime, using Hotspot JIT
pi  openjdk-7-jre-headless:amd64  7u151-2.6.11-2~deb8u1      amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-8-jre-headless:amd64  8u131-b11-1~bpo8+1         amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  tzdata-java                   2017c-0+deb8u1             all          time zone and daylight-saving time data for use by java runtimes

Removing Packages:

$ sudo dpkg -P openjdk-7-jre:amd64
(Reading database ... 15248 files and directories currently installed.)
Removing openjdk-7-jre:amd64 (7u151-2.6.11-2~deb8u1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...

$ sudo dpkg -P openjdk-7-jre-headless:amd64
(Reading database ... 15222 files and directories currently installed.)
Removing openjdk-7-jre-headless:amd64 (7u151-2.6.11-2~deb8u1) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
Purging configuration files for openjdk-7-jre-headless:amd64 (7u151-2.6.11-2~deb8u1) ...

After:

$ dpkg -l | grep --color 'java\|jdk\|jre'
ii  ca-certificates-java          20161107~bpo8+1            all          Common CA certificates (JKS keystore)
ii  java-common                   0.52                       all          Base of all Java packages
ii  libatk-wrapper-java           0.30.5-1                   all          ATK implementation for Java using JNI
ii  libatk-wrapper-java-jni:amd64 0.30.5-1                   amd64        ATK implementation for Java using JNI (JNI bindings)
ii  openjdk-8-jre-headless:amd64  8u131-b11-1~bpo8+1         amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  tzdata-java                   2017c-0+deb8u1             all          time zone and daylight-saving time data for use by java runtimes

Starting Jenkins:

$ /etc/init.d/jenkins start
[ ok ] Starting Jenkins Automation Server: jenkins.
$ tail -f /var/log/jenkins/jenkins.log 
Jan 19, 2018 1:22:39 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
Jan 19, 2018 1:22:41 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tools.JDKInstaller
Jan 19, 2018 1:22:41 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished Download metadata. 9,126 ms
Jan 19, 2018 1:22:43 PM hudson.model.UpdateSite updateData
INFO: Obtained the latest update center data file for UpdateSource default
Jan 19, 2018 1:22:43 PM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running

Plus:

By default, Jenkins via localhost (port 8080).

User: admin

Password: cat /var/lib/jenkins/secrets/initialAdminPassword

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.