[Jenkins] Failed to start Jenkins Continuous Integration Server

Posted 码里法

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Jenkins] Failed to start Jenkins Continuous Integration Server相关的知识,希望对你有一定的参考价值。

问题

如果你在安装Jenkins的时候,总是出现下方的错误,而且配置了jdk路径也无法解决,请参考本文的解决办法:
错误信息:

jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Tue 2022-06-07 17:09:46 CST; 20s ago
  Process: 5706 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
 Main PID: 5706 (code=exited, status=1/FAILURE)

Jun 07 17:09:45 k8s-master systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
Jun 07 17:09:45 k8s-master systemd[1]: Failed to start Jenkins Continuous Integration Server.
Jun 07 17:09:45 k8s-master systemd[1]: Unit jenkins.service entered failed state.
Jun 07 17:09:45 k8s-master systemd[1]: jenkins.service failed.
Jun 07 17:09:46 k8s-master systemd[1]: jenkins.service holdoff time over, scheduling restart.
Jun 07 17:09:46 k8s-master systemd[1]: Stopped Jenkins Continuous Integration Server.
Jun 07 17:09:46 k8s-master systemd[1]: start request repeated too quickly for jenkins.service
Jun 07 17:09:46 k8s-master systemd[1]: Failed to start Jenkins Continuous Integration Server.
Jun 07 17:09:46 k8s-master systemd[1]: Unit jenkins.service entered failed state.
Jun 07 17:09:46 k8s-master systemd[1]: jenkins.service failed.

主要看这里,如果你按照普遍的方法解决不了,那一定是报错信息不一样,Process: 5706 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)

解决办法(一)

首先安装jdk信息,如果你服务器上已经安装了jdk8,那么就执行

 yum install fontconfig java-8-openjdk

可能会出现已经存在或者其他的提示,不用管,也不影响。
接下来完善Jenkins加载到jdk的配置,
两种办法:

  • 方法一

    可以直接在配置文件配置/etc/init.d下的jenkins文件中增加现有jdk的路径:

    记得systemctl daemon-reload一下

  • 方法二
    也可以直接创建软链接,就像windows创建快捷方式一样简单,不用的时候可以删除这个软链接即可。

    ln -s /usr/local/java/jdk1.8.0_291/bin/java /usr/bin/java
    

    随后再次启动Jenkins即可

    systemctl start jenkins
    

解决办法(二)

如果不想卸载,那么你也可以不使用systemctl的方式去启动暂停Jenkins,直接用Jenkins自带的服务启动,其实systemctl最终也是执行的这个命令。

cd /etc/init.d

# 启动
./jenkins start
# 停止
./jenkins stop
# 状态
./jenkins status

解决办法(三)

如果按照上边的方法和网上其他的方法都无法解决,你可以卸载了重新按照官方的步骤坐下来,也是可以的。

好啦,至此,问题解决,还解决不了,那就自求多福吧。

Jenkins连接git时出现“Failed to connect to repository : Command ... HEAD" returned status code 128:”的

网上说的解决方法如下:

其实生成ssh时不应该使用当前用户去生成ssh,而是使用jenkins这个用户去生成ssh,然后再去git服务器上配置你生成key,最后再jenkins上配置返回给你的key。

参考:

http://www.jianshu.com/p/ed0edb93e234

http://stackoverflow.com/questions/21557998/jenkins-failed-to-connect-to-repository

以上是关于[Jenkins] Failed to start Jenkins Continuous Integration Server的主要内容,如果未能解决你的问题,请参考以下文章

Jenkins连接git时出现“Failed to connect to repository : Command ... HEAD" returned status code 128:”的

Jenkins编译过程中出现ERROR_ Failed to parse POMs错误

jenkins 配置ssh remotes 报Failed to authenticate with public key

jenkins在生成html测试报告时总是提示:exists but failed copying to

GTA4运行出现SecuLauncher:failed to start application

Starting zookeeper ... FAILED TO START