Failed to get component" Windows7 When I try to intall google cloud sdk the fol...">

Failed to install google cloud sdk: "<gcloud.components.update> Failed to get component" Windows7

When I try to intall google cloud sdk the following error occurs:

ERROR: (gcloud.components.update) Failed to get component list from server. Check your network settings and try again. The Google Cloud SDK installer is now out. Press any key to continue.,.

result = func(*args)   File "C:\python27_x64\lib\urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)   File "C:\python27_x64\lib\urllib2.py", line 1184, in do_open
raise URLError(err) urllib2.URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>

      

Any ideas?

+3


source to share


2 answers


I was getting a similar error both when installing and in some commands on another previously working installation. After scrolling through and adding some logs, it looks like the SSL certificate check fails to request a list of components from google servers:

$ gcloud preview managed-instance-groups ...
You do not currently have this command group installed.  Using it requires the installation of components: [preview]
Could not fetch [https://dl.google.com/dl/cloudsdk/release/components-2.json]
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
ERROR: (gcloud) Failed to fetch component listing from server. Check your network settings and try again.

      

To fix the problem (almost certainly impractical), I disabled SSL Cert Validation for this single request. If you want to go down this path, change MakeRequest()

to

./google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py:248

      

from

return urllib2.urlopen(req, timeout=TIMEOUT_IN_SEC)

      

in

return urllib2.urlopen(req, timeout=TIMEOUT_IN_SEC, context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))

      

(There's an issue open to https://code.google.com/p/google-cloud-sdk/issues/detail?id=143 .)

UPDATE: 26/05/15



In my case, it turned out to be a mismatch between my installed version of OpenSSL and the version of OpenSSL that Python is referring to (possibly after an upgrade to OpenSSL@1.0.2a-1

).

To solve this problem, I updated my OpenSSL version to the latest version:

brew update
brew upgrade openssl

      

Then I reinstalled Python, referencing this updated version of OpenSSL:

brew uninstall python
brew install python --with-brewed-openssl

      

After that, I got tired of installing the Google Cloud SDK (because I'm a little there to find a solution, you may not need to do this) and installed from scratch:

curl https://sdk.cloud.google.com | bash

      

And we are golden!

For further reading on these OpenSSL issues with OS X check out this article: https://hynek.me/articles/apple-openssl-verification-surprises/

+3


source


TL; DR

  • Find the file cacerts.txt

    used by google scripts. Should be in <google-cloud-sdk>/lib/third_party/httplib2/cacerts.txt

    .
  • Open https://dl.google.com

    Firefox and export its certificates.
  • Copy the contents of the certificate (s) to the end of the file cacerts.txt

    .

You may also need to make sure your system version of openssl is the same version as opensl which is used by python, like jemartti's answer . I tried it and it wasn't enough. I don't know if it matters.


Steps taken to achieve this solution

After trying jemartti's answer not to use, I used a flag --verbosity debug

to trace the point of failure. Output:

DEBUG: Failed to get [ https://dl.google.com/dl/cloudsdk/channels/rapid/components-v100.0.0.json]Traceback (last call last): File "/usr/local/google-cloud-sdk/lib/googlecloudsdk/core/updater/snapshots.py", line 186, in _DictFromURL response = installers.ComponentInstaller.MakeRequest (url, command_path) File "/usr/local/google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py", line 277, in MakeRequest return urlopen_with_cacerts.urlopen (req, timeout = TIMEOUT_IN_SEC) File "/ usr / local / google -cloud-sdk / lib / googlecloudsdk / core / util / urlopen_with_cacerts.py ", line 40, in urlopen return orig_urlopen (* args, ** kwargs) File" /usr/local/Cellar/python/2.7.11/Frameworks/ Python.framework / Versions / 2.7 / lib / python2.7 / urllib2.py ", line 154, in urlopen return opener.open (url, data, timeout) File" /usr/local/Cellar/python/2.7.11/ Frameworks / Python.framework / Versions / 2.7 / lib / python2.7 / urllib2.py ", line 431, open response = self._open (req, data) File" /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/ 2.7 / lib / python2.7 / urllib2.py ", line 449, in the '_open' folder, req) File" /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib /python2.7/urllib2.py ", line 409, in _call_chain result = func (* args) File" /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2 .7 / urllib2.py ", line 1240, at https_open context = self._context) File" /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ urllib2.py ", line 1197, in do_open raise URLError (err) URLError:data) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in '_open' folder, req) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain result = func (* args) File "/ usr / local / Cellar / python / 2.7.11 / Frameworks / Python.framework / Versions / 2.7 / lib / python2.7 / urllib2.py ", line 1240, at https_open context = self._context) File" / usr / local /Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 1197, in do_open raise URLError (err) URLError:data) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in '_open' folder, req) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain result = func (* args) File "/ usr / local / Cellar / python / 2.7.11 / Frameworks / Python.framework / Versions / 2.7 / lib / python2.7 / urllib2.py ", line 1240, at https_open context = self._context) File" / usr / local /Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 1197, in do_open raise URLError (err) URLError:/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 409, in _call_chain result = func (* args) File" / usr /local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 1240, at https_open context = self._context) File" / usr / local / Cellar / python / 2.7.11 / Frameworks / Python.framework / Versions / 2.7 / lib / python2.7 / urllib2.py ", line 1197, in do_open raise URLError (err) URLError:/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 409, in _call_chain result = func (* args) File" / usr /local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 1240, at https_open context = self._context) File" / usr / local / Cellar / python / 2.7.11 / Frameworks / Python.framework / Versions / 2.7 / lib / python2.7 / urllib2.py ", line 1197, in do_open raise URLError (err) URLError:/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 1197, in do_open raise URLError (err) URLError:/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py ", line 1197, in do_open raise URLError (err) URLError:



So I opened /usr/local/google-cloud-sdk/core/util/urlopen_with_cacerts.py

and saw that it is calling a method httplib2

urlopen

with an argument cafile

obtained from httplib2.CA_CERTS

. I added a line that prints this httplib2.CA_CERTS

, the output of which is:

/usr/local/google-cloud-sdk/lib/third_party/httplib2/cacerts.txt

Then, as described in this answer , this is why I did:

  • Open the URL in Firefox and export the certificate (s).
  • Copy the contents of the certificate (s) to the end of the file cacerts.txt

    .

As a Mac user, I also used the one-line file described here (which for some reason gave a different certificate than Firefox's certificate export function) to save the certificate (s) on my machine (replace exmple.com

and example.crt

as needed):

openssl x509 -in <(openssl s_client -connect example.com:443 -prexit 2>/dev/null) -out ~/example.crt

      

0


source







All Articles