20

Internet is working fine, but I'm getting this error from sdkman:

    06:47 $ sdk version
==== INTERNET NOT REACHABLE! ===============================

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

   $ sdk offline

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

SDKMAN 4.0.35

My DNS does seem to be resolving very slowly. I can ping, but the resolution takes ~7 seconds. Could that be causing sdkman to time out?

Any thoughts? what's the next step towards debugging? Thanks!

9 Answers 9

33

you need to set the curl connect timeout and curl max time in the config file which is allocated in the following path :

 $YOUR_HOME/.sdkman/etc/config

to the following :

sdkman_curl_connect_timeout=20
sdkman_curl_max_time=0

i hope this will help you

2
  • 3
    It is such weird
    – RxRead
    Commented Aug 14, 2019 at 12:37
  • 2
    @RxRead It is not weird. It just adjust the timeout config to support sdkman update in weak network.
    – Kami Wan
    Commented Feb 3, 2023 at 2:34
5

Well, I had to struggle to get SDKMAN let me download packages. I am behind a Corporate proxy and use CNTLM to work around it on my local machine.

I had to edit a file of sdkman on my local machine after downloading it.

Downloading was a thing too. For me adding the -x http://localhost:3128 to the curl command worked. Steps i took to get gradle installed:

  • I downloaded the install script and stored it in a /tmp folder.
  • Adjusted the installscript and added the extra parameter to the curl command. Now I could see the tool getting downloaded and installed in the $HOME/.sdkman dir.
  • After that I had to run sdkman-init.sh
  • Then I had to edit the .sdkman/src/sdkman-utils.sh and added the -x option to every line where curl was called.

That did the trick. Remember to close the terminal and open a new one after each step.

4

Try

sdkman_insecure_ssl=true in .sdkman/etc/config
1
  • 1
    Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, can you edit your answer to include an explanation of what you're doing and why you believe it is the best approach? Commented Feb 8, 2022 at 1:14
3

Fix was a two-step process for me:

  1. Set the executable bit on sdkman-init.sh (chmod +x .sdkman/bin/sdkman-init.sh)
  2. Modify ~/sdkman/etc/config, set
sdkman_curl_connect_timeout=30
sdkman_curl_max_time=50

And don't forget to restart the terminal.

1
  • adding the executable bit did the trick for me... thanks!
    – fditz
    Commented Jul 22, 2020 at 7:52
2

Different applications use different settings to establish network connection.

In my case(I access the internet through a proxy using Macbook Pro), although I had set http and https proxy in System Preferences->Network->Advanced->Proxies. It did take effect for browser(Safari), but not for sdkman command line tool.

I have to set environment variables http_proxy and https_proxy manually.

Below is what I set on my Macbook Pro.

export http_proxy=http://proxy.abc.com:2500
export https_proxy=https://proxy.abc.com:2500

Then sdkman works fine.

1

I got the same issue (being behind a corporate proxy). In my case, http_proxy as well as https_proxy environment variable was set.

Interestingly, most distros don't compile openssl with (rather uncommon) https_proxy support and therefore curl fails:

curl https://www.google.com
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to proxy.company.com:3128 

Solution for my problem:

unset https_proxy

After unsetting https_proxy, curl and sdkman (because they seem to use openssl) both worked out of the box.

1

Or 6 years later, you get hit by a curl bug and the issue is resolved by updating curl.

Steps to analyze:

# Find the SDK website URL:
cat ~/.sdkman/bin/sdkman-init.sh | grep -i api
# Run curl
curl -vvv https://api.sdkman.io/2

If this shows something like Internal SSL engine error encountered during the SSL handshake you need to update curl, e.g. on MacOS using brew: brew upgrade curl

1
1

FWIW, my similar troubles stemmed from running sdkman in a Docker Desktop container that had DNS problems: https://github.com/docker/for-win/issues/10247#issuecomment-1919627110

0

Looks like it's working now ... maybe an issue on the server side? Or maybe an intermittent networking issue on my side. Anyhow, next crisis ... :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.