47

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.

Simon
  • 481
  • 1
  • 4
  • 5
  • 1
    I had the same promblem, and I had try proxy config, it works! On the same machine a pure http proxy. Still dont know why. – deemstone Mar 29 '17 at 09:48

23 Answers23

68

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.

Alex
  • 1,692
  • 13
  • 10
  • 3
    worked for me. os x file at /Users/Shared/Jenkins/Home/hudson.model.UpdateCenter.xml – Joe Walsh Dec 13 '17 at 15:57
  • 5
    For me on macOS the file was `/Users/you/.jenkins/hudson.model.UpdateCenter.xml`. – weibeld Apr 05 '18 at 16:58
  • 1
    If it doesn't work. Try to install CNTLM which give you local proxy for external proxy and Jenkins can use CNTLM as proxy server. Not my blog, but there is more explanation: http://alakbarv.azurewebsites.net/2017/09/12/jenkins-offline-problem-solved-on-windows/ – jsosnowski May 08 '18 at 08:12
  • @jsosnowski Your link is dead. – code_dredd Jul 06 '18 at 17:07
  • @ray If that link doesn't work, try Internet Archive: https://web.archive.org/web/20171127170229/http://alakbarv.azurewebsites.net/2017/09/12/jenkins-offline-problem-solved-on-windows/ – jsosnowski Jul 09 '18 at 07:28
  • 1
    This is dangerous as it opens you up to all the vulnerabilities of unencrypted/unauthenticated HTTP. @elico's answer is correct that Java doesn't have a certification chain. You can fix this by installing the Oracle JDK or somehow give the default openjdk the certificates it needs. – Drew Stephens Jul 20 '18 at 21:44
  • Works for me in a corporate environment using Zscaler and windows 7 VM running jenkins. – mgouin Oct 02 '18 at 14:15
  • Updating the JDK version to the latest update resolved this. I'm guessing the HTTPS server has a certificate which isn't supported by older JDKs (e.g. lets encrypt) – Shai Almog Aug 22 '19 at 09:55
  • If you are running jenkins using the WAR file, this file is present at ~/.jenkins/hudson.model.UpdateCenter.xml – Bhargav Raju Dec 09 '19 at 11:30
21

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

rak appdev
  • 717
  • 8
  • 21
19

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
ifeegoo
  • 7,054
  • 3
  • 33
  • 38
4

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

mclovin
  • 107
  • 10
  • You don't need to reinstall Jenkins; you can upgrade the JDK and then `kill` the Jenkins process. It will restart automatically. – bonh Jul 17 '18 at 03:10
  • 1
    For me "1.8.0_40" was no good, "1.8.0_181" was good. I've been fooled/forgotten apparently that "Java" on MacOSX was JDK, apparently it's JRE. Ref: https://stackoverflow.com/questions/15624667/mac-osx-java-terminal-version-incorrect – joedragons Oct 12 '18 at 20:59
4

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:

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

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

elico
  • 59
  • 4
  • 1
    I strongly recommend that you summarize the key points here in your response, as link-only answers are frowned upon for many reasons (including, but not limited to, the fact that external links often die out and become unavailable, making once useful answers into useless noise). – code_dredd Jul 09 '18 at 17:22
  • @ray Indeed you are right but this post is not for "dummies". JAVA_HOME is required for JDK or JRE to work properly. On Ubuntu 18.04 which is still in it's "Testing" phase the issue is that the installation doesn't setup the JAVA_HOME variable globally. I am not writing a tutorial but merely pointing to the right direction which by the way **alex** solution wouldn't even touch... In this whole thread I have only seen guesses and nothing related to the real issue so I added a "redirection" towards a more fruitful one. – elico Jul 11 '18 at 17:02
4

I also faced this issue i.e. This Jenkins instance appears to be offline on windows 10.

Below are the steps I followed to solve it:

  1. Navigate to the Jenkins Home Directory. For me, the default home directory is: C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins.jenkins

  2. Changed the protocol from HTTPS to HTTP in the file hudson.model.UpdateCenter.xml

  3. Restarted Jenkins (Go to C:\Program Files\Jenkins and then execute jenkins.exe stop, jenkins.exe start)

  4. Logged in to Jenkins again (http://localhost:8080/).

The offline error got solved.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Mukesh G
  • 51
  • 5
3

In my case i have changed https to http in URL line of /var/lib/jenkins/hudson.model.UpdateCenter.xml file and restarted the jenkins. It started functioning.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
dushyant
  • 349
  • 3
  • 7
2

in case you are running jenkins in a container and vi is not installed access your container in interactive mode

docker exec -it jenkins-ci /bin/bash

use this sed command to replace https with http

sed -i 's/https/http/g' /var/jenkins_home/hudson.model.UpdateCenter.xml 
Terefe
  • 199
  • 2
  • 5
1

On MacOS 10.11.6 :

  1. Go to /Users/<UserName>/.jenkins

  2. Open the file hudson.model.UpdateCenter.xml

  3. Change the value of default from https://xxx to http://xxx

desertnaut
  • 57,590
  • 26
  • 140
  • 166
ArunDhwaj IIITH
  • 3,833
  • 1
  • 24
  • 14
1

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
desertnaut
  • 57,590
  • 26
  • 140
  • 166
1

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!

Mayur Raj
  • 61
  • 5
  • Agree! When I tried installing Jenkins into my personal laptop, this issue does not occur. It will straightaway prompt you to install recommended plugins. For my scenario, I need to install plugins in order to import jobs from another system that's hierarchical in structure. Without the Folders plugin, I cannot do that. As for my workaround, I copied the contents of the plugins folder (inside JENKINS HOME or ProgramData\Jenkins\...) from my personal laptop into my company laptop's Jenkins plugins folder. Luckily, the company laptop's Jenkins recognized these plugins from my personal laptop. – remondo Nov 12 '21 at 15:37
1
  1. Took note of the secret Administrator password path that Jenkins displays when first opening http://localhost:8080/ on a browser.

  2. The path was: C:\Users{username}\AppData\Local\Jenkins.jenkins\secrets. Therefore the hudson.model.UpdateCenter file was at C:\Users{username}\AppData\Local\Jenkins.jenkins\

  3. Updated the hudson.model.UpdateCenter file in notepad to have text http instead of https as follows: http://updates.jenkins.io/update-center.json

  4. Reloaded the http://localhost:8080/ page but still showed the text "This Jenkins instance appears to be offline."

  5. Then navigated to the Services App in Windows (click Windows and type 'Services App' and it should display the App in the search list)

  6. In the services App right clicked the Jenkins service and selected Restart.

  7. After Windows restarted the Jenkins service navigated to http://localhost:8080/ The Jenkins page wouldn't even load. Navigated to the Jenkins login page: http://localhost:8080/login?from=%2F

  8. Then got a loading page with text:'Please wait while Jenkins is getting ready to work ... Your browser will reload automatically when Jenkins is ready.' Assumed that Jenkins was still restarting.

  9. Once the Jenkins login page loaded, entered that password/secret again and clicked Continue.

  10. This time the page with "This Jenkins instance appears to be offline." was not displayed. Jenkins displayed a Getting Started -> Customize Jenkins page with buttons to install plugins.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
1

For Ubuntu, go to /home/username/.Jenkins/Hudson.model.UpdateCenter.xml and edit the file from https to http.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Shekar
  • 165
  • 1
  • 5
0

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 :-)

0

I'm working on a Mac, and in my case, it turned out that the version of Java Jenkins was using (1.8.0u66) wasn't up to date enough. I had both Java 11 and Java 14 installed, but the jenkins-lts script was coded to force use of Java 8. Rather than install a more up to date JDK 8 installation, I modified the script to run ${JAVA_HOME}/bin/java and set JAVA_HOME to the JDK 11 installation.

Donald.McLean
  • 869
  • 12
  • 18
0

It might not always be an option but if you have a choice use different Image. I used Debian GNU/Linux 10 and it worked like a charm.

dev_dan
  • 89
  • 6
0

Re-installing JAVA JDK8 worked for me.

0

Another possibility - make sure DNS functions properly for Jenkins.

In my case, I followed Kubernetes setup instructions here to install Jenkins, and it led to this problem.

I enabled logging on CoreDNS and saw this:

│ [INFO] 10.70.116.14:45888 - 50490 "AAAA IN updates.jenkins.io.svc.cluster.local. udp 54 false 512" NXDOMAIN qr,aa,rd 147 0.0001896s                          │
│ [INFO] 10.70.116.14:45888 - 32566 "A IN updates.jenkins.io.svc.cluster.local. udp 54 false 512" NXDOMAIN qr,aa,rd 147 0.000169468s                           │
│ [INFO] 10.70.116.14:57907 - 22912 "A IN updates.jenkins.io.localdomain. udp 48 false 512" NOERROR qr,aa 110 0.000907476s                                     │
│ [INFO] 10.70.116.14:57907 - 52100 "AAAA IN updates.jenkins.io.localdomain. udp 48 false 512" NOERROR qr,aa 110 0.001709031s 

The lookups were all cluster-local.

If I edited the URL (as suggested in other answers here) to include a dot after updates.jenkins.io. then hostname lookup worked and the URL resolved. Though Jenkins' next step errors for the same reason.

In the end I discovered the problem was ClusterFirst mode of the pod's DNS. I added dnsPolicy: Default to the deployment's pod template spec (the instructions link above), and now it works.

jws
  • 2,171
  • 19
  • 30
0

Even I faced similar issue, then figured out that JDK that I was using is 8 instead of 11. Check jenkins jdk combination under jenkins official site

I used JDK11 with Jenkins 2.3031 version and it worked fine - all plugins got downloaded

0

In my case, I use WINDOWS OS. So, jenkins was installed in my C drive.

PATH : C:\Users\Username\ .jenkins

Under "hudson.model.UpdateCenter" file change "https" to "http"

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

As some others pointed out, in Windows, this could be because of firewall restrictions set by company infrastructure. For my case, I need the recommended plugins to be present (e.g. Folders plugin)

My workaround was:

A. Install same Jenkins version into my personal laptop/VM, and be sure to install the recommended plugins the first time you browse to the Jenkins Web Page.

B. Copy the plugins folder from my personal laptop's JENKINS HOME folder (i.e. ProgramData\Jenkins...) into the Jenkins plugins folder of the company laptop. Total size of the plugins folder was around 150MB (zipped).

Dharman
  • 30,962
  • 25
  • 85
  • 135
remondo
  • 318
  • 2
  • 7
-1

Enter this before running Jenkins.

# iptalbes -F

It may be because of the firewall.

dani_KR
  • 7
  • 2
-2
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"
Pang
  • 9,564
  • 146
  • 81
  • 122