Why does Jenkins say “This Jenkins instance appears to be offline”

你。 提交于 2019-11-26 19:28:21

问题


I have a fresh install of Jenkins 2.32.2 on Ubuntu. Opened a browser on the instance and get to a page titled Offline, with the message "This Jenkins instance appears to be offline" and offers options to "Configure Proxy" or "Skip Plugin Installation"

The machine clearly isn't offline as I just used the internet connection to do the installation. I also had a previous installation, done exactly the same way, that was working. I removed the previous installation as Pipelines wouldn't work and Google told me it was because of JDK 9. So I removed all the JDK/JRE installations as well as jenkins, fresh installed JDK 8 only, installed Jenkins, and got to here.

Jenkins has worked on this box in the past so what makes it think it is offline?

Update: Found a log file /var/lib/jenkins/logs/tasks/Download metadata.log and it starts with a message FATAL: Connection refused (Connection refused) I would think that indicates that the internet connection is OK, but something else is stopping it getting data?

Update: Based on other research I checked the Update Site in the Plugin Manager. This is listed as http://updates.jenkins-ci.org/update-center.json and, from the command line a wget of this file succeeds. So most definitely not a connection issue. Worked with both http and https, jenkins works with neither.


回答1:


In my case, it has something to do with SSL. I manage to fix it by editing /var/lib/jenkins/hudson.model.UpdateCenter.xml and change url to use http instead of https.

Restart jenkins and reload the website, it no longer shows offline.




回答2:


For macOS users:

Step -1: Edit /Users/Shared/Jenkins/Home/hudson.model.UpdateCenter.xml and change url to use http instead of https.

Step -2: Restart jenkins (for instance by going to http:localhost:8080) and reload the website

Step -3(Optional): If it asks for user and password and if you don't remember creating one; default user is admin and copy the password from

sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

credits - @Alex in this post and @Tuan Pham here and @Joe Walsh for the comment on macOS directory path




回答3:


There is something wrong with the internet connection of update center.I have met the same situation with Jenkins installed on macOS.

You can try to modify the hudson.model.UpdateCenter.xml file.

Jenkins installed with .pkg package on macOS,the file path is:
/Users/Shared/Jenkins/Home/hudson.model.UpdateCenter.xml

Jenkins installed by Homebrew on macOS,the file path is:
/Users/{username}/.jenkins/hudson.model.UpdateCenter.xml

Open the file:

<?xml version='1.1' encoding='UTF-8'?>
<sites>
  <site>
    <id>default</id>
    <url>https://updates.jenkins.io/update-center.json</url>
  </site>
</sites>

You can try to change https://updates.jenkins.io/update-center.json to:

http://updates.jenkins.io/update-center.json

or

// If you are in China or near China area,https and http are both OK.
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/current/update-center.json

And then you can restart Jenkins by:

//loading the URL to restart Jenkins.
http://localhost:8080/restart

or

// Use Homebrew command to restart Jenkins if you installed Jenkins LTS version by Homebrew.  
brew services restart jenkins-lts



回答4:


in my case (macOS), updating jdk to 8 and reinstall jenkins solved the problem.




回答5:


The issue is that for some reason Jenkins doesn't have access to the certificates chain of the Jenkins updates service. On Ubuntu 18.04 I had this issue and the next links and instructions helped me to start Jenkins properly without modifying the default url or using a proxy of some sort.

Installing a new JDK 8(u101+) with JAVA_HOME should do the trick like at:

  • https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-18-04

is making sure that Lets Encrypt certificates are installed and available on the OS/SYSTEM. To test it you can use the instructions at:

  • Does Java support Let's Encrypt certificates?

And to install manually if required the Let's encrypt root chain using the next script:

  • https://gist.github.com/Firefishy/109b0f1a90156f6c933a50fe40aa777e



回答6:


In my case i have changed https to http in URL line of /var/lib/jenkins/hudson.model.UpdateCenter.xml file and restart the jenkins, its start functioning.




回答7:


On MacOS: 10.11.6

Step-1: Go to /Users//.jenkins

Step-2: Open the file: hudson.model.UpdateCenter.xml

Step-3: CHange the value of "default" from "https://xxx" to "http://xxx"




回答8:


I make no claims about this, especially Java related (I personally cannot stand the language), but on my Ubuntu 18.04 L/T, I needed to stand-up a standalone Jenkins instance; So I installed both the Java on which Jenkins appears to be dependent and Jenkins itself

sudo apt install openjdk-8-jdk jenkins

Then I updated the Jenkins defaults

sudo gvim /etc/default/jenkins

... inserting the following at the top of the file - only because editing /etc/init.d/jenkins appeared to serve no purpose as it had no effect whatsoever ...

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/
PATH=$JAVA_HOME:$PATH

Finally, save & quit ... then attempt Jenkins restart

sudo service jenkins restart

HTH - it certainly worked for me :-)




回答9:


For Windows OS, Follow below steps
1. Go to C:\Users*your user name*.jenkins
2. Open the file: hudson.model.UpdateCenter.xml
3. Update the value of "url" from "https://xxx" to "http://xxx"




回答10:


This mostly happens when you are working with company issued PC Windows OS.

Fix :-

click on "Configure Proxy" ask your IT team for specific server and port values that can bypass firewall and give your windows username & password. In this way you can resolve windows firewall and offline Jenkins issue.

I researched a lot over Internet but nowhere the fix is available.

Thanks!




回答11:


Enter this before running Jenkins.

# iptalbes -F

It may be because of the firewall.




回答12:


jenkins_enable="YES"
jenkins_home="/usr/local/jenkins"
jenkins_user="jenkins"
jenkins_args="--webroot=${jenkins_home}/war --httpListenAddress=*.*.*.*  --httpPort=8180"

#jenkins_java_opts="-Djavax.net.ssl.trustStore=/usr/local/jenkins/cacerts -Djava.net.preferIPv6Addresses=true"

#jenkins_java_opts="-Djavax.net.ssl.trustStore=/usr/local/jenkins/cacerts -Djava.net.preferIPv4Addresses=true"


来源:https://stackoverflow.com/questions/42408703/why-does-jenkins-say-this-jenkins-instance-appears-to-be-offline

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!