Google Cloud SDK install on OS X: (gcloud.components.list) Failed to fetch component listing from server
Asked Answered
A

3

17

I'm trying to install the Google Cloud SDK (https://cloud.google.com/sdk/docs/quickstart-mac-os-x) and get this error:
ERROR: (gcloud.components.list) Failed to fetch component listing from server. Check your network settings and try again.

Already tried updating OpenSSL and corresponding Python (also tried Python 2.7.8):

openssl version  
OpenSSL 1.0.2k  26 Jan 2017

python -V
Python 2.7.13

Python is also using this OpenSSL version:

>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2k  26 Jan 2017'

I'm running mac OS 10.12.4

I've also tried brew cask install google-cloud-sdk which effectively just downloads the normal version und executes the install.sh script. Same result.

Further debugging showed, it's unable to load https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json and throws this error: URLError: <urlopen error timed out>. Loading this file via Python directly works:

urllib2.urlopen('https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json')

Any ideas? Also any hints how to further debug this, would be appreciated :)

Anal answered 20/5, 2017 at 14:52 Comment(0)
A
54

After turning off ipv6 support, the tool works like a charm. Looks like gcloud can not work gracefully with ipv6...

Disable ipv6:

networksetup -setv6off Wi-Fi

Enable ipv6:

networksetup -setv6automatic Wi-Fi

Note: While investigating this, I was also able to make it work by using a very long timeout — 120 seconds. This wouldn't be practical, though, for most use cases due to the long delays it would introduce for each command.

The timeout is located in google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py at line 36 called TIMEOUT_IN_SEC

Anal answered 20/5, 2017 at 23:16 Comment(13)
ipv6 was the issue for me as well. 2017 MBP on Sierra.Overskirt
This is magic! How did you know it doesn't work well on ipv6?Knotted
Thanks for this. Note, further gcloud operations are also extremely slow on macOS Sierra unless you disable ipv6. To clarify the above, the two networksetup operations shown by Dimitri here are for disabling (setv6off) and then re-enabling (setv6automatic) ipv6. Don't do both or you'll just toggle it off and on again.Pelota
Can you modify this answer in order to deprecate the timeout suggestion? The ipv6 disabling is the real solution here, still relevant today (WTF Google?!) and should lead the answer.Ottar
You may also want to clarify your networksetup commands - that the first one is how to disable ipv6 and the second one is how to put it back after using gcloud.Ottar
@Ottar I've added a corresponding descriptionAnal
this is gold, how did you discover it does not play well with IPv6 ?Alizaalizarin
@Alizaalizarin it was a long night of debugging and cursing ;) No seriously I've experienced some ipv6 issues with other tools which also resulted in a timeout. Having found the timeout, it wasn't too far to deduce.Anal
Nope, disabling IP6 did not work for me :(. There has to be other reason.Veach
Still it is not fixed . Why is it so ?Faradism
Worked for me in 2019. Wtf apple + google - fix your s***! :)Illegality
Changing the timeout worked for me in 2020 (without needing to disable ipv6)Hundredpercenter
@Hundredpercenter basically changing the timeout results in the app running into the ipv6 timeout and then trying to use ipv4.Anal
P
3

Disable IPV6 :

sysctl net.ipv6.conf.all.disable_ipv6=1
Puerile answered 30/4, 2020 at 17:7 Comment(1)
This fixed the problem for me on (Debian) Linux. I got spurious but very frequent errors including ServerNotFoundError, socket.gaierror: [Errno -5] No address associated with hostname and others.Footstalk
R
0

Disabling ipv6 didn't work for me. I tried a bunch of things before getting it to work. I upgraded to mojave OSX before getting the issues.

I updated mac headers as mentioned here:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Rebooted then reinstalled python2: brew reinstall python2

At this point the issue still persisted, decided to reinstall gcloud and came across this: I was using zsh so I added the followin .zshrc:

source <PATH to gcloud sdk>/google-cloud-sdk/path.zsh.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.zsh.inc

For bash:

source <PATH to gcloud sdk>/google-cloud-sdk/path.bash.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.bash.inc`

Then a gcloud init got me resetting some proxy configuration that was probably the main issue from the start.

Rectilinear answered 18/7, 2019 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.