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

Jan picture Jan · May 20, 2017 · Viewed 11.6k times · Source

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 :)

Answer

Jan picture Jan · May 21, 2017

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