Tag: ruby version manager

Ruby 1.9.3 + OpenSSL::SSL::SSLError issue

Problem

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3
read server certificate B: certificate verify failed
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in
`connect'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in
`block in connect'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:68:in
`timeout'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in
`timeout'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in
`connect'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in
`do_start'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:750:in
`start'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/xmlrpc/client.rb:535:in
`do_rpc'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/xmlrpc/client.rb:420:in
`call2'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/xmlrpc/client.rb:410:in
`call'
from /path/infusionsoft/connection.rb:15:in
`connection'
from /path/infusionsoft/request.rb:29:in
`request'
from /path/infusionsoft/request.rb:5:in
`get'
from /path/infusionsoft/client/contact.rb:59:in
`contact_find_by_email'
from /path/infusionsoft.rb:18:in
`method_missing'
from (irb):2
from /path/rails/commands/console.rb:45:in
`start'
from /path/rails/commands/console.rb:8:in
`start'
from /path/rails/commands.rb:40:in
`<top (required)>'
from ./script/rails:6:in `require'
from ./script/rails:6:in

Solution

To work this around, we need to overwrite use_ssl method:

module Net
  class HTTP
    def use_ssl=(flag)
      flag = flag ? true : false
      if started? and @use_ssl != flag
        raise IOError, "use_ssl value changed, but session already started"
      end
      @use_ssl = flag
      if @use_ssl
        self.verify_mode = OpenSSL::SSL::VERIFY_NONE
      end
    end
  end
end

RVM, Ruby 1.9.3-p194, ruby-debugger and “You need to install ruby-debug” on Ubuntu 11.10

Recently I've been upgrading my RVM and Ruby versions. After upgrade I've encountered a problem connected to ruby-debugger. When starting Rails server I always ended with such a message:

You need to install ruby-debug to run the server in debugging mode. 
With gems, use 'gem install ruby-debug'

# Edit: this solutions fixes also this problem:

cannot load such file -- zlib

Ruby-debbug doesn't work to well with Ruby 1.9, so I use following combination in my gemsets:

group :development, :test do
  gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
  gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
  gem 'ruby-debug19'
end

Until now, it worked really well, but after the upgrade, the "You need to install ruby-debug" message kept showing again and again (even when the gems from list above were installed). To fix this issue, you need to run following commands:

rm -rf $rvm_path/usr
rvm pkg install zlib

# Posted in 5 lines instead of 1 for better visibility
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev 
sudo apt-get install curl git-core zlib1g zlib1g-dev libssl-dev
sudo apt-get install libyaml-dev  libsqlite3-0 libsqlite3-dev sqlite3
sudo apt-get install libxml2-dev  libxslt-dev autoconf libc6-dev 
sudo apt-get install ncurses-dev automake libtool bison subversion

rvm reinstall 1.9.3-p194

After successful Ruby version reinstall, you should be able to run ruby software with debugger enabled.

# Update
Looks like, you can (as guys suggested in comments) debugger instead of ruby-debugger, however the method above fixes also problem with:

cannot load such file -- zlib

Copyright © 2024 Closer to Code

Theme by Anders NorenUp ↑