우분투 18.04 젠킨스 설치 에러
"Failed to start LSB: Start Jenkins at boot time." error in installing jenkins to ubuntu 18.04
Ubuntu 18.04 64 bit Server 에서 Jenkins 를 설치하는 과정에서 다음과 같은 에러를 마주쳤습니다.
root@testserver:/tmp# apt install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version (2.155).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up jenkins (2.155) ...
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 2018-12-13 15:36:08 UTC; 12ms ago
Docs: man:systemd-sysv-generator(8)
Process: 2174 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)
Dec 13 15:36:08 testserver systemd[1]: Starting LSB: Start Jenkins at boot time...
Dec 13 15:36:08 testserver jenkins[2174]: Found an incorrect Java version
Dec 13 15:36:08 testserver jenkins[2174]: Java version found:
Dec 13 15:36:08 testserver jenkins[2174]: openjdk version "11.0.1" 2018-10-16
Dec 13 15:36:08 testserver jenkins[2174]: OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-2ubuntu1)
Dec 13 15:36:08 testserver jenkins[2174]: OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-2ubuntu1, mixed mode, sharing)
Dec 13 15:36:08 testserver jenkins[2174]: Aborting
Dec 13 15:36:08 testserver systemd[1]: jenkins.service: Control process exited, code=exited status=1
Dec 13 15:36:08 testserver systemd[1]: jenkins.service: Failed with result 'exit-code'.
Dec 13 15:36:08 testserver 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
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
이 오류에 대해 구글링을 하던 도중 스택오버플로우에서 첫 번째 답변과, 두 번째 답변 을 발견하였습니다.
우분투 18.04 에서는 Java 9 이 기본적으로 설치되어 있고, 젠킨스는 아직 Java 8 을 사용한다는 내용이었습니다.
두 번째 답변에서 해답을 얻고 첫 번째 답변에서 제시된 해결책대로 진행을 하였습니다.
sudo apt install openjdk-8-jre
이렇게 Java 8 을 설치하고, Jenkins init.d(/etc/init.d/jenkins
) 파일을 열어 PATH
설정을 다음과 같이 변경하였습니다.
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/lib/jvm/java-8-openjdk-amd64/bin/
두둥...
그러나 오류는 고쳐지지 않았습니다..
그래서 조금 삽질을 해보니..
root@testserver:/tmp# which java
/usr/bin/java
root@testserver:/tmp# java --version
openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-2ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-2ubuntu1, mixed mode, sharing)
root@testserver:/tmp# ls /usr/lib/jvm/java-8-openjdk-amd64/bin/
java java-rmi.cgi jjs keytool orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200
root@testserver:/tmp#
java
바이너리(또는 링크) 파일이 /usr/bin
의 위치에 있었습니다 ㅠㅠ
다시 /etc/init.d/jenkins
파일을 열어 경로의 순서를 다음처럼 바꾸니 해결되었습니다!
PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:/bin:/usr/bin:/sbin:/usr/sbin:
다른 분들은 이런 삽질 안하시길 ㅠㅠ