java.io.IOException: Downloaded file /var/lib/jenkins/plugins/scm-api.jpi.tmp does not match expected SHA-1, expected 'GSoCVeUDmMHHd4hvIx6GHlvzA1g=', actual 'NUD1ONAUpGfIc3Hk0DiYO5HhS48='

Jenkins JIRA | Xifeng Zou | 3 months ago
  1. 0

    Maybe this issue is related to [JDK-4620571 : urlconnection following redirect uses protocol of original request|http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4620571] [http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4620571] I installed Jenkins 2.7.4 LTS from ubuntu apt repository following the offical installation guide. Then I navigated to the jenkins webapp url. After filled in initial admin password, loading indicator was shown for some time, and I got a message "This Jenkins instance appears to be offline." I am sure the network connection is fine and not behind any proxy. I skipped proxy configuration. Jenkins runs fine, but when I opened plugins manager, no plugins found. Since I have been worked with Hudson (before Jenkins split from Hudson) for quite long time I knew some problem occured. When I checked log file, I got following log entry: {quote} WARNING: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail. java.io.IOException: Could not find JSON in http://updates.jenkins-ci.org/update-center.json?id=default&version=2.7.4 at hudson.model.DownloadService.loadJSON(DownloadService.java:174) at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:176) at hudson.model.UpdateCenter.updateDefaultSite(UpdateCenter.java:2181) at jenkins.install.SetupWizard.init(SetupWizard.java:170) at jenkins.install.InstallState$3.initializeState(InstallState.java:105) at jenkins.model.Jenkins.setInstallState(Jenkins.java:970) at jenkins.install.InstallUtil.proceedToNextStateFrom(InstallUtil.java:94) at jenkins.model.Jenkins.<init>(Jenkins.java:887) at hudson.model.Hudson.<init>(Hudson.java:85) at hudson.model.Hudson.<init>(Hudson.java:81) at hudson.WebAppMain$3.run(WebAppMain.java:227) {quote} I tried to check the update site url with shell {quote}curl http://updates.jenkins-ci.org/update-center.json\?id=default\&version=2.7.4{quote}. The response is a 301 redirect. After another two 302 redirects, I got the final update site url: {quote}https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/stable-2.7/update-center.json{quote} The entire network flow of update site: {quote} http://updates.jenkins-ci.org/update-center.json?id=default&version=2.7.4 301 http://updates.jenkins-ci.org/stable-2.7/update-center.json 302 http://mirrors.jenkins-ci.org/updates/stable-2.7/update-center.json 302 https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/stable-2.7/update-center.json {quote} Then I changed the default update site url to this mirror url, I could get plugins list now. But when I tried to install some plugins, failed. I checked the log file and found following message: {quote} SEVERE: Failed to install SCM API Plugin java.io.IOException: Downloaded file /var/lib/jenkins/plugins/scm-api.jpi.tmp does not match expected SHA-1, expected 'GSoCVeUDmMHHd4hvIx6GHlvzA1g=', actual 'NUD1ONAUpGfIc3Hk0DiYO5HhS48=' at hudson.model.UpdateCenter.verifyChecksums(UpdateCenter.java:1799) at hudson.model.UpdateCenter.access$1100(UpdateCenter.java:147) at hudson.model.UpdateCenter$InstallationJob.replace(UpdateCenter.java:1950) at hudson.model.UpdateCenter$UpdateCenterConfiguration.install(UpdateCenter.java:1194) at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1669) at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1864) at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1640) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110) at java.lang.Thread.run(Thread.java:745) {quote} I opened scm-api.jpi.tmp, it was a html file: {quote} <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/scm-api/1.3/scm-api.hpi">here</a>.</p> </body></html> {quote} I can't figure out what happened. So I uninstalled 2.7.4, and installed 2.22 from apt reposity, the problem is still there. And I tried to install jenkins web app into tomcat 8.55, the problem is not resolved. I also tried openjdk8, before that oracle jdk 1.7.0_25 was used. Today, I cloned the source code from github, tried to add some log with bq. hudson.model.DownloadService.loadJSON(URL src) around line 170. I found that when using default update site url URLConnection stopped to follow the last 302 redirect to bq. https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/current/update-center.json After that I checked the update site json content. The "scm-api" plugin's url is bq. http://updates.jenkins-ci.org/download/plugins/scm-api/1.3/scm-api.hpi There will be two 302 redirects, the final url is bq. https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/scm-api/1.3/scm-api.hpi The entire network flow of a plugin: {quote} http://updates.jenkins-ci.org/download/plugins/scm-api/1.3/scm-api.hpi 302 http://mirrors.jenkins-ci.org/plugins/scm-api/1.3/scm-api.hpi 302 https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/scm-api/1.3/scm-api.hpi {quote} After searching, I found the JDK issue record mentioned at the beginning. I'm not sure whether it is the reason. Maybe, Jenkins update site should enforce https. I want to change update-center.json with all the url directly pointed to the mirror site, and deployed to an internal server, but jenkins refused to accept it since the checksum digest is changed. So there is no work around for me.

    Jenkins JIRA | 3 months ago | Xifeng Zou
    java.io.IOException: Downloaded file /var/lib/jenkins/plugins/scm-api.jpi.tmp does not match expected SHA-1, expected 'GSoCVeUDmMHHd4hvIx6GHlvzA1g=', actual 'NUD1ONAUpGfIc3Hk0DiYO5HhS48='
  2. 0

    Can't download plugins - HTTP 302 redirect

    Google Groups | 3 months ago | Corey Wei
    java.io.IOException: Downloaded file /home/deploy/.jenkins2/plugins/git-server.jpi.tmp does not match expected SHA-1, expected 'LoG8X55ycVzgPjwTtCA/iKb7lvw=', actual 'Lbk3pB/mu/UlYJO4o2ttQkZ+mvs='
  3. 0

    Tomcat Configuration for Jenkins Plugin - 403 error

    Stack Overflow | 3 years ago | pcb
    java.io.IOException: Failed to download from http://updates.jenkins-ci.org/download/plugins/xunit/1.84/xunit.hpi
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Failed to dynamically deploy this plugin : Jenkins

    Stack Overflow | 3 years ago | SabareeshSS
    java.io.IOException: Failed to dynamically deploy this plugin
  6. 0

    Unable to download GitHub plugin in Jenkins

    Stack Overflow | 2 years ago | user2704903
    java.io.IOException: Failed to dynamically deploy this plugin

  1. davidvanlaatum 14 times, last 4 months ago
22 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    Downloaded file /var/lib/jenkins/plugins/scm-api.jpi.tmp does not match expected SHA-1, expected 'GSoCVeUDmMHHd4hvIx6GHlvzA1g=', actual 'NUD1ONAUpGfIc3Hk0DiYO5HhS48='

    at hudson.model.UpdateCenter.verifyChecksums()
  2. Hudson
    UpdateCenter$DownloadJob.run
    1. hudson.model.UpdateCenter.verifyChecksums(UpdateCenter.java:1799)
    2. hudson.model.UpdateCenter.access$1100(UpdateCenter.java:147)
    3. hudson.model.UpdateCenter$InstallationJob.replace(UpdateCenter.java:1950)
    4. hudson.model.UpdateCenter$UpdateCenterConfiguration.install(UpdateCenter.java:1194)
    5. hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1669)
    6. hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1864)
    7. hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1640)
    7 frames
  3. Java RT
    FutureTask.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:266)
    2 frames
  4. Hudson :: Remoting Layer
    AtmostOneThreadExecutor$Worker.run
    1. hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
    1 frame
  5. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)
    1 frame