当前位置: 首页 > 面试题库 >

当运行“服务启动jenkins”时,Jenkins失败

陶淳
2023-03-14
问题内容

我使用以下命令在Cnetos 7上安装了jenkins:

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import http://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins

如官方文档中所述

但是当我运行时:

service start jenkins

我收到以下错误消息:

Starting jenkins (via systemctl):  Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
                                                           [FAILED]

跑步systemctl status jenkins.service给了我这个:

● jenkins.service - LSB: Jenkins Continuous Integration Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins)
   Active: failed (Result: exit-code) since Wed 2016-09-21 16:45:28 BST; 3min 59s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2818 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)

Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.of(JavaVMArguments...04)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.current(JavaVMArgu...92)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.daemonize(Daemon.java:106)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.all(Daemon.java:88)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: ... 6 more
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service: control process exited, code=exited s...s=1
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Failed to start LSB: Jenkins Continuous Integration Server.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Unit jenkins.service entered failed state.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service failed.
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: [FAILED]
Hint: Some lines were ellipsized, use -l to show in full.

跑步journalctl -xe给了我这个:

Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.of(JavaVMArguments.java:
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.current(JavaVMArguments.
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.daemonize(Daemon.java:106)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.all(Daemon.java:88)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: ... 6 more
Sep 21 16:45:28 webstack.local.caplib runuser[2819]: pam_unix(runuser:session): session closed for user jenkin
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service: control process exited, code=exited status=
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Failed to start LSB: Jenkins Continuous Integration Server.
-- Subject: Unit jenkins.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit jenkins.service has failed.
--
-- The result is failed.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Unit jenkins.service entered failed state.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service failed.
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: [FAILED]
Sep 21 16:45:28 webstack.local.caplib polkitd[1392]: Unregistered Authentication Agent for unix-process:2813:8
Sep 21 16:45:28 webstack.local.caplib dhclient[1390]: DHCPREQUEST on eno16777984 to 192.168.15.254 port 67 (xi
Sep 21 16:45:28 webstack.local.caplib dhclient[1390]: DHCPACK from 192.168.15.254 (xid=0x2ab6e6bc)
Sep 21 16:45:30 webstack.local.caplib dhclient[1390]: bound to 192.168.15.120 -- renewal in 865 seconds.
Sep 21 16:45:36 webstack.local.caplib systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Sep 21 16:45:36 webstack.local.caplib systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has finished starting up.
--
-- The start-up result is done.

两者都真的无济于事。如何解决此问题?


问题答案:

在Ubuntu 16.04上类似的问题。

Setting up jenkins (2.72) ...
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; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-08-01 05:39:06 UTC; 7ms ago
Docs: man:systemd-sysv-generator(8)
Process: 3700 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

Aug 01 05:39:06 ip-0 systemd[1]: Starting LSB: Start Jenkins ....
Aug 01 05:39:06 ip-0 jenkins[3700]: ERROR: No Java executable ...
Aug 01 05:39:06 ip-0 jenkins[3700]: If you actually have java ...
Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Control pro...1
Aug 01 05:39:06 ip-0 systemd[1]: Failed to start LSB: Start J....
Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Unit entere....
Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Failed with....

要解决此问题,请手动安装Java Runtime Environment:

JDK版本9:

sudo apt install openjdk-9-jre

JDK版本8:

sudo apt install openjdk-8-jre

打开Jenkins配置文件:

sudo vi /etc/init.d/jenkins

最后,将路径附加到新的Java可执行文件(第16行):

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/lib/jvm/java-8-openjdk-amd64/bin/


 类似资料:
  • Jenkins作为一项windows服务,已经运行了几个月,没有出现任何问题。 我做了一些Jenkins更新(将一个更新的.war文件复制到.Jenkins文件夹),也进行了一些windows更新。我的版本是Jenkins 2.263.3。 我浏览了很多文档和其他StackOverflow票据,发现JENKINS_HOME环境变量缺失。我加了这个。 这是我的调查揭示的。 设置Java环境变量-见下

  • 我正在尝试将我的windows slave作为服务连接到jenkins 2.88。我通过webstart启动了这个奴隶,然后运行jenkins奴隶。exe install来安装服务。第二次运行作业时,从svn中检出内容,我得到以下错误: 该服务正在以“我的用户”身份运行,以使其具有所有必要的权限。简而言之,我的问题是jenkins是否正确支持从服务运行jenkins slave jar的方法。例如

  • 如何在不丢失任何作业或配置的情况下,从作为Linux服务运行的现有jenkins安装更新jenkins?

  • 我的组织需要对我们的定制程度很高的Jenkins实例进行备份。在研究了备份Jenkins的不同方法后,我们决定使用xcopy复制整个Jenkins目录,然后将备份移动到另一台机器上的新实例。(使用xcopy的原因是它是在每个作业中保留符号链接文件的唯一方法。) 以下是我采取的步骤: 批处理文件使用xcopy每晚从旧机器复制整个目录 我在新服务器上安装了一个新的Jenkins实例 我阻止Jenkin

  • 我有两个作业运行在两个不同的Jenkins服务器机器。 工作A= 工作B= 作业B连续365天每15分钟运行一次。现在,当作业A运行时,作业B失败,因为作业A是代码部署。因此,理想情况下,我的作业B应该在作业A运行期间保持,而不是运行。 有人可以帮助任何插件,可以帮助实现这一点或任何脚本以及如何配置它。 简单地说,这两个作业不应该同时运行

  • 问题内容: [症状] 使用官方步骤安装Jenkins,但失败,并显示错误消息 无法启动LSB:在启动时启动Jenkins 。 重现步骤 控制台日志 [环境] Ubuntu 18.04 LTS Beta2 Jenkins2.107.2 问题答案: [根本原因] Ubuntu 18.04 LTS使用Java 9作为默认Java Jenkins 2.107.2仍使用Java 8 [解] 在安装Jenki