Skip to content

bundle install failed since "Could not verify the SSL certificate" #8243

@sandy-lcq

Description

@sandy-lcq

Describe the problem as clearly as you can

bundle install failed with following error:

Could not verify the SSL certificate for https://rubygems.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 https://railsapps.github.io/openssl-certificate-verify-failed.html. To connect
without using SSL, edit your Gemfile sources and change 'https' to 'http'.

On ubuntu22.04:

$ bundle --version
Bundler version 2.3.5
$ ruby --version
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]

I tried sudo update-ca-certificate, not works,
I think my cert is ok, since curl -v https://rubygems.org/ works well, I can see ssl cert passed.

I tried export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt, not works

Did you try upgrading rubygems & bundler?

$ gem update --system
ERROR:  Your RubyGems was installed trough APT, and upgrading it through RubyGems
itself is unsupported. If you really need the latest version of RubyGems (tip:
you usually don't), then you need to install RubyGems (and Ruby) manually,
maybe using tools like ruby-install, rvm, etc.

$ bundle update --bundler
# will also failed with ssl cert failure

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions