Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install MRI Rubies on RHEL 6 (missing libyaml-devel) #3175

Merged
merged 3 commits into from Dec 5, 2014

Conversation

mpapis
Copy link
Member

@mpapis mpapis commented Dec 5, 2014

We've been successfully using rvm on an un-changed RHEL 6 image, even up until a couple of days ago. Now, provisioning a new instance of it, installations fail with this:

Searching for binary rubies, this might take some time.
No binary rubies available for: redhat/6/x86_64/ruby-2.1.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for redhat.

Skipping installation of 'libffi-devel', in case you depend on FFI reinstall your ruby after following this instructions:
    https://gist.github.com/rderoldan1/5920539

Installing requirements for redhat.
Updating system.
Installing required packages: libyaml-devel..
Error running 'requirements_centos_libs_install libyaml-devel',
showing last 15 lines of /usr/local/rvm/log/1417646673_ruby-2.1.2/package_install_libyaml-devel.log
++ __rvm_try_sudo yum install -y libyaml-devel
++ typeset -a command_to_run
++ typeset sudo_path sbin_path missing_paths
++ command_to_run=("$@")
++ ((  UID == 0  ))
++ yum install -y libyaml-devel
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security,
              : subscription-manager
No package libyaml-devel available.
Error: Nothing to do
++ return 1
++ return 1
Requirements installation failed with status: 1.

Looking at the EPEL repos, it looks like the libyaml-devel package is gone. Finding a couple stale repos that probably haven't synced yet, it's still out there, but any current one it's missing. So either they removed it or someone messed up and the mistake got propagated. I can't find mention of it anywhere.

I saw in #2998 that RHEL 7 is also missing this library, so I extended the fix from 4538416 to apply to RHEL 6 as well, and the libyaml will install, along with the desired Ruby (2.1.2 in my case), but a RubyGems install step of some kind fails saying psych.so can't find libyaml.so, I'm guessing I have something missing in my library path?

Error running 'env GEM_HOME=/usr/local/rvm/gems/ruby-2.1.2@global GEM_PATH= /usr/local/rvm/rubies/ruby-2.1.2/bin/ruby -d /usr/local/rvm/src/rubygems-2.4.5/setup.rb --no-document',
showing last 15 lines of /usr/local/rvm/log/1417648601_ruby-2.1.2/rubygems.install.log
/usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/core_ext/kernel_require.rb:54:in `require': libyaml-0.so.2: cannot open shared object file: No such file or directory - /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/x86_64-linux/psych.so (LoadError)
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:1:in `<top (required)>'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/yaml.rb:5:in `<top (required)>'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems.rb:624:in `load_yaml'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/config_file.rb:328:in `load_file'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/config_file.rb:197:in `initialize'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/gem_runner.rb:74:in `new'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/gem_runner.rb:74:in `do_configuration'
    from /usr/local/rvm/src/rubygems-2.4.5/lib/rubygems/gem_runner.rb:39:in `run'
    from setup.rb:45:in `<main>'

Any advice? Is this an upstream thing?

Thanks!

@nickveys
Copy link
Contributor Author

nickveys commented Dec 4, 2014

Looks like CVE-2014-9130[1] prompted them to drop the EPEL 6 version of libyaml, and -devel went along with it[2].

Supposedly RHEL 6.6 now includes the libyaml library so this may be fixed by an OS update.

  1. https://security-tracker.debian.org/tracker/CVE-2014-9130
  2. https://bugzilla.redhat.com/show_bug.cgi?id=1169372

@mpapis
Copy link
Member

mpapis commented Dec 4, 2014

@nickveys can you try to update? I really don't get epel maintainers.

@nickveys
Copy link
Contributor Author

nickveys commented Dec 4, 2014

Yeah it seems to undermine the stability of that repo for sure. I'll update as soon as I get a chance to run through the installation process on an updated RHEL 6.6 install. Ideally tomorrow.

@nickveys
Copy link
Contributor Author

nickveys commented Dec 5, 2014

Ok, it seems like it's truly gone. There is a source RPM in the RHEL 6 SRPMS repo, but it's v0.1.3 from April 2014, there are at least two CVE's against that I thought. One could build the RPMs from the SRPM, then install libyaml and libyaml-devel, but that seems more messy than just adding RHEL 6 to the list of OSs to build libyaml from scratch, does it not?

I tried applying the following patch:

--- rvm/scripts/functions/requirements/redhat 2014-12-05 13:59:26.000000000 -0600
+++ /root/redhat  2014-12-05 13:39:55.000000000 -0600
@@ -49,7 +49,7 @@
 requirements_centos_update_system_check_epel()
 {
   [[ " ${packages_to_install[*]} " == *" libyaml-devel "* ]] || return 0
-  [[ "${_system_name} ${_system_version}" != "RedHat 7" ]] || return 0
+  [[ ! "${_system_name_lowercase}" == "redhat" && ${_system_version:-0} -ge 6 ]] || return 0
   # if you change this, change the scripts/functions/pkg version too
   [[ -f /etc/yum.repos.d/epel.repo ]] ||
   requirements_centos_lib_installed libyaml-devel ||
@@ -120,7 +120,7 @@
       ;;
     (*)
       if
-        [[ "${_system_name} ${_system_version}" == "RedHat 7" ]]
+        [[ "${_system_name_lowercase}" == "redhat" && ${_system_version:-0} -ge 6 ]]
       then
         requirements_check pkgconfig
         requirements_rvm_pkg_lib_installed_custom yaml
@@ -156,7 +156,7 @@
 requirements_centos_after()
 {
   if
-    [[ "${_system_name} ${_system_version}" == "RedHat 7" ]]
+    [[ "${_system_name_lowercase}" == "redhat" && ${_system_version:-0} -ge 6 ]]
   then
     requirements_rvm_pkg_configure yaml
   fi

It will get the libyaml library to build in the /usr/local/rvm/usr/lib, but again, psych can't see it during the RubyGems installation (see previous comment). There is one apparent error during the process:

Installing required custom packages: yaml..................................
xargs: command: No such file or directory

Looking into it, it's happening in __rvm_update_configure_opt_dir_flags, which looks related to setting up compiler flags, maybe this affects the RubyGems library path during that install later? I don't know RVM internals well enough at this point.

Anything I can try?

@mpapis
Copy link
Member

mpapis commented Dec 5, 2014

ok created branch with your changes, you can get it with:

rvm get branch /bugfix/compile_yaml_on_redhat_6_gh_3175

and test it with:

rvm install 2.1.2

@mpapis mpapis added this to the rvm-1.26 milestone Dec 5, 2014
@nickveys
Copy link
Contributor Author

nickveys commented Dec 5, 2014

Fantastic, this builds successfully and I can run irb. 🎉

@mpapis mpapis merged commit f144f68 into master Dec 5, 2014
mpapis added a commit that referenced this pull request Dec 5, 2014
@mpapis
Copy link
Member

mpapis commented Dec 5, 2014

merged to master => rvm get head

@mpapis mpapis deleted the bugfix/compile_yaml_on_redhat_6_gh_3175 branch December 5, 2014 22:46
@pkuczynski pkuczynski added this to the unknown-old milestone Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants