Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error: failed to download on rbenv install

Tags:

curl

rbenv

On fresh, new CentOS 7.0 VM Rbenv installation will not install rubies for me

[vagrant@ad-proxy ~]$ rbenv install 2.2.4
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
error: failed to download ruby-2.2.4.tar.bz2

BUILD FAILED (CentOS Linux 7 using ruby-build 20170405-4-g365dd1f)

With more verbose loging it shows

[vagrant@ad-proxy ~]$ rbenv install 2.2.4 -v
/tmp/ruby-build.20170515092651.20803 ~
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
curl: (35) Peer reports incompatible or unsupported protocol version.
error: failed to download ruby-2.2.4.tar.bz2

BUILD FAILED (CentOS Linux 7 using ruby-build 20170405-4-g365dd1f)

The issue seems to originate in curl it looks like for example

[vagrant@ad-proxy ~]$ curl https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
curl: (35) Peer reports incompatible or unsupported protocol version.
[vagrant@ad-proxy ~]$ curl https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2 -v
* About to connect() to cache.ruby-lang.org port 443 (#0)
*   Trying 151.101.36.233...
* Connected to cache.ruby-lang.org (151.101.36.233) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* NSS error -12190 (SSL_ERROR_PROTOCOL_VERSION_ALERT)
* Peer reports incompatible or unsupported protocol version.
* Closing connection 0
curl: (35) Peer reports incompatible or unsupported protocol version.
[vagrant@ad-proxy ~]$
like image 289
onknows Avatar asked May 15 '17 09:05

onknows


1 Answers

The reason you failed:

Some old/vulnerable NSS is used for SSL within cURL library when you go to some url, so it's rejected. So within this machine you have chance to fail to run cURL related commands such as pycurl.

The solution:

IMO the NSS is bundle with CentOS 7.0 VM, so you can update NSS libraries as following.

yum update nss nss-util nspr

Hope this helps!

like image 195
Toshi Avatar answered Sep 17 '22 01:09

Toshi