Unsupported digest algorithm (sha256)

Hi,

Anybody can help me on this error:

/usr/local/lib/ruby/1.8/openssl/digest.rb:55:in initialize': Unsupported digest algorithm (sha256). (RuntimeError) from /usr/local/lib/ruby/1.8/openssl/digest.rb:55:ininitialize’
from
/export/home/prjer/er/app/controllers/register_controller.rb:7:in new' from /export/home/prjer/er/app/controllers/register_controller.rb:7 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require’
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require’

but i can run the command:

$ ruby -ropenssl -e ‘p OpenSSL::Digest::Digest.new(“sha256”)’
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
$ ruby -e “puts require(‘openssl’)”
true

from other’s post, i also get this:
$ gem search openSSL -r

*** REMOTE GEMS ***

jruby-openssl (0.7.2)
JRuby-OpenSSL (0.1)
openssl-extensions (1.0.0)
openssl-nonblock (0.2.1)
pftg-jruby-openssl (0.5.3)
ruby-hmac-openssl (0.1.0)
tem_openssl (0.3.6)

Appreciate the help in advance.

Hi,

The fact that you can use sha256 from the command line but not in your
app makes me wonder: is it possible you are using a different
installation of Ruby in your app than on the command line?

According to the stack dump, your app is using the one in
/usr/local/lib.

I think this will tell you which Ruby your command line is using:

$ ruby -e ‘puts Gem.ruby’

Brian Morearty

Hi Brian,

Thanks for your suggestion, but I get the error message after running
the command:

$ ruby -e ‘puts Gem.ruby’
-e:1: uninitialized constant Gem (NameError)

How ironic. :slight_smile:

Ok, how about just:

$ which ruby

Thanks Brian for your prompt response. Following are my environment
settings:

$ which ruby
/usr/local/bin/ruby

$ gem environment
RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.1
  • RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [sparc-solaris2.10]
  • INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  • RUBY EXECUTABLE: /usr/local/bin/ruby
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • sparc-solaris-2.10
  • GEM PATHS:
    • /usr/local/lib/ruby/gems/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

do i need to re-install my ruby?

do i need to re-install my ruby?

Yes, that’s what I would do. In fact that’s what I did when I had a
similar problem on my Mac on the weekend, although in my case there was
no difference in behavior between the command line and my app.

My notes are here:
http://ilikestuffblog.com/2011/01/22/how-to-fix-ruby-error-unsupported-digest-algorithm-sha256/

Unlike you, I was using rvm. It’s something to consider as long as
you’re reinstalling. Supposedly rvm works on Solaris although there
isn’t a dedicate page for Solaris on the rvm site. There is this:
http://rvm.beginrescueend.com/os/other/

A few notes:

  • If you recompile ruby, it might help to download openssl from
    http://openssl.org and then use whatever command-line option points the
    ruby compiler to that downloaded version. It didn’t work for me but you
    have have more luck.
  • Here’s someone else who solved a similar problem by downloading
    openssl–but he was using rvm:
    http://ionrails.com/2010/12/25/deploy-to-ec2-with-rubber/

Good luck! This could take a while. It took me several hours to get
working.

Brian

On Thu, Jan 20, 2011 at 12:11 PM, yf kuanfai [email protected]
wrote:

gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’

that errs comes from your app

but i can run the command:

$ ruby -ropenssl -e ‘p OpenSSL::Digest::Digest.new(“sha256”)’
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
$ ruby -e “puts require(‘openssl’)”
true

the simple ruby command works. openssl is working.

one of the gems in your app is screwing openssl. suggest to list all
the gems your app is using and open the gem one at a time until the
digest returns the error. this way you can catch the offending gem

kind regards -botp

On Tue, Jan 25, 2011 at 11:49 PM, yf kuanfai [email protected] wrote:

also add the newer sources

do i need to re-install my ruby?

why? you haven’t shown anything wrong with your ruby…

kind regards -botp

On Tue, Jan 25, 2011 at 2:46 PM, yf kuanfai [email protected]
wrote:

$ ruby -e ‘puts Gem.ruby’
-e:1: uninitialized constant Gem (NameError)

expected. you’re using 1.8.

kind regards -botp

I have just re-installed my ruby and now it gives new error. I feel
really frustrating that ruby is so hard to install.

/usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:259:in
require_frameworks': ld.so.1: ruby: fatal: relocation error: file /usr/local/lib/ruby/1.8/sparc-solaris2.10/openssl.so: symbol EC_GROUP_new_curve_GF2m: referenced symbol not found - /usr/local/lib/ruby/1.8/sparc-solaris2.10/openssl.so (RuntimeError) from /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:133:inprocess’
from
/usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in
send' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:inrun’
from /export/home/prdem/em/public/…/config/environment.rb:13
from /export/home/prdem/em/public/dispatch.fcgi:21:in `require’
from /export/home/prdem/em/public/dispatch.fcgi:21

and i checked my new installation is exactly the same as another server
which is working fine.

/usr/local/bin/gem check --alien

Performing the ‘alien’ operation
rake-0.8.7 is error-free

activesupport-2.2.2 is error-free

activesupport-2.3.2 is error-free

composite_primary_keys-2.2.2 is error-free

fastercsv-1.4.0 is error-free

rails-2.2.2 has 2 problems
lib/fcgi_handler.rb:
installed file doesn’t match original from gem

    /usr/local/lib/ruby/gems/1.8/cache/rails-2.2.2.gem:
    Unmanaged files in gem: ["lib/fcgi_handler.rb.orig"]

fcgi-0.8.7 has 1 problems
/usr/local/lib/ruby/gems/1.8/cache/fcgi-0.8.7.gem:
Unmanaged files in gem: [“ext/fcgi/fcgi.so”, “ext/fcgi/fcgi.o”,
“ext/fcgi/Makefile”, “ext/fcgi/mkmf.log”, “lib/fcgi.so”]

activeresource-2.2.2 is error-free

activerecord-2.2.2 is error-free

actionpack-2.2.2 is error-free

actionmailer-2.2.2 is error-free

activerecord-oracle-adapter-1.0.0.9250 is error-free

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs