Sdkman-cli: sdkman reports offline mode (which is not)

Created on 21 Dec 2015  Β·  55Comments  Β·  Source: sdkman/sdkman-cli

$ sdk install springboot
SDKMAN can't reach the internet so going offline. Re-enable online with:

  $ sdk offline disable

sdk:local:70: ^[[01;31m^[[Kspringboot^[[m^[[K: can't create local array elements

$ sdk version
SDKMAN 3.2.4

Most helpful comment

I've the same problem. I've solved it executing:

chmod +x .sdkman/bin/sdkman-init.sh 

and then restarting the console.

All 55 comments

Lots of weird stuff going on in your console. You would need to give me more details about your platform, shell etc. It also looks like you might be behind a proxy of some sort, which is blocking curl to reach the internet.

@marc0der no proxy

$ sdk version
SDKMAN 3.2.4

 13:22:15 ξ‚° ~ ξ‚°
$ zsh --version
zsh 5.2 (x86_64-apple-darwin15.0.0)

 15:22:57 ξ‚° ~ ξ‚°
$ curl --version
curl 7.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets

 15:23:03 ξ‚° ~ ξ‚°
$ archey

                 ###                  User: vikgamov
               ####                   Hostname: Viktors-MBP.home
               ###                    Distro: OS X 10.11.2
       #######    #######             Kernel: Darwin
     ######################           Uptime: 1 day  5:58
    #####################             Shell: /bin/zsh
    ####################              Terminal: xterm-256color iTerm.app
    ####################              CPU: Intel Core i7-4578U CPU @ 3.00GHz
    #####################             Memory: 16 GB
     ######################           Disk: 43%
      ####################            Battery: 66.15%
        ################              IP Address: 173.54.164.244
         ####     #####



 15:23:17 ξ‚° ~ ξ‚°

Thanks Viktor, that helps a lot. Next, can you try entering the following on your terminal?

$ curl -s api.sdkman.io/candidates/groovy

If that does not return a CSV of groovy versions, it means that you have a problem with curl. It might be worth checking if you have not exported the environment variable HTTP_PROXY or http_proxy.

$ echo $HTTP_PROXY
$ echo $http_proxy

If this is not the case, it could also be related to your version of curl. My machine is on 7.46, and I remember older versions on Mac had an issue with certificates.

@marc0der

$ curl -s api.sdkman.io/candidates/groovy
1.5.0,1.5.1,1.5.2,1.5.3,1.5.4,1.5.5,1.5.6,1.5.7,1.5.8,1.6.0,1.6.1,1.6.2,1.6.3,1.6.4,1.6.5,1.6.6,1.6.7,1.6.8,1.6.9,1.7.0,1.7.1,1.7.10,1.7.11,1.7.2,1.7.3,1.7.4,1.7.5,1.7.6,1.7.7,1.7.8,1.7.9,1.8.0,1.8.1,1.8.2,1.8.3,1.8.4,1.8.5,1.8.6,1.8.7,1.8.8,1.8.9,2.0.0,2.0.1,2.0.2,2.0.3,2.0.4,2.0.5,2.0.6,2.0.7,2.0.8,2.1.0,2.1.1,2.1.2,2.1.3,2.1.4,2.1.5,2.1.6,2.1.7,2.1.8,2.1.9,2.2.0,2.2.1,2.2.2,2.3.0,2.3.1,2.3.10,2.3.11,2.3.2,2.3.3,2.3.4,2.3.5,2.3.6,2.3.7,2.3.8,2.3.9,2.4.0,2.4.1,2.4.2,2.4.3,2.4.4,2.4.5%
$ echo $HTTP_PROXY


 18:29:57 ξ‚° ~ ξ‚°
$ echo $http_proxy

What shell and shell extension are you using? ZSH? Prezto?
On Tue, 22 Dec 2015 at 23:26, Viktor Gamov [email protected] wrote:

@marc0der https://github.com/marc0der

$ curl -s api.sdkman.io/candidates/groovy
1.5.0,1.5.1,1.5.2,1.5.3,1.5.4,1.5.5,1.5.6,1.5.7,1.5.8,1.6.0,1.6.1,1.6.2,1.6.3,1.6.4,1.6.5,1.6.6,1.6.7,1.6.8,1.6.9,1.7.0,1.7.1,1.7.10,1.7.11,1.7.2,1.7.3,1.7.4,1.7.5,1.7.6,1.7.7,1.7.8,1.7.9,1.8.0,1.8.1,1.8.2,1.8.3,1.8.4,1.8.5,1.8.6,1.8.7,1.8.8,1.8.9,2.0.0,2.0.1,2.0.2,2.0.3,2.0.4,2.0.5,2.0.6,2.0.7,2.0.8,2.1.0,2.1.1,2.1.2,2.1.3,2.1.4,2.1.5,2.1.6,2.1.7,2.1.8,2.1.9,2.2.0,2.2.1,2.2.2,2.3.0,2.3.1,2.3.10,2.3.11,2.3.2,2.3.3,2.3.4,2.3.5,2.3.6,2.3.7,2.3.8,2.3.9,2.4.0,2.4.1,2.4.2,2.4.3,2.4.4,2.4.5%

β€”
Reply to this email directly or view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-166761467.

Zsh + ohmyzsh

Okay, I have the exact same setup as you, with ZSH + ohmyzsh and not seeing this at all. I saw this sort of thing happening when I tried prezto before, it alters the behaviour of zsh.

Something similar is happening for me:

$ sdk selfupdate force 
This command is not available in offline mode.
$ sdk offline disable
Online mode re-enabled!
$ sdk selfupdate force
==== BROADCAST =============================================

OFFLINE MODE ENABLED! Some functionality is now disabled.

============================================================
This command is not available in offline mode.

TBH, I've never really felt comfortable about this feature. I like providing an offline mode for when you find yourself in an aeroplane or a place with no Internet, but not too keen on the automatic switching off this mode. I think we should strip the automatic switching out all together.

I got the same issue with the posh client and will stripe the auto
detection too

Marco Vermeulen [email protected] schrieb am Sa., 26. Dez. 2015,
11:05:

TBH, I've never really felt comfortable about this feature. I like
providing an offline mode for when you find yourself in an aeroplane or a
place with no Internet, but not too keen on the automatic switching off
this mode. I think we should strip the automatic switching out all together.

β€”
Reply to this email directly or view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-167305939.

πŸ‘

I've the same problem. I've solved it executing:

chmod +x .sdkman/bin/sdkman-init.sh 

and then restarting the console.

@pablovilas it actually helped with offline mode.

still have this problem though

sdk:local:70: ^[[01;31m^[[Kspringboot^[[m^[[K: can't create local array elements

@gAmUssA just out of curiosity, what version of zsh are you on? I remember some people were having strange issues to do with arrays on older versions of zsh. My current version is 5.2.

@pablovilas do you have any idea why making it executable would solve the offline problem?

Also, I'm currently overhauling the offline mechanism to simplify it a LOT. Should have a release going out within the next day or two.

@marc0der No. no clue. I've just tested executing 'sdkman-init.sh' by myself and didn't work because permission issues, that's why I've made that file executable.

Okay, but it's not meant to be executed. You will see that the snippet in
the .basrc or .zshrc only sources it, never executes. I mystified why this
has anything to do with online mode.

On Tue, 29 Dec 2015 at 22:24 Pablo Vilas [email protected] wrote:

@marc0der https://github.com/marc0der No. no clue. I've just tested
executing 'sdkman-init.sh' by myself and didn't work because permission
issues, that's why I've made that file executable.

β€”
Reply to this email directly or view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-167890298.

It's pushed to production environment as 3.2.5. Give it a spin and let me know if you have any more issues. I've simplified the offline feature, made lots of cool improvements. @gAmUssA I've also made curl's timeouts configurable, I'm fairly certain that this was the issue you were seeing.

@marc0der looks like similar to https://github.com/sdkman/sdkman-cli/issues/326

@gAmUssA Sorry, missed that. I'm pretty much out of ideas why your system is affected. Also certain that this is not happening to the majority of zsh users. Let me know if you discover something that solves it. (speaking of the _local array elements_ issue here, the timeout problem should be gone).

After deleting ~/.sdkman and reinstalling everything is working for me.

@cesarizu lol, that's a bit extreme. you could simply have done an sdk selfupdate force to get the latest.

@marc0der as I posted in my previous message, doing that just showed the message that offline mode was re-enabled and it couldn't update. I didn't update sdkman in a long time so I suspect that either something was wrong with the installation, or it was looking for something in some server that wasn't there anymore and didn't find it, so it enabled the offline mode because of that.

Cool, well glad to hear that it's all working again for you.

FYI i had this issue as well, it turns out that despite updating at some point from GVM to SDKMAN the SDKMAN_BROADCAST_SERVICE and SDKMAN_BROKER_SERVICE were both pointed to "gvm.io" not sure how that happened, but that's what it was.

I had the exact same problem. Neither chmod +x ~/.sdkman/bin/sdkman-init.sh nor rm -rf ~/.sdkman and reinstallation did help. However, I noticed that there was a ~/.gvm directory present. So I removed that. It seems to be important to open a new shell after that. Now everything is working as expected again.

Having the same problem. SDK is always offline.
Nothing helps
`laptop@g6:~$ sdk install grails
==== INTERNET NOT REACHABLE! ===============================

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

$ sdk offline

This command is not available while offline.
laptop@g6:~$ sdk offline disable
Online mode re-enabled!
laptop@g6:~$ sdk install grails
==== INTERNET NOT REACHABLE! ===============================

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

$ sdk offline

This command is not available while offline.
laptop@g6:~$
`

This definitely has to do with timeouts due to slow internet connections.
Remember, the server is hosted on Heroku in the USA, so when we say slow
internet connection, it's not necessarily your own ISP that is slow but
could be due to distance from origin.

You can tweak the behaviour by editing the config file found at
~/.sdkman/etc/config

Try playing with:
sdkman_curl_connect_timeout=5
sdkman_curl_max_time=10

More details about sdkman config can be found on the website:
http://sdkman.io/usage.html#config

On Mon, 22 Feb 2016 at 10:12 Π’Π°Π΄ΠΈΠΌ [email protected] wrote:

Having the same problem. SDK is always offline.
Nothing helps
`laptop@g6:~$ sdk install grails
==== INTERNET NOT REACHABLE! ===============================

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

$ sdk offline

This command is not available while offline.
laptop@g6:~$ sdk offline disable
Online mode re-enabled!
laptop@g6:~$ sdk install grails
==== INTERNET NOT REACHABLE! ===============================

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

$ sdk offline

This command is not available while offline.
laptop@g6:~$
`

β€”
Reply to this email directly or view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-187107079.

Fixed the issue. Thanks a lot.

curl -s api.sdkman.io/candidates/groovy
sdk selfupdate force
export SDKMAN_DIR="/root/.sdkman" && source "/root/.sdkman/bin/sdkman-init.sh"
sdk offline enable
sdk offline disable
sdk install groovy
groovy -v

I had the same issue on Ubuntu 14.04.
It is solved by marc0der's tip to increase timeouts in configuration ~/.sdkman/etc/config file and terminal restart.

Out of interest, what sort of timeouts solved the problem? It might be
worth tweaking the defaults a little.

On Tue, 15 Mar 2016 at 08:15 tiho2 [email protected] wrote:

I had the same issue on Ubuntu 14.04.
It is solved by marc0der's tip to increase timeouts in configuration
~/.sdkman/etc/config file and terminal restart.

β€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-196711433

I've increased timeouts you've recommend

Try playing with:

sdkman_curl_connect_timeout=5

sdkman_curl_max_time=10

But this change was ignored in my case until the terminal restart. (Offline error was thrown after 5s and sdkman_curl_connect_timeout was increased to 30s for test.) After terminal restart it worked.

I'm connecting from Croatia (EU). Simply have got the "offline mode" error and have found this chat while googling for solution...

IMO it would make sense to increase the timeouts quoted above.

Yes, you would need to resource the sdkman-init.sh or start a new terminal.

On Tue, 15 Mar 2016 at 09:33 tiho2 [email protected] wrote:

I've increased timeouts you've recommend

Try playing with:

sdkman_curl_connect_timeout=5

sdkman_curl_max_time=10

But this change was ignored in my case until the terminal restart.
(Offline error was thrown after 5s and sdkman_curl_connect_timeout was
increased to 30s for test.) After terminal restart it worked.

I'm connecting from Croatia (EU). Simply have got the "offline mode" error
and have found this chat while googling for solution...

β€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:

https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-196741396

Same trouble for me on a Mac running OS X 10.11 (El Cap) and sdk version 3.0.2. Timeouts don't seem to do anything, as it immediately switches to offline mode. Never had a problem before. I can see all the groovy versions via curl instantly, so it seems to be an sdk bug. I guess I'll try to manually install the latest sdk...

Actually, that didn't work as it noticed I already had it installed and told me to run "sdk selfupdate force", which of course doesn't work because of the offline bug... Frustrating. Do I blow away my entire .sdk dir?

Of course upgrading would be the very first thing to do before reporting
bugs :-)

You need to upgrade from 3.0.2 -> 3.3.4. :-O
On Wed, 23 Mar 2016 at 21:43, Bill Wright [email protected] wrote:

Same trouble for me on a Mac running OS X 10.11 (El Cap) and sdk version
3.0.2. Timeouts don't seem to do anything, as it immediately switches to
offline mode. Never had a problem before. I can see all the groovy versions
via curl instantly, so it seems to be an sdk bug. I guess I'll try to
manually install the latest sdk...

β€”
You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-200554903

Yes, upgrading fixed me, though, as I stated above, the usual upgrade path was broken as well. I moved the entire .sdk-man directory and was able to install the latest version and everything is working great now. Thanks for the response. I should have followed up myself. Love this tool! Thanks for creating it.

Your issue might have been due to the old gvmtool.net domain expiring. Glad
you like the tool though. πŸ˜€
On Wed, 23 Mar 2016 at 23:49, Bill Wright [email protected] wrote:

Yes, upgrading fixed me, though, as I stated above, the usual upgrade path
was broken as well. I moved the entire .sdk-man directory and was able to
install the latest version and everything is working great now. Thanks for
the response. I should have followed up myself. Love this tool! Thanks for
creating it.

β€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-200586126

thanks to mr marc0der I've fixed it with
sdkman_curl_connect_timeout=30
sdkman_curl_max_time=50

I have same issue

==== INTERNET NOT REACHABLE! ===============================

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

   $ sdk offline

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

and fixed it with

sdkman_curl_connect_timeout=30
sdkman_curl_max_time=50

It have offline mode.So I think it may be good to set sdkman_curl_connect_timeout=30 sdkman_curl_max_time=50 as default.

What is the _30/50 seconds_ based on? That sounds like a crazy long time for the shell to hang.

I would probably rather go for pushing these values sub 10s.

I've updated the defaults as follows:

sdkman_curl_connect_timeout=7
sdkman_curl_max_time=10

In other words, you have 7 seconds to make a connection, and 10 seconds to get a response. Hope this helps.

hi guys having a problem with the install of sdkman thought curl have this issue:
MacBook-Pro-de-DIOP:~ DSM$ source "$HOME/.sdkman/bin/sdkman-init.sh"
-bash: /Users/DSM/.sdkman/bin/sdkman-init.sh: No such file or directory

After installing i do not see the sdkman-init.sh
thank for your help

@SerigneDiop I don't think this has anything to do with this issue. Please consider using the Gitter channel on our home page for discussing usage problems.

@pablovilas suggestion to make sdkman-init.sh executable solved my issue (using SDKMAN 5.5.3+194). Weird.

my sdk curl config

> echo $sdkman_curl_max_time
10
> echo $sdkman_curl_connect_timeout
7

i fixed the same issue with this:

sdkman_insecure_ssl=true

I fixed this issue by edit .sdkman/bin/sdkman-init.sh.
replace line 36:

export SDKMAN_CURRENT_API="https://api.sdkman.io/2"

with

export SDKMAN_CURRENT_API="http://api.sdkman.io/2"

sdkman_insecure_ssl=true is not work for me.

Please do not do this. It is never a good idea to switch off SSL. Rather
figure out the problem with the certs on your machine and resolve this in
the right way.

On Mon, 6 Nov 2017, 02:52 Liu Hao, notifications@github.com wrote:

I fixed this issue by edit .sdkman/bin/sdkman-init.sh.
replace line 36:

export SDKMAN_CURRENT_API="https://api.sdkman.io/2"

with

export SDKMAN_CURRENT_API="http://api.sdkman.io/2"

sdkman_insecure_ssl=true is not work for me.

β€”
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-342033246,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAI0BimhoYNhUxIW_b7flLVvnFuikUm3ks5sznR7gaJpZM4G5amT
.

The domain sdkman.io was blocked when I access from China, it's so weird. Now I add this domain to proxy by rule || sdkman.io ^, everything is OK.

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

close the shell and try again it will hang for minute then it will work as usual
i hope this will help you

Increased the timeout to try different values - no joy - _always_ off line.

curl -s api.sdkman.io/candidates/groovy
connected but returned a "Not Found" page

What worked for me was to follow the instructions to install sdkman at a new location the edit .profile to point to the new sdkman location. Had to run sdk install for all my development applications - so now I have reached my goal of having a working sdk and the latest version of my development environment.

Really like sdk, grails, gradle, groovy and friends so thank heaps and keep up the good work :-)

We do all our calls with https now, http hasn't been supported for a long
time. Also, the URL structure has changed completely, this form was retired
quite some time ago.

If your installation is this old, I suggest removing the old installation
and reinstalling.

On Sat, 26 May 2018, 02:40 acoveny, notifications@github.com wrote:

Increased the timeout to try different values - no joy - always off
line.

curl -s api.sdkman.io/candidates/groovy
connected but returned a "Not Found" page

What worked for me was to follow the instructions to install sdkman at a
new location the edit .profile to point to the new sdkman location. Had to
run sdk install for all my development applications - so now I have reached
my goal of having a working sdk and the latest version of my development
environment.

Really like sdk, grails, gradle, groovy and friends so thank heaps and
keep up the good work :-)

β€”
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-392226327,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAI0Bu0s8jKfBX6lRE_tkezqalJ197Mpks5t2LKJgaJpZM4G5amT
.

Hi Marco,

Thanks for the confirmation a new version was required.

The issue stream discussion suggestion re-install was not required.

With 20-20 hindsight I should have followed the uninstall instructions,
then re-installed.

The "put a new version somewhere else and try that" option was easy to
follow.

Thank-you for taking the time to email me this follow-up. It is very kind
of you.

Kind Regards,

Anne C

On Sat, May 26, 2018 at 4:35 PM, Marco Vermeulen notifications@github.com
wrote:

We do all our calls with https now, http hasn't been supported for a long
time. Also, the URL structure has changed completely, this form was retired
quite some time ago.

If your installation is this old, I suggest removing the old installation
and reinstalling.

On Sat, 26 May 2018, 02:40 acoveny, notifications@github.com wrote:

Increased the timeout to try different values - no joy - always off
line.

curl -s api.sdkman.io/candidates/groovy
connected but returned a "Not Found" page

What worked for me was to follow the instructions to install sdkman at a
new location the edit .profile to point to the new sdkman location. Had
to
run sdk install for all my development applications - so now I have
reached
my goal of having a working sdk and the latest version of my development
environment.

Really like sdk, grails, gradle, groovy and friends so thank heaps and
keep up the good work :-)

β€”
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-392226327
,
or mute the thread
tkezqalJ197Mpks5t2LKJgaJpZM4G5amT>
.

β€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-392240978,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALUWiyX82GvXdg5OGpmNx3WdFp-emU6dks5t2PedgaJpZM4G5amT
.

Always a pleasure and please shout if you have any further issues.

I met such a problem because of my Ad blocker.
I've simply added https://api.sdkman.io/ into the whitelist.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edmondo1984 picture edmondo1984  Β·  6Comments

dayja78 picture dayja78  Β·  6Comments

andvgal picture andvgal  Β·  7Comments

hho picture hho  Β·  4Comments

Omnipresent picture Omnipresent  Β·  6Comments