on a fresh install of an old windows ruby binary, I have an error that I dont know how to get around
environment:
windows 10
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32] (32 bit version)
devkit - DevKit-mingw64-32-4.7.2-20130224-1151-sfx
PS C:\Users\ALilland> gem install bundler --verbose
HEAD http://api.rubygems.org/api/v1/dependencies
200 OK
GET http://api.rubygems.org/api/v1/dependencies?gems=bundler
301 Moved Permanently
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/api/v1/dependencies)
I've been using this ruby version for almost 8 years and have never seen this issue while installing, any ideas on how to get around it?
i've messed with the proxy settings on the machine and i do not currently believe that is the issue
on my mac I have an old ruby 2.4.1 install with rvm, and I can see that it resolves successfully to a different URI
$ gem install bundler -v 2.3.26 --verbose
HEAD https://rubygems.org/api/v1/dependencies
200 OK
GET https://rubygems.org/api/v1/dependencies?gems=bundler
200 OK
Downloading gem bundler-2.3.26.gem
GET https://rubygems.org/gems/bundler-2.3.26.gem
Fetching bundler-2.3.26.gem
200 OK
...
The problem is that the SSL certificates can't be verified. This is explained in detail in the Bundler documentation:
Why am I seeing certificate verify failed?
If you’ve seen the following SSL error when trying to pull updates from RubyGems: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
This error happens when your computer is missing a file that it needs to verify that the server behind RubyGems.org is the correct one.
The latest version of RubyGems should fix this problem, so we recommend updating to the current version. To tell RubyGems to update itself to the latest version, run gem update --system. If that doesn’t work, try the manual update process below.
(What do we mean by updating “should fix this problem”? Review the What are these certificates? and How Ruby uses CA certificates sections below to gain a better understanding of the underlying problems.)
How Ruby uses CA certificates
The SSL certificate used by RubyGems.org descends from a new-ish root certificate. Ruby (and therefore RubyGems and Bundler) does not have a regularly updated CA bundle to use when contacting websites. Usually, Ruby uses a CA bundle provided by the operating system (OS). On older OSes, this CA bundle can be really old—as in a decade old. Since a CA bundle that old can’t verify the (new-ish) certificate for RubyGems.org, you might see the error in question: certificate verify failed.
Further complicating things, an otherwise unrelated change 18-24 months ago lead to a new SSL certificate being issued for RubyGems.org. This meant the “root” certificate that needed to verify connections changed. So even if you’d previously upgraded RubyGems/Bundler in order to fix the SSL problem, you would need to upgrade again—this time to an even newer version with even newer certificates.
There are advanced troubleshooting steps available in the documentation that I'm not going to replicate here as they are subject to change and you should always reference the latest instructions.
I can say very broadly though that:
You are using a version of Ruby that is end-of-life and will not receive further updates, including security updates
You are using a version of Ruby that possibly cannot be made to work even with the troubleshooting steps
The safest solution is likely to upgrade to a modern version of Ruby
If you cannot get any of the above steps to work then consider using :ssl_verify_mode: 0 in .gemrc. This should be a last-resort measure as it completely disables SSL certificate validation.
Related
I just really need to install Sass. But then it led to this error:
ERROR: Could not find a valid gem 'sass' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/latest_specs.4.8.gz)
my ruby version is :
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
my rubygem version is:
2.0.14.1
while my openssl version is:
OpenSSL 0.9.8zh 14 Jan 2016
so I tried researching about the error, and then it led me to this link, there was a lot about installing RVM but I couldn't due to curl(60) error - so I checked another probable cause which described a diagnosis that I should upgrade my openssl. So...
I tried to install homebrew so that it would let me update openssl, created a .bash_profile with this PATH="/usr/local/bin:$PATH"
executed this to terminal /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and then another error occured:
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
I already checked my certificates and there are no expired ones.
If there are still any other details you need to know to help me please let me know. I'm really desperate already... I just want to move on and learn SASS. T_T
Just in case someone had this problem.. It's due to proxy. Just use http. Thanks.
I'm attempting to save something to my DB but the default flow requires a successful call to geocode lat/lng before saving, which is when this error is thrown.
The error I get is:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
I googled it and found what seemed to be a similar issue with RubyGems. I followed the instructions to manually change the ssl by downloading a new one and copying it into the ssl_certs directory to no avail.
My environment:
OpenSSL 0.9.8zh 14 Jan 2016
RVM 1.29.1
Ruby 2.2.2p95
Rails 4.2.7
Try running
gem update --system
Also make sure your openssl is linked
brew link openssl
I was able to resolve my issue with what I consider to be a bit of a hack, but it may work for you. I just disabled SSL verification in the controller that throws the error with the following line of code:
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
From what I can tell, there's an issue with what certs Ruby and RVM use and it differs between versions. Every fix I tried involved downloading new certs and manually placing them in the Ruby or OpenSSL directories but that didn't work. Here are some of the resources I consulted during this adventure:
Coderwall
Toadle.me
Mislav
I've been at this upgrade for multiple hours now and am finally truly stuck.
It all started when I received the typical Bundler::Fetcher::CertificateFailureError. After much tinkering I think I have everything upgraded to the most current version
$ gem -v
2.6.9
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
$ bundle -v
Bundler version 1.14.2
At some point I changed my gem source with
$ gem sources --remove http://rubygems.org
$ gem sources --add http://rubygems.org
I've also changed my Gemfile to http
When I run `bundle install' I get the following error (note, I had to manually break the bit.ly url to post the content of the error)
Fetching source index from https://rails-assets.org/
Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rails-assets.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit. ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rails-assets.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit. ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rails-assets.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit. ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Could not verify the SSL certificate for https://rails-assets.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see http://bit. ly/ruby-ssl. To connect
without using SSL, edit your Gemfile sources and change 'https' to 'http'.
enter code here
So I'm right back where I started from. On a side note, I'm now getting another error when I try to https: to my gem sources but that might be better as a different question after I get this one taken care of.
Try changing the rails-assets source to http://insecure.rails-assets.org/
It might be caused by RubyGems' move from SHA-1 to SHA-2. Here's a helpful guide on their website on how to fix the issue
If that and the guides in the bitly didn't fix it, you might have to reinstall. I've encountered this before and nothing seemed to work even after ensuring that my certificates were up to date; luckily, a reinstall seemed to fix it.
You can update the openssl package
C:\>gem install rhc
ERROR: Could not find a valid gem 'rhc' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/latest_specs.4.8.gz)
tried with the following commands:
gem sources -r https://rubygems.org
gem sources -a http://rubygems.org
But still same error exists when trying to setup rhc.
rhc setup
By following these steps rhc gem is installed successfully, but when executing "rhc setup" for connecting to openshift here is the error message rather connecting to openshift server
The problem is that your Windows machine does not recognize the rubygems server certificate as a trusted certificate because Windows don't have its authority certificate present in its trusted certs store.
As a quick fix you'd need to remove the HTTPS version of the rubygems source URL (not HTTP as you did):
gem sources -r https://rubygems.org
This quick fix should make rubygems use the HTTP version which has no certificate checks involved.
But this should not be the definitive fix. Instead you should add the HTTPS source back (using the -a option) and install a proper CA certificate for the rubygems server cert into your windows trusted CA certs store.
There are quite a few pages that deal with this procedure on the net (google this), e.g. the post here has steps to download and install all CA certificates from the curl command, to your Windows machine, that fixes the problem permanently and without lowering security.
The reason and fix for the problem is stated here
Previously, this certificate was provided by one Certificate Authority, but the new certificate is provided by a different one.
Because of this, verions of RubyGems with both certificates were released, in an attempt to simplify the change.
However, at the scale RubyGems operates at, it’s impossible to make sure everybody updates the software. There are also operating systems shipping with old versions. As such, sometimes manual intervention (as described above) is required.
This has been described on Issue #1050
To fix the problem, follow these steps:
Download rubygems-update-2.6.7.gem. The download should be saved in a location you can later easily point to. Let's use like C:\rubygems-update-2.6.7.gem
On the command line, run the following commands:
C:\>gem install --local C:\rubygems-update-2.6.7.gem
C:\>update_rubygems --no-ri --no-rdoc
Run the following commands to uninstall rubygems-update:
C:\>gem uninstall rubygems-update -x
This should solve the problem.
I am working on a Windows 7 64-bit machine. I had Ruby version 2.1.5 installed on my machine and everything was working great. I went and installed a gem that would set up a project for you with most of the basics already completed, but it required Ruby 2.2.2. I went and researched how to upgrade my Ruby version and the best solution I found was to install the Pik gem for windows and install 2.2.2 separately, and switch between the two versions.
I followed a tutorial on YouTube for how to set up Pik. I normally use Git Bash but the tutorial required me to use the cmd.exe prompt to set up Pik, and then it included a way to use Pik with Git Bash at the end of the tutorial. I also had to add a file to my PATH in the system settings.
I was able to set up Pik and everything worked great with Pik on both the cmd.exe and Git Bash consoles. However, from there if I went to run any other commands such as bundle install, I would get an error:
Could not locate gemfile.
I have also experienced the same error, but it would say something along the lines of an issue with the .bundle/directory. I tried switching to a project that I had already created in the past and tried running the command again. It still had the same error. (I did this to see if the gemfile in the project would fix anything.) If I try running gem install rails, I have had it work once or twice - but I still have the 'no gemfile' issue after the fact.
The times the command doesn't work I often get:
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B:
certificate verify failed
(https://api.rubygems.org/latest_specs.4.8.gz).
I tried running the pik gem and pik gemsync commands to see if that would fix my issues but it did not.
I tried uninstalling Pik by doing the pik implode command and deleting the files it created. The issue still persisted. I tried uninstalling the 2.2.2 version of Ruby using the uninstall executable in the file, and deleting any left over file(s). The issue still persisted. I tried to uninstall and reinstall Ruby completely from my machine, the 2.1.5 version that is doing the same method as the 2.2.2 version. Yet the issue still persists no matter what I do. I have tried many times uninstalling and reinstalling both Ruby versions, from the executable and from the control panel. I would like to find a way to completely uninstall and reinstall all of Ruby if possible, preferably reinstall Ruby 2.2.2. Or if anyone else has any other ideas for how to fix this issue?
from there if I went to run any other commands such as bundle install I would get an error Could not locate Gemfile.
As you've guessed, you need a file named gemfile in the same location you are running bundle install from
If I try running gem install rails I have had it work once or twice but I still have the no gemfile issue after the fact.
Running gem install <package> doesn't create a gemfile for you. You need to do this yourself. It's essentially a file where you manually specify which packages you would like your project to use. See here on how to create.
The times the command doesn't work I often get: "ERROR: Could not find a valid gem 'rails' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect retur ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed ( https://api.rubygems.org/latest_specs.4.8.gz)."
This sometimes happens on Windows machine. You can do a quick search on how to fix the gem command with SSL, or in your Gemfile you can temporarily specify http://rubygems.org/ instead of https://rubygems.org/