sdkman / sdkman-cli

The SDKMAN! Command Line Interface
https://sdkman.io
Apache License 2.0
6.05k stars 628 forks source link

Install script fails to download zip #426

Closed dayja78 closed 8 years ago

dayja78 commented 8 years ago

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.
dayja78 commented 8 years ago

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.

marc0der commented 8 years ago

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?

marc0der commented 8 years ago

No response so closing this issue.

varun9715 commented 6 years ago

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.

marc0der commented 6 years ago

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

mrmaxsteel commented 5 years ago

@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"

Once that is fixed I then hit a secondary issue (again only behind a proxy):

> 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.

If I try to run sdk update prior to the sdk install groovy I get:

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

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

   $ sdk offline

================================================================================
paynet1 commented 2 years ago

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

What "zip" program should be installed? I received the same error and installed a couple of "zip" programs but I'm still getting the error that says: " Please install zip on your system using your favourite package manager. Restart after installing zip."

steelx commented 2 years ago

steps to install SDKMAN on windows

Run windows Terminal in Admin rights. open git bash inside. (Ctrl + Shift + 4)

winget install -e --id GnuWin32.Zip
mkdir ~/bin
cp /usr/bin/unzip ~/bin/zip
curl -s "https://beta.sdkman.io" | bash
source "/c/Users/ajink/.sdkman/bin/sdkman-init.sh"
sdk selfupdate force

Done ! :)

marc0der commented 2 years ago

@steelx The last step isn't required. SDKMAN is 100% up to date when you've just installed it.

MarwinDoktor commented 5 months ago

I have a similar problem but it stops with: Looking for unzip... Not found.

Please install unzip using your favorite package manager Restart after installing unzip

-- How do I fix this?

helpermethod commented 5 months ago

I have a similar problem but it stops with: Looking for unzip... Not found.

Please install unzip using your favorite package manager Restart after installing unzip

-- How do I fix this?

What operating system are you using? SDKMAN! requires unzip to work properly.

MarwinDoktor commented 5 months ago

Hey, thanks for your response. I use Windows 10 and I fixed it. Now I have a problem with the next step typing "source "$HOME/.sdkman/bin/sdkman-init.sh" into my terminal. When type this command in my regular Windows terminal, it says that "source" is an invalid argument. When I type the command in the ubuntu terminal I get no response at all. Do you have any idea how to fix this? Thanks in advance!

Amygdala73 commented 2 weeks ago

I've fixed the problem on my Windows 11 environment simply by installing the zip package: pacman -S zip