Jenkins 无法在 linux 中启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10133964/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:45:46  来源:igfitidea点击:

Jenkins failed to start in linux

linuxubuntujenkins

提问by CasualT

go to run jenkins after doing an upgrade, and get the following:

升级后运行 jenkins,得到以下信息:

start jenkins
start: Job failed to start

That's it...nothing shows up in jenkin's log...so it is difficult to debug to say the least. (and it isn't running already, or anything like that).

就是这样...... jenkin 的日志中没有显示任何内容......所以至少可以说很难调试。(而且它还没有运行,或者类似的东西)。

Is there another log somewhere that I should be looking at that would be helpful? (I am assuming answer to this problem will be somewhat iterative, so hopefully someone can start me on a path to debug this)

是否还有其他日志可以帮助我查看?(我假设这个问题的答案会有些迭代,所以希望有人可以让我开始调试这个问题)

采纳答案by CasualT

So, knowing it was a pre-start error allowed me to investigate more deeply.

因此,知道这是一个启动前错误让我能够进行更深入的调查。

Further digging allowed me to figure out that the exact line in the /etc/init/jenkins.conffile was one pointing to the /usr/share/jenkins/bin/maintain-plugins.sh

进一步挖掘让我发现/etc/init/jenkins.conf文件中的确切行是指向/usr/share/jenkins/bin/maintain-plugins.sh

Looking at this location, I found it was not present (ie. no bin directory). This means that jenkins-commonwas no longer installed for some reason...odd indeed...going into apt-getand doing an install of this component again led to the error:

查看此位置,我发现它不存在(即没有 bin 目录)。这意味着jenkins-common由于某种原因不再安装......确实奇怪......再次进入apt-get并安装此组件导致错误:

dpkg error processing /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb ...

having seen this error before and refreshing my memory via google gave the following solution:

之前看到这个错误并通过谷歌刷新我的记忆给出了以下解决方案:

dpkg -i --force-overwrite /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb

This allowed the installation of common to proceed as normal. After this, all I had to do was replace the /usr/share/jenkins/jenkins.warwith my backed up copy (because ubuntu is far behind the latest release version), and I was able to start the server again.

这允许 common 的安装正常进行。在此之后,我所要做的就是/usr/share/jenkins/jenkins.war用我的备份副本替换(因为 ubuntu 远远落后于最新的发布版本),并且我能够再次启动服务器。

I am not exactly sure what caused the problem to begin with, but it was likely during an apt-get upgrade/clean process...and because of the weirdness with jenkins conflicting with jenkins-common, it did not repopulate the /usr/share/jenkinsdirectory properly.

我不确定是什么导致了问题开始,但很可能是在 apt-get 升级/清理过程中......并且由于 jenkins 与 jenkins-common 冲突的奇怪之处,它没有/usr/share/jenkins正确地重新填充目录。

regardless, am glad it is working again. :)

无论如何,很高兴它又可以正常工作了。:)

回答by Alastair Irvine

Instead, you can run the following before the install to properly clean up any conffiles left by the distro version:

相反,您可以在安装之前运行以下命令以正确清理发行版留下的任何配置文件:

sudo apt-get purge jenkins

Then install the correct version.

然后安装正确的版本。

回答by Erik Osterman

The following worked for me:

以下对我有用:

sudo rm /etc/init/jenkins.conf
sudo update-rc.d jenkins defaults
sudo service jenkins start

Then....

然后....

root@core:/# service jenkins start
* Starting Jenkins Continuous Integration Server jenkins                    [ OK ] 

Borrowed from: https://groups.google.com/forum/#!msg/jenkinsci-users/eW_yEWLojFc/tFhb8DKoRHUJ

借用:https://groups.google.com/forum/#!msg/jenkinsci-users/eW_yEWLojFc/ tFhb8DKoRHUJ

回答by Aleks Tkachenko

I went to see the jenkins logs tail -f /var/log/jenkins/jenkins.log

我去看了詹金斯日志 tail -f /var/log/jenkins/jenkins.log

In my case it didn't start because I used incompatible java version. Update and make sure it sees correct java (In my case it should have been opened using JRE 1.7. To check, please use java -versioncommand) and all should work

就我而言,它没有启动,因为我使用了不兼容的 Java 版本。更新并确保它看到正确的 java(在我的情况下,它应该使用 JRE 1.7 打开。要检查,请使用 java -version命令)并且一切都应该可以工作

回答by Aminah Nuraini

I got from this link: https://serverfault.com/questions/710680/jenkins-not-starting-in-ubuntu

我从这个链接得到:https: //serverfault.com/questions/710680/jenkins-not-starting-in-ubuntu

It might be caused by a full disk. To be really sure, try running it manually. Like this: /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1

它可能是由一个完整的磁盘引起的。确实,请尝试手动运行它。像这样: /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1

回答by Hussain KMR Behestee

Ubuntu 18.04 LTS use Java 9 as default java

Ubuntu 18.04 LTS 使用 Java 9 作为默认 java

Jenkins 2.107.2 still use Java 8

Jenkins 2.107.2 仍然使用 Java 8

[Solution]

[解决方案]

Install Java 8 before install Jenkins

在安装 Jenkins 之前安装 Java 8

sudo add-apt-repository ppa:webupd8team/java
sudo apt install oracle-java8-installer
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"
sudo apt install jenkins

See https://stackoverflow.com/a/49937744/900684

https://stackoverflow.com/a/49937744/900684