sdkman / sdkman-cli

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

sdkman reports offline mode (which is not) #397

Closed gAmUssA closed 8 years ago

gAmUssA commented 8 years ago
$ 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
marc0der commented 8 years ago

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.

gAmUssA commented 8 years ago

@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  ~ 
marc0der commented 8 years ago

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.

gAmUssA commented 8 years ago

@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
marc0der commented 8 years ago

What shell and shell extension are you using? ZSH? Prezto? On Tue, 22 Dec 2015 at 23:26, Viktor Gamov notifications@github.com 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.

gAmUssA commented 8 years ago

Zsh + ohmyzsh

marc0der commented 8 years ago

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.

cesarizu commented 8 years ago

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

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.

flofreud commented 8 years ago

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

Marco Vermeulen notifications@github.com 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.

marc0der commented 8 years ago

👍

pablovilas commented 8 years ago

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

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

and then restarting the console.

gAmUssA commented 8 years ago

@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
marc0der commented 8 years ago

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

pablovilas commented 8 years ago

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

marc0der commented 8 years ago

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 notifications@github.com 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.

marc0der commented 8 years ago

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.

gAmUssA commented 8 years ago

@marc0der https://github.com/sdkman/sdkman-cli/issues/397#issuecomment-166721468

gAmUssA commented 8 years ago

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

marc0der commented 8 years ago

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

cesarizu commented 8 years ago

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

marc0der commented 8 years ago

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

cesarizu commented 8 years ago

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

marc0der commented 8 years ago

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

madorb commented 8 years ago

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.

tpraxl commented 8 years ago

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.

osvadimos commented 8 years ago

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:~$ `

marc0der commented 8 years ago

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 Вадим notifications@github.com 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.

osvadimos commented 8 years ago

Fixed the issue. Thanks a lot.

chendeshen commented 8 years ago

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

tiho2 commented 8 years ago

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.

marc0der commented 8 years ago

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 notifications@github.com 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

tiho2 commented 8 years ago

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.

marc0der commented 8 years ago

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

On Tue, 15 Mar 2016 at 09:33 tiho2 notifications@github.com 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

billwright commented 8 years ago

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?

marc0der commented 8 years ago

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 notifications@github.com 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

billwright commented 8 years ago

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.

marc0der commented 8 years ago

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 notifications@github.com 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

ali2077 commented 8 years ago

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

qinshulei commented 8 years ago

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.

marc0der commented 8 years ago

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.

marc0der commented 8 years ago

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.

SerigneDiop commented 8 years ago

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

marc0der commented 8 years ago

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

mastooo commented 7 years ago

@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
MoaLaiSkirulais commented 7 years ago

i fixed the same issue with this:

sdkman_insecure_ssl=true
liuhao86 commented 7 years ago

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.

marc0der commented 7 years ago

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 .

liuhao86 commented 6 years ago

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.

mhmdsalem1993 commented 6 years ago

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