You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 20.04环境下Jenkins升级后无法启动的问题求助

Ubuntu 20.04环境下Jenkins升级后无法启动的问题求助

我之前通过包管理器运行着一个旧版本的Jenkins,最近想把它升级到最新版。按照相关指引执行了以下升级步骤:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins

升级过程看起来很顺利,但Jenkins却无法启动。我意识到旧版本Jenkins是基于Java 8运行的,而新版本需要Java 11,于是修改了/etc/init.d/jenkins文件里的Java路径:

JAVA=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
#JAVA="/usr/lib/jvm/java-8-oracle/jre/bin/java"

修改完成后尝试启动Jenkins,还是失败了:

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.

我执行了状态查询命令:

sudo systemctl status jenkins.service

得到以下输出:

● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/jenkins.service.d
└─override.conf
Active: failed (Result: exit-code) since Mon 2023-07-17 14:28:24 CEST; 20s ago
Process: 125679 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 125679 (code=exited, status=1/FAILURE)

Jul 17 14:28:24 irpsim.X.de systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 5.
Jul 17 14:28:24 irpsim.X.de systemd[1]: Stopped Jenkins Continuous Integration Server.
Jul 17 14:28:24 irpsim.X.de systemd[1]: jenkins.service: Start request repeated too quickly.
Jul 17 14:28:24 irpsim.X.de systemd[1]: jenkins.service: Failed with result 'exit-code'.
Jul 17 14:28:24 irpsim.X.de systemd[1]: Failed to start Jenkins Continuous Integration Server.

查看journal日志也没找到有效线索:

Jul 17 14:28:24 X.uni-leipzig.de systemd[1]: jenkins.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit jenkins.service has entered the 'failed' state with result 'exit-code'.

Jul 17 14:28:24 X.uni-leipzig.de systemd[1]: Failed to start Jenkins Continuous Integration Server.
-- Subject: A start job for unit jenkins.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit jenkins.service has finished with a failure.
--
-- The job identifier is 48074 and the job result is failed.

我尝试切换到jenkins用户手动启动,但脚本提示只能以root身份运行:

jenkins@irpsim:/home/dgr$ /etc/init.d/jenkins
The jenkins init script can only be run as root
jenkins@irpsim:/home/dgr$ exit
exit
root@irpsim:/home/dgr# /etc/init.d/jenkins start
Starting jenkins (via systemctl): jenkins.serviceJob for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xe" for details.

我感觉这应该是包和我的配置之间存在冲突,但实在找不到其他调试方向了。想问问大家有没有遇到过类似的已知问题,或者有没有进一步排查的方法?

另外补充一下:我看到过类似的问题,不过那个问题是通过升级Java解决的,而我已经安装并配置好了Java 11,所以应该不是Java版本的问题。

备注:内容来源于stack exchange,提问作者David Georg Reichelt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 08:38:02