# \[SOLVED\] New install of 5.8 fails to install ruby

**URL:** https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966
**Category:** Installation & Configuration
**Tags:** solved
**Created:** [March 1, 2019, 1:27pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966 "2019-03-01T13:27:06Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 1, 2019, 1:27pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/1 "2019-03-01T13:27:06Z")

</div>

Hi all,

Having successfully installed 5.6 on Ubuntu a few weeks ago I had to wipe that server and reinstall it with CentOS 7. I then followed the instructions to install Opennebula 5.8 using the repositories.  
Installing the ON stuff using yum(1) went fine but the ‘install\_gems’ script fails with:  
…  
1: from /usr/local/lib/ruby/2.6.0/rubygems/core\_ext/kernel\_require.rb:54:in `require' /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require’: cannot load such file – zlib (LoadError)  
#

ZLib itself is already installed:

# yum list installed | grep -i zlib  
perl-Compress-Raw-Zlib.x86\_64 1:2.061-4.el7 @anaconda  
zlib.x86\_64 1.2.7-18.el7 @base  
zlib-devel.x86\_64 1.2.7-18.el7 @base  
#

So I don’t know what’s causing the problem. Can you give me some pointers?

|\/|

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 1, 2019, 2:39pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/2 "2019-03-01T14:39:21Z")

</div>

Hi @MartinW

Could you please send me the output of `gem list | grep zlib`?

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 1, 2019, 4:12pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/3 "2019-03-01T16:12:23Z")

</div>

It returns nothing:

# gem list | grep -i zlib  
#

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 4, 2019, 9:10am UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/4 "2019-03-04T09:10:16Z")

</div>

The output from “gem list” is:

# gem list

\*\*\* LOCAL GEMS \*\*\*

abrt (0.3.0)  
bigdecimal (1.2.0)  
bundler (1.17.3)  
io-console (0.4.2)  
json (1.7.7)  
nokogiri (1.6.1)  
psych (2.0.0)  
rake (0.9.6)  
rdoc (4.0.0)  
#

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 4, 2019, 10:45am UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/5 "2019-03-04T10:45:40Z")

</div>

Hi @MartinW

Try to install zlib manually using `gem install`, you need to know the version that fits with your ruby version. Here [https://rubygems.org/gems/zlib/versions/0.1.0](https://rubygems.org/gems/zlib/versions/0.1.0) you can find more information about the version.

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 4, 2019, 11:54am UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/6 "2019-03-04T11:54:39Z")

</div>

That’s worrying:

# gem install zlib  
Fetching: zlib-1.0.0.gem (100%)  
ERROR: Error installing zlib:  
zlib requires Ruby version \>= 2.3.0.  
# ruby -v  
ruby 2.0.0p648 (2015-12-16) [x86\_64-linux]  
#

I ran “yum update ruby” but it’s at the latest version that is available from the default CentOS repos.

Where would I get a stable-but-more-recent ruby install?

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 4, 2019, 1:26pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/7 "2019-03-04T13:26:56Z")

</div>

Try using `gem install zlib -v 0.1.0`.

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 4, 2019, 5:17pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/8 "2019-03-04T17:17:53Z")

</div>

No luck. I tried it with version 0.1.0 and 0.0.1, both failed due to the Ruby version:

# gem install zlib -v 0.1.0  
Fetching: zlib-0.1.0.gem (100%)  
ERROR: Error installing zlib:  
zlib requires Ruby version \>= 2.5.0dev.  
# gem install zlib -v 0.0.1  
Fetching: zlib-0.0.1.gem (100%)  
ERROR: Error installing zlib:  
zlib requires Ruby version \>= 2.5.0dev.  
# ruby --version  
ruby 2.0.0p648 (2015-12-16) [x86\_64-linux]  
#

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 5, 2019, 8:49am UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/9 "2019-03-05T08:49:51Z")

</div>

Maybe you can try using RVM ([https://rvm.io/](https://rvm.io/)) to update your ruby version.

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 5, 2019, 12:45pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/10 "2019-03-05T12:45:11Z")

</div>

Not entirely sure that helped. I used RVM and it installed a newer version of ruby in /usr/local/bin . After fixing some PATH issues I now get a newer version:

```
# ruby -v
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]
#

```

Now when I run “/usr/share/one/install\_gems” I get:

`ruby openssl libraries are needed. They usually come as companion package to ruby.`

I ignored that and tried to install the zlib library, but it now fails with:

```
# gem install zlib -v 0.1.0
ERROR: Loading command: install (LoadError)
	cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

```

I get the same error whether I specify the version or not.

I have confirmed that zlib and OpenSSL are installed:

```
# yum install zlib
...
Package zlib-1.2.7-18.el7.x86_64 already installed and latest version
Nothing to do\# yum install openssl
...
Package 1:openssl-1.0.2k-16.el7.x86_64 already installed and latest version
Nothing to do
# 

```

I made sure that autolibs was enabled in case that was the problem and reinstalled ruby and rails, but I still ge the “ruby openssl libraries are needed” error.

I have “openssl-devel” installed (required for ruby, it seems).

I tried “gem install bundler” and it returned

```
ERROR: Loading command: install (LoadError)
	cannot load such file -- zlib

```

which strongly suggests that zlib is required to just get the install command working, so “gem install zlib” is surely never going to work since there is a circular dependency there.

Any other thoughts?

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 5, 2019, 2:26pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/11 "2019-03-05T14:26:02Z")

</div>

As you are using centos, try to install stock ruby and no custom ruby.

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 5, 2019, 2:44pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/12 "2019-03-05T14:44:01Z")

</div>

Hmm, I thought that’s what I had done, but OK, I will see what I can do.

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 5, 2019, 4:16pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/13 "2019-03-05T16:16:10Z")

</div>

OK, I found the problem. I had tried to compile an up to date ruby from source which I thought I had removed, but in fact had not and this was the 2.5 release that I was executing, so the zlib issue was entirely due to the fact hat I had not compiled zlib in to that software.

I removed it, re-ran the RVM install, installed v2.5 and confirmed that it’s working. I then added “rvm use 2.5” to root’s profile as otherwise it insists on using the default ruby.

So I now have root using the correct ruby, but it’s missing the ‘bundler’ script/software/whatever-it-is. A little research gets me “gem install bundler”, so I have that command.

Now, if I run the /usr/share/one/install\_gems script as root it says:

```
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.

```

although it does install the files. If I run is as my own UID it tells me I have to run the script as root…

Well, I let it run to completion and it looks like it installed OK, but sadly Sunstone fails to start.

I set the oneadmin user so that it is using the correct ruby by adding “rvm use 2.5” to the end of its .bash\_profile but it fails to start. Running “systemctl start opennebula-sunstone” fails with the following errors in the messages file:

```
Mar 5 16:07:49 vmhost abrt[25091]: detected unhandled Ruby exception in '/usr/lib/one/sunstone/sunstone-server.rb'
Mar 5 16:07:49 vmhost abrt-server: Package 'opennebula-sunstone' isn't signed with proper key
Mar 5 16:07:49 vmhost ruby: from /usr/lib/one/sunstone/sunstone-server.rb:88:in `<main>'
Mar 5 16:07:49 vmhost systemd: opennebula-sunstone.service: main process exited, code=exited, status=1/FAILURE
Mar 5 16:07:49 vmhost systemd: Unit opennebula-sunstone.service entered failed state.
Mar 5 16:07:49 vmhost systemd: opennebula-sunstone.service failed.

```

I don’t know what the issue is and I’m rather poking around in the dark with RVM. It looks like it’s installed OK though, at least I get the right version number:

```
# ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]

```

Any further thoughts?

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 5, 2019, 4:33pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/14 "2019-03-05T16:33:22Z")

</div>

I poked around some more and found that if I changed to the oneadmin user and ran:  
`$ /usr/lib/one/sunstone/sunstone-server.rb`  
then it works fine and I can get the login page up in a browser.

I then ran it using the built-in ruby and it coredumped, which is linked to the error message I see in /var/log/messages. This suggests that the service is not executing oneadmin’s profile before starting the service.

So, how do I get the RVM-installed ruby to be the default one?

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 6, 2019, 11:24am UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/15 "2019-03-06T11:24:01Z")

</div>

Hello @MartinW

Could you please send me the output of `gem env`?

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 6, 2019, 2:03pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/16 "2019-03-06T14:03:23Z")

</div>

Certainly:

```
# gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.9
  - RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.5.3
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.5.0
  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.5.3/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.5.3/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/rvm/rubies/ruby-2.5.3/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.5.3
     - /usr/local/rvm/gems/ruby-2.5.3@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/rvm/gems/ruby-2.5.3/bin
     - /usr/local/rvm/gems/ruby-2.5.3@global/bin
     - /usr/local/rvm/rubies/ruby-2.5.3/bin
     - /usr/local/rvm/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /sbin
     - /bin
     - /usr/sbin
     - /usr/bin
     - /root/bin
```

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 6, 2019, 3:46pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/17 "2019-03-06T15:46:14Z")

</div>

It seems that you have the ruby installed just on root (USER INSTALLATION DIRECTORY) try to install in oneadmin’s home.

This is an example on centos7:

```auto
RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.14.1
  - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/one/.gem/ruby
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /var/lib/one/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/one/.gem/ruby
     - /usr/share/gems
     - /usr/local/share/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/

```

---

<div class="post-metadata">

### Author: ![MartinW](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/martinw/32/5920_2.png) [@MartinW](https://forum.opennebula.io/u/MartinW)
#### Post date: [March 7, 2019, 2:36pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/18 "2019-03-07T14:36:58Z")

</div>

Thanks for the suggestion. I ran “rvm remove” as root to get rid of the existing installation, removed the various shell hacks I’d put in to oneadmin’s profile, then ran “rvm install 2.5” as the oneadmin user.

It all seems to be up and running fine now, my “gem env” looks like:  
RubyGems Environment:  
- RUBYGEMS VERSION: 2.7.9  
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86\_64-linux]  
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.5.3  
- USER INSTALLATION DIRECTORY: /var/lib/one/.gem/ruby/2.5.0  
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.5.3/bin/ruby  
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.5.3/bin  
- SPEC CACHE DIRECTORY: /var/lib/one/.gem/specs  
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/rvm/rubies/ruby-2.5.3/etc  
- RUBYGEMS PLATFORMS:  
- ruby  
- x86\_64-linux  
- GEM PATHS:  
- /usr/local/rvm/gems/ruby-2.5.3  
- /usr/local/rvm/gems/ruby-2.5.3@global  
- GEM CONFIGURATION:  
- :update\_sources =\> true  
- :verbose =\> true  
- :backtrace =\> false  
- :bulk\_threshold =\> 1000  
- REMOTE SOURCES:  
- [https://rubygems.org/](https://rubygems.org/)  
- SHELL PATH:  
- /usr/local/rvm/gems/ruby-2.5.3/bin  
- /usr/local/rvm/gems/ruby-2.5.3@global/bin  
- /usr/local/rvm/rubies/ruby-2.5.3/bin  
- /usr/lib64/qt-3.3/bin  
- /usr/local/bin  
- /bin  
- /usr/bin  
- /usr/local/sbin  
- /usr/sbin  
- /usr/local/rvm/bin  
- /var/lib/one/.local/bin  
- /var/lib/one/bin

I can access the sunone web interface and I now have it connected to my local virsh installation, so I think we are good!

Thank you very much for your patience and assistance @ahuertas.

---

<div class="post-metadata">

### Author: ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)
#### Post date: [March 7, 2019, 4:18pm UTC](https://forum.opennebula.io/t/solved-new-install-of-5-8-fails-to-install-ruby/6966/19 "2019-03-07T16:18:39Z")

</div>

That’s so nice 😃 if you have any doubts you can contact me, it was a pleasure to help you @MartinW!
