jenkins.service:失败,结果为“退出代码”

jenkins.service:失败,结果为“退出代码”

我正在尝试使用本教程安装 Jenkins:

https://phoenixnap.com/kb/install-jenkins-ubuntu

但我得到:

root@server:~# sudo apt install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version (2.319.2).
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.319.2) ...
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 Sun 2022-01-30 16:41:35 UTC; 16ms ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1457069 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

Jan 30 16:41:35 datalis systemd[1]: Starting LSB: Start Jenkins at boot time...
Jan 30 16:41:35 datalis jenkins[1457069]: Found an incorrect Java version
Jan 30 16:41:35 datalis jenkins[1457069]: Java version found:
Jan 30 16:41:35 datalis jenkins[1457091]: java version "17.0.1" 2021-10-19 LTS
Jan 30 16:41:35 datalis jenkins[1457091]: Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Jan 30 16:41:35 datalis jenkins[1457091]: Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
Jan 30 16:41:35 datalis jenkins[1457069]: Aborting
Jan 30 16:41:35 datalis systemd[1]: jenkins.service: Control process exited, code=exited, status=1/FAILURE
Jan 30 16:41:35 datalis systemd[1]: jenkins.service: Failed with result 'exit-code'.
Jan 30 16:41:35 datalis 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)
root@server:~# ^C
root@server:~#

你知道我该如何解决这个问题吗?

答案1

  1. 使用以下命令从系统中彻底清除/删除 jenkins:

sudo apt-get 删除詹金斯

sudo apt-get remove --自动删除詹金斯

  1. 使用以下命令检查您的机器上是否安装了 Java:

java --version

  1. 如果未安装 Java,请检查您的系统版本并安装必要的 Java 包,例如对于我的 Ubuntu 22.04 LTS,我使用以下命令安装:

sudo apt 安装 openjdk-11-jre-headless

  1. 现在您可以继续并重新安装您的詹金斯:

sudo apt 安装詹金斯

相关内容