我有一个从软件包中运行的旧版 Jenkins,想更新到最新版本。根据https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-20-04,我执行了:
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
(如https://stackoverflow.com/questions/39621263/jenkins-fails-when-running-service-start-jenkins):
JAVA=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
#JAVA="/usr/lib/jvm/java-8-oracle/jre/bin/java"
但仍然无法启动:
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.
调用status
返回以下内容:
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.
就像在 stackoverflow 问题中提到的那样,journalctl 并没有真正的帮助:
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.
我尝试过su
,jenkins
但是不允许在那里启动 Jenkins:
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.
这似乎是软件包和我的配置的问题,但我找不到其他方法来调试它。是否有已知问题或进一步调试此问题的其他方法?
编辑:这里也出现了类似的问题(https://serverfault.com/questions/1051031/jenkins-installation-fails-on-ubuntu-20-04-with-dpkg-error-processing-package-j),但可以通过更新 Java 来解决这个问题。由于我已经安装了 Java 11 并且可以使用,因此我认为这不是问题所在。