rvm install fails on Ubuntu 11.10

I recently ran into this problem after upgrading to Oneiric (I’ll keep my opinions to myself on that upgrade; suffice to say I am very much using the “GNOME Classic Fallback, Ancient Thing, For Grumpy People” instead of Unity).

More recent versions of OpenSSL remove SSLv2 entirely, due to the protocol being insecure. Certain versions of Ruby obviously still attempt to use a couple of these old entry points, which will result in RVM erroring out:

Installing Ruby from source to: /home/baughj/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...

ruby-1.9.2-p180 - #fetching 
ruby-1.9.2-p180 - #extracted to /home/baughj/.rvm/src/ruby-1.9.2-p180 (already extracted)
Fetching yaml-0.1.4.tar.gz to /home/baughj/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /home/baughj/.rvm/src
Configuring yaml in /home/baughj/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/baughj/.rvm/src/yaml-0.1.4.
Installing yaml to /home/baughj/.rvm/usr
ruby-1.9.2-p180 - #configuring 
ruby-1.9.2-p180 - #compiling 
ERROR: Error running 'make ', please read /home/baughj/.rvm/log/ruby-1.9.2-p180/make.log
ERROR: There has been an error while running make. Halting the installation.

If you examine the logs, you’ll see that the issue is the missing SSL methods for v2:

ossl_ssl.c:110:1: error: ‘SSLv2_method’ undeclared here (not in a function)
ossl_ssl.c:111:1: error: ‘SSLv2_server_method’ undeclared here (not in a function)
ossl_ssl.c:112:1: error: ‘SSLv2_client_method’ undeclared here (not in a function)

You can fix this really easily, by simply removing the entries for SSLv2, in ext/openssl/ossl_ssl.c:

--- ruby-1.9.2-p180/ext/openssl/ossl_ssl.c	2010-12-23 22:24:00.000000000 -0500
+++ ruby-1.9.2-p180/ext/openssl/ossl_ssl_fixed.c	2011-10-28 11:39:30.265970001 -0400
@@ -107,9 +107,9 @@
     OSSL_SSL_METHOD_ENTRY(TLSv1),
     OSSL_SSL_METHOD_ENTRY(TLSv1_server),
     OSSL_SSL_METHOD_ENTRY(TLSv1_client),
-    OSSL_SSL_METHOD_ENTRY(SSLv2),
-    OSSL_SSL_METHOD_ENTRY(SSLv2_server),
-    OSSL_SSL_METHOD_ENTRY(SSLv2_client),
+    // OSSL_SSL_METHOD_ENTRY(SSLv2),
+    // OSSL_SSL_METHOD_ENTRY(SSLv2_server),
+    // OSSL_SSL_METHOD_ENTRY(SSLv2_client),
     OSSL_SSL_METHOD_ENTRY(SSLv3),
     OSSL_SSL_METHOD_ENTRY(SSLv3_server),
     OSSL_SSL_METHOD_ENTRY(SSLv3_client),

Then, you just install normally, using RVM to apply the patch:

rvm install ruby-1.9.2-p180 --patch openssl.patch 

Just thought I’d document this in case anybody else is experiencing the same issue. You’ll need to do the same thing to install Ruby EE.

14 Replies to “rvm install fails on Ubuntu 11.10”

  1. Everything worked for me except that rvm couldn’t find openssl.patch, so it ran anyway and just gave me a Ruby without v2 installed. I don’t have time to look into it until after work today, but just wanted to share the data I’ve collected.

    1. you need to save the following as the patch file:

      — ruby-1.9.2-p180/ext/openssl/ossl_ssl.c 2010-12-23 22:24:00.000000000 -0500
      +++ ruby-1.9.2-p180/ext/openssl/ossl_ssl_fixed.c 2011-10-28 11:39:30.265970001 -0400
      @@ -107,9 +107,9 @@
      OSSL_SSL_METHOD_ENTRY(TLSv1),
      OSSL_SSL_METHOD_ENTRY(TLSv1_server),
      OSSL_SSL_METHOD_ENTRY(TLSv1_client),
      – OSSL_SSL_METHOD_ENTRY(SSLv2),
      – OSSL_SSL_METHOD_ENTRY(SSLv2_server),
      – OSSL_SSL_METHOD_ENTRY(SSLv2_client),
      + // OSSL_SSL_METHOD_ENTRY(SSLv2),
      + // OSSL_SSL_METHOD_ENTRY(SSLv2_server),
      + // OSSL_SSL_METHOD_ENTRY(SSLv2_client),
      OSSL_SSL_METHOD_ENTRY(SSLv3),
      OSSL_SSL_METHOD_ENTRY(SSLv3_server),
      OSSL_SSL_METHOD_ENTRY(SSLv3_client),

  2. wow this worked for me too, all the thanks to you sir!

    it worked even though i got the warning: Patch ‘openssl.patch’ not found.

    1. You must create the file openssl.patch with the exact content baughj kindly provided in that post’s 3rd box.

  3. I think the key missing instruction is to put the text shown above (the block below “You can fix this really easily, by simply removing the entries for SSLv2, in ext/openssl/ossl_ssl.c:”) into a file called openssl.patch and then run the rvm command following it from the same directory. You might need to run it with “sudo” preceding the rvm if you’re installing ruby on the machine as the default.

    Thanks for writing this up baughj.

    Dave

  4. If you’re struggling with 1.9.2-p180 on rbenv, you can do the following:

    – create the cache directory
    – start the install, wait for it to bomb
    – untar the cached ruby file and edit ossl_ssl.c as above
    – tar the file back up
    – run md5sum on the hacked tar file
    – edit /usr/local/share/ruby-build/1.9.2-p180 and replace the md5 for the ruby download with that from above

Leave a Reply

Your email address will not be published. Required fields are marked *