Sdkman-cli: Install script fails to download zip

Created on 20 May 2016  路  6Comments  路  Source: sdkman/sdkman-cli

sdkman_install_error.txt
res-4.0.37.zip_but_really_html.txt

curl -s "https://get.sdkman.io" | bash is producing the attached error. The key part is quoted below. Looks like what's getting written to the res-4.0.37.zip file is actually some kind of html error page (also attached).

Workaround:

After a bunch of screwing around, I wound up doing curl -s "https://get.sdkman.io" > sdkman_installer.sh, editing that script, and changing SDKMAN_SERVICE="http://api.sdkman.io" to SDKMAN_SERVICE="https://api.sdkman.io". Running that modified script worked.

This is what the original error message looks like:

Download script archive...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0 89117    0     0  56435      0 --:--:--  0:00:01 --:--:-- 2559k
Extract script archive...
[/opt/sdkman/tmp/res-4.0.37.zip]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /opt/sdkman/tmp/res-4.0.37.zip or
        /opt/sdkman/tmp/res-4.0.37.zip.zip, and cannot find /opt/sdkman/tmp/res-4.0.37.zip.ZIP, period.

Most helpful comment

@marc0der I have a very similar issue trying to run the installer behind a corporate proxy:

Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Download script archive...

curl: (60) Peer's Certificate issuer is not recognized.
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
Downloaded zip archive corrupt. Are you connected to the internet?

If problem persists, please ask for help on https://gitter.im/sdkman/user-issues

I was able to fix the issue by adding '-k' option the the curl that downloads the zip:

echo "Download script archive..."
curl --location --progress-bar "${SDKMAN_SERVICE}/broker/download/sdkman/install/${SDKMAN_VERSION}/${SDKMAN_PLATFORM}" > "$sdkman_zip_file"
echo "Download script archive..."
curl -k --location --progress-bar "${SDKMAN_SERVICE}/broker/download/sdkman/install/${SDKMAN_VERSION}/${SDKMAN_PLATFORM}" > "$sdkman_zip_file"



md5-e08ec5e4f5d969e274d1a007bf396cda



> bash /root/.sdkman/bin/sdkman-init.sh 
> yes | /bin/bash -l -c 'sdk install groovy'
WARNING: Cache is corrupt. SDKMAN can not be used until updated.



md5-939081627f191cbc5dba1f4aea2a4ecf



> sdk update
==== INTERNET NOT REACHABLE! ===================================================

 Some functionality is disabled or only partially available.
 If this persists, please enable the offline mode:

   $ sdk offline

================================================================================

All 6 comments

Apologies: Looks like this is related to my employer's proxy. Even after tricking SDKMAN into installing, I couldn't do sdk list, sdk install, or anything without getting "PROXY DETECTED!" errors. I finally got sdk install to work by finding internet access outside the office. But I have to say, this severely limits the usefulness of SDKMAN.

I have a suggestion: in doing my troubleshooting, I found that, just like with my original issue, curl api.sdkman.io/candidates/groovy won't work behind the proxy, but curl https://api.sdkman.io/candidates/groovy works fine. (Incidentally, both urls work fine in Chrome, even behind the proxy)

So: what about making SDKMAN use https all the time? Or an additional flag in .sdkman/etc/config to choose between http and https?

Or, can anybody out there tell me how to get curl to handle http requests through corporate proxies the same way Chrome does?? Google's doing nothing for me.

SDKMAN now performs all it's calls over https. Could you please let me know if this solved your problem and if so close this issue?

No response so closing this issue.

I am facing the same issue

Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
which: no zip in (/c/Program Files/Java/jdk1.8.0_161/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Program Files/Java/jdk1.8.0_161/bin:/c/ProgramData/Oracle/Java/javapath:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files (x86)/Windows Live/Shared:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/d/AEM/Curl/src:/cmd:/c/Users/varun/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl)
Not found.
Please install zip on your system using your favourite package manager.

Restart after installing zip.

@varun9715 nope, what you are seeing is vastly different. Please read what it says and follow the instructions.

@marc0der I have a very similar issue trying to run the installer behind a corporate proxy:

Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Download script archive...

curl: (60) Peer's Certificate issuer is not recognized.
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
Downloaded zip archive corrupt. Are you connected to the internet?

If problem persists, please ask for help on https://gitter.im/sdkman/user-issues

I was able to fix the issue by adding '-k' option the the curl that downloads the zip:

echo "Download script archive..."
curl --location --progress-bar "${SDKMAN_SERVICE}/broker/download/sdkman/install/${SDKMAN_VERSION}/${SDKMAN_PLATFORM}" > "$sdkman_zip_file"
echo "Download script archive..."
curl -k --location --progress-bar "${SDKMAN_SERVICE}/broker/download/sdkman/install/${SDKMAN_VERSION}/${SDKMAN_PLATFORM}" > "$sdkman_zip_file"



md5-e08ec5e4f5d969e274d1a007bf396cda



> bash /root/.sdkman/bin/sdkman-init.sh 
> yes | /bin/bash -l -c 'sdk install groovy'
WARNING: Cache is corrupt. SDKMAN can not be used until updated.



md5-939081627f191cbc5dba1f4aea2a4ecf



> sdk update
==== INTERNET NOT REACHABLE! ===================================================

 Some functionality is disabled or only partially available.
 If this persists, please enable the offline mode:

   $ sdk offline

================================================================================
Was this page helpful?
0 / 5 - 0 ratings

Related issues

OmidTahouri picture OmidTahouri  路  7Comments

pshirshov picture pshirshov  路  6Comments

imrabti picture imrabti  路  7Comments

Omnipresent picture Omnipresent  路  6Comments

aadrian picture aadrian  路  7Comments