ablog

不器用で落着きのない技術者のメモ

Jenkins を起動しようとすると "Job for jenkins.service failed because the control process exited with error code" と怒られる

事象

  • AWS で EC2 インスタンスAmazon Linux 2)を作成して、Jenkins を起動しようとすると、"Job for jenkins.service failed because the control process exited with error code. See " と怒られる。
$ sudo systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
  • /var/log/messages を見ると "Starting Jenkins bash: /usr/bin/java: No such file or directory" とメッセージが出ている。
$ sudo less /var/log/messages 
Feb 16 23:24:07 ip-172-31-18-89 jenkins: Starting Jenkins bash: /usr/bin/java: No such file or directory
Feb 16 23:24:07 ip-172-31-18-89 jenkins: [FAILED]
Feb 16 23:24:07 ip-172-31-18-89 systemd: jenkins.service: control process exited, code=exited status=1
Feb 16 23:24:07 ip-172-31-18-89 systemd: Failed to start LSB: Jenkins Automation Server.
Feb 16 23:24:07 ip-172-31-18-89 systemd: Unit jenkins.service entered failed state.
Feb 16 23:24:07 ip-172-31-18-89 systemd: jenkins.service failed.
Feb 16 23:24:27 ip-172-31-18-89 systemd: Starting LSB: Jenkins Automation Server...
Feb 16 23:24:27 ip-172-31-18-89 jenkins: Starting Jenkins bash: /usr/bin/java: No such file or directory ★
Feb 16 23:24:27 ip-172-31-18-89 jenkins: [FAILED]
Feb 16 23:24:27 ip-172-31-18-89 systemd: jenkins.service: control process exited, code=exited status=1
Feb 16 23:24:27 ip-172-31-18-89 systemd: Failed to start LSB: Jenkins Automation Server.
Feb 16 23:24:27 ip-172-31-18-89 systemd: Unit jenkins.service entered failed state.
Feb 16 23:24:27 ip-172-31-18-89 systemd: jenkins.service failed.

解決策

  • OpenJDK 8 か 11 をインストールする。
$ sudo yum -y install java-1.8.0-openjdk-devel.x86_64
  • Jenkins を実行するためには Java 8 か 11 の JRE またま JDK が必要。

Prerequisites
For this tour, you will require:

  • A machine with:
    • 256 MB of RAM, although more than 512MB is recommended
    • 10 GB of drive space (for Jenkins and your Docker image)
  • The following software installed:
Getting started with the Guided Tour