I've Linux Mint 20.2 Cinnamon and I tried to install jenkins
. Detailed steps for installation is as below:
1. Installing java
- installed via apt
~ > sudo apt install openjdk-8-jdk 12:33:10
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk-headless
x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
Suggested packages:
libice-doc libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-8-demo openjdk-8-source visualvm
The following NEW packages will be installed:
libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk
openjdk-8-jdk-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 14 newly installed, 0 to remove and 1 not upgraded.
Need to get 13.1 MB of archives.
After this operation, 50.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 xorg-sgml-doctools all 1:1.11-1 [12.9 kB]
Get:2 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 x11proto-dev all 2019.2-1ubuntu1 [594 kB]
Get:3 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 x11proto-core-dev all 2019.2-1ubuntu1 [2,620 B]
Get:4 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 libice-dev amd64 2:1.0.10-0ubuntu1 [47.8 kB]
Get:5 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 libpthread-stubs0-dev amd64 0.4-1 [5,384 B]
Get:6 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 libsm-dev amd64 2:1.2.3-1 [17.0 kB]
Get:7 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 libxau-dev amd64 1:1.0.9-0ubuntu1 [9,552 B]
Get:8 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 libxdmcp-dev amd64 1:1.1.3-0ubuntu1 [25.3 kB]
Get:9 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 xtrans-dev all 1.4.0-1 [68.9 kB]
Get:10 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 libxcb1-dev amd64 1.14-2 [80.5 kB]
Get:11 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main amd64 libx11-dev amd64 2:1.6.9-2ubuntu1.2 [647 kB]
Get:12 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 libxt-dev amd64 1:1.1.5-1 [395 kB]
Get:13 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe amd64 openjdk-8-jdk-headless amd64 8u292-b10-0ubuntu1~20.04 [8,287 kB]
Get:14 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe amd64 openjdk-8-jdk amd64 8u292-b10-0ubuntu1~20.04 [2,895 kB]
Fetched 13.1 MB in 5s (2,427 kB/s)
Selecting previously unselected package xorg-sgml-doctools.
(Reading database ... 327380 files and directories currently installed.)
Preparing to unpack .../00-xorg-sgml-doctools_1:1.11-1_all.deb ...
Unpacking xorg-sgml-doctools (1:1.11-1) ...
Selecting previously unselected package x11proto-dev.
Preparing to unpack .../01-x11proto-dev_2019.2-1ubuntu1_all.deb ...
Unpacking x11proto-dev (2019.2-1ubuntu1) ...
Selecting previously unselected package x11proto-core-dev.
Preparing to unpack .../02-x11proto-core-dev_2019.2-1ubuntu1_all.deb ...
Unpacking x11proto-core-dev (2019.2-1ubuntu1) ...
Selecting previously unselected package libice-dev:amd64.
Preparing to unpack .../03-libice-dev_2:1.0.10-0ubuntu1_amd64.deb ...
Unpacking libice-dev:amd64 (2:1.0.10-0ubuntu1) ...
Selecting previously unselected package libpthread-stubs0-dev:amd64.
Preparing to unpack .../04-libpthread-stubs0-dev_0.4-1_amd64.deb ...
Unpacking libpthread-stubs0-dev:amd64 (0.4-1) ...
Selecting previously unselected package libsm-dev:amd64.
Preparing to unpack .../05-libsm-dev_2:1.2.3-1_amd64.deb ...
Unpacking libsm-dev:amd64 (2:1.2.3-1) ...
Selecting previously unselected package libxau-dev:amd64.
Preparing to unpack .../06-libxau-dev_1:1.0.9-0ubuntu1_amd64.deb ...
Unpacking libxau-dev:amd64 (1:1.0.9-0ubuntu1) ...
Selecting previously unselected package libxdmcp-dev:amd64.
Preparing to unpack .../07-libxdmcp-dev_1:1.1.3-0ubuntu1_amd64.deb ...
Unpacking libxdmcp-dev:amd64 (1:1.1.3-0ubuntu1) ...
Selecting previously unselected package xtrans-dev.
Preparing to unpack .../08-xtrans-dev_1.4.0-1_all.deb ...
Unpacking xtrans-dev (1.4.0-1) ...
Selecting previously unselected package libxcb1-dev:amd64.
Preparing to unpack .../09-libxcb1-dev_1.14-2_amd64.deb ...
Unpacking libxcb1-dev:amd64 (1.14-2) ...
Selecting previously unselected package libx11-dev:amd64.
Preparing to unpack .../10-libx11-dev_2:1.6.9-2ubuntu1.2_amd64.deb ...
Unpacking libx11-dev:amd64 (2:1.6.9-2ubuntu1.2) ...
Selecting previously unselected package libxt-dev:amd64.
Preparing to unpack .../11-libxt-dev_1:1.1.5-1_amd64.deb ...
Unpacking libxt-dev:amd64 (1:1.1.5-1) ...
Selecting previously unselected package openjdk-8-jdk-headless:amd64.
Preparing to unpack .../12-openjdk-8-jdk-headless_8u292-b10-0ubuntu1~20.04_amd64.deb ...
Unpacking openjdk-8-jdk-headless:amd64 (8u292-b10-0ubuntu1~20.04) ...
Selecting previously unselected package openjdk-8-jdk:amd64.
Preparing to unpack .../13-openjdk-8-jdk_8u292-b10-0ubuntu1~20.04_amd64.deb ...
Unpacking openjdk-8-jdk:amd64 (8u292-b10-0ubuntu1~20.04) ...
Setting up libpthread-stubs0-dev:amd64 (0.4-1) ...
Setting up xtrans-dev (1.4.0-1) ...
Setting up openjdk-8-jdk-headless:amd64 (8u292-b10-0ubuntu1~20.04) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in aut
o mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javah to provide /usr/bin/javah (javah) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/hsdb to provide /usr/bin/hsdb (hsdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/clhsdb to provide /usr/bin/clhsdb (clhsdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jps to provide /usr/bin/jps (jps) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javap to provide /usr/bin/javap (javap) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jfr to provide /usr/bin/jfr (jfr) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
Setting up xorg-sgml-doctools (1:1.11-1) ...
Setting up openjdk-8-jdk:amd64 (8u292-b10-0ubuntu1~20.04) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in aut
o mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for sgml-base (1.29.1) ...
Setting up x11proto-dev (2019.2-1ubuntu1) ...
Setting up libxau-dev:amd64 (1:1.0.9-0ubuntu1) ...
Setting up libice-dev:amd64 (2:1.0.10-0ubuntu1) ...
Setting up libsm-dev:amd64 (2:1.2.3-1) ...
Setting up libxdmcp-dev:amd64 (1:1.1.3-0ubuntu1) ...
Setting up x11proto-core-dev (2019.2-1ubuntu1) ...
Setting up libxcb1-dev:amd64 (1.14-2) ...
Setting up libx11-dev:amd64 (2:1.6.9-2ubuntu1.2) ...
Setting up libxt-dev:amd64 (1:1.1.5-1) ...
~ > java -version 20s 12:33:58
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17 35-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17 35-Ubuntu-120.04, mixed mode, sharing)
~ > which java 12:34:02
/usr/bin/java
I've also added JAVA_HOME
in ~/.zshrc
which gives:
~ > echo $JAVA_HOME 12:35:54
/usr/bin/java
2. Installing jenkins
~ > wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - 12:36:11
OK
~ > sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' 12:37:00
~ > sudo apt-get update 12:37:11
Hit:1 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal InRelease
Hit:2 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates InRelease
Hit:3 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports InRelease
Ign:4 https://pkg.jenkins.io/debian-stable binary/ InRelease
Get:5 https://pkg.jenkins.io/debian-stable binary/ Release [2,044 B]
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:7 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [833 B]
Hit:8 https://packages.microsoft.com/repos/code stable InRelease
Ign:9 http://packages.linuxmint.com uma InRelease
Hit:10 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:11 http://archive.canonical.com/ubuntu focal InRelease
Hit:12 http://packages.linuxmint.com uma Release
Get:13 https://pkg.jenkins.io/debian-stable binary/ Packages [20.9 kB]
Hit:14 https://download.sublimetext.com apt/stable/ InRelease
Fetched 23.8 kB in 1s (16.4 kB/s)
Reading package lists... Done
~ > sudo apt-get install jenkins 12:37:21
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
daemon
The following NEW packages will be installed:
daemon jenkins
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 71.9 MB/72.0 MB of archives.
After this operation, 72.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.303.3 [71.9 MB]
Fetched 71.9 MB in 41s (1,772 kB/s)
Selecting previously unselected package daemon.
(Reading database ... 328131 files and directories currently installed.)
Preparing to unpack .../daemon_0.6.4-1build2_amd64.deb ...
Unpacking daemon (0.6.4-1build2) ...
Selecting previously unselected package jenkins.
Preparing to unpack .../jenkins_2.303.3_all.deb ...
Unpacking jenkins (2.303.3) ...
Setting up daemon (0.6.4-1build2) ...
Setting up jenkins (2.303.3) ...
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: failed (Result: exit-code) since Thu 2021-11-25 12:38:15 IST; 8ms ago
Docs: man:systemd-sysv-generator(8)
Process: 31110 ExecStart=/etc/init.d/jenkins start (code=exited, status=7)
Nov 25 12:38:13 dPramanik systemd[1]: Starting LSB: Start Jenkins at boot time...
Nov 25 12:38:13 dPramanik jenkins[31110]: Correct java version found
Nov 25 12:38:13 dPramanik jenkins[31110]: * Starting Jenkins Automation Server jenkins
Nov 25 12:38:13 dPramanik su[31171]: (to jenkins) root on none
Nov 25 12:38:13 dPramanik su[31171]: pam_unix(su-l:session): session opened for user jenkins by (uid=0)
Nov 25 12:38:14 dPramanik su[31171]: pam_unix(su-l:session): session closed for user jenkins
Nov 25 12:38:15 dPramanik jenkins[31110]: ...fail!
Nov 25 12:38:15 dPramanik systemd[1]: jenkins.service: Control process exited, code=exited, status=7/NOTRUNNING
Nov 25 12:38:15 dPramanik systemd[1]: jenkins.service: Failed with result 'exit-code'.
Nov 25 12:38:15 dPramanik systemd[1]: Failed to start LSB: Start Jenkins at boot time.
dpkg: error processing package jenkins (--configure):
installed jenkins package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
I've tried with different versions of java, yet the same error. What am I doing wrong? Related solutions that I tried, but failed: [1], [2]
CodePudding user response:
jenkins will work with java 8 on mint 20 and 21. If you have different java versions installed on your system then select the jdk8 as default by
sudo update-alternatives --config java
and then open your jenkins config file
sudo nano /etc/init.d/jenkins
and append your java path to PATH variable
PATH=/usr/bin:/sbin:/usr/sbin:/usr/bin/java
and then restart the service
sudo systemctl restart jenkins
sudo systemctl status jenkins