Open Nebula 6 missing nokogiri lib

I have installed Open Nebula v 6 on a fresh CentOS 7.9 box and all seems to be going well, I can access the Web interface, build VMs and instantiate them. The problem is that the command-line commands don’t work:

-bash-4.2$ onecluster
Error: nokogiri gem not installed.
-bash-4.2$ onehost
Error: nokogiri gem not installed.
-bash-4.2$ whoami

I rechecked the instructions provided, according to the docs:

“Since OpenNebula 5.10, all required Ruby gems are packaged and installed into a dedicated directory /usr/share/one/gems-dist/ symlinked to /usr/share/one/gems/ . Check the details in [Front-end Installation]”

The directory and symlink are there so that’s not the problem.

I looked at the onehost script and the ONE_LOCATION subdirectories listed in there exist and contain files:

RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
GEMS_LOCATION     = '/usr/share/one/gems'
REMOTES_LOCATION  = '/var/lib/one/remotes/'

My one concern is that I cannot find any Ruby library called or containing the word “nokogiri”, so no “nokogiri.lib”, no “libnokogiri.a” etc etc.

I don’t know enough about Ruby to be able to troubleshoot this beyond here though.

Have I missed an installation step?


Versions installed:

Steps to reproduce:
See above.

Current results:
Se above

Expected results:
To be able to execute the one* command line tools.

Update: The good nes is that I found a nokogiri library in ~oneadmin/.gem/ruby/gems/nokogiri-1.12.4-x86_64-linux/lib/nokogiri.rb

From the creation date this appeared today after I ran:
$ gem install nokogiri

The bad news it that it is being ignored. I tried updating my GEM_PATH like so:
$ echo $GEM_PATH

$ export GEM_PATH=/var/lib/one/.gem/ruby/gems/nokogiri-1.12.4-x86_64-linux/lib/:/var/lib/one/.gem/ruby/gems/nokogiri-1.12.4-x86_64-linux/lib/:/var/lib/one:/var/lib/one/.gem
$ oneuser
Error: nokogiri gem not installed.

but it still fails as you can see.

If OpenNebula includes the nokogiri and other gems in its installation then why is this command failing? Everything woks via the web interface but nothing seems to work via the command line.

Still not made any progress on this although I am now even more confused. If I run “gem search nokogiri” as the oneadmin user then it finds it.

$ gem search nokogiri


backupify-rsolr-nokogiri (
epp-nokogiri (1.1.0)
glebm-nokogiri (
jwagener-nokogiri (1.4.1)
money-nokogiri-xmlsec (0.0.5)
nokogiri (1.12.4 ruby arm64-darwin java x64-mingw32 x86-linux x86-mingw32 x86_64-darwin x86_64-linux, 1.6.1 x86-mswin32-60, x86-mswin32)
nokogiri-cache (1.0.0)
$ gem install nokogiri
Successfully installed nokogiri-1.12.4-x86_64-linux
Parsing documentation for nokogiri-1.12.4-x86_64-linux
Done installing documentation for nokogiri after 1 seconds
1 gem installed
$ oneuser -h
Error: nokogiri gem not installed.

This totally confuses me because:

  1. the fact that nokogiri appears in the “Remote gems” means that it’s not installed
  2. the “gem install nokogiri” command clearly work and yet
  3. the oneuser (and other) command still fails after the successful installation of the gem.

Any thoughts?

I have moved one step forward, but it makes absolutely no sense.

For my testing I have taken a copy of the oneuser Ruby script and have been modifying it to try different things. Near the top of that script, line 23, is this line:

 GEMS_LOCATION     = '/usr/share/one/gems'

This is a valid subdirectory that contains the following:

$ ls /usr/share/one/gems
bin  build_info  doc  gems  specifications

If I run the command “oneuser -h” then it fails:

$ oneuser -h
Error: nokogiri gem not installed.

Today I made a typo in my test copy, like so:

$ diff /bin/oneuser ./oneuser-test
<     GEMS_LOCATION     = '/usr/share/one/gems'
>     GEMS_LOCATION     = '/usr/share/one/gem'

the /usr/share/one/gem subdir does not exist yet when I run this script I get:

$ ./oneuser-test  -V

`oneuser` <command> [<args>] [<options>]

     --adjust x,y,z            Adjust size to not truncate selected columns
     -a, --append              Append new attributes to the current template

So if I specify an invalid subdirectory the script works, if the subdir is valid, the script fails.

I am at a loss both to explain this and to resolve it.

After messing around with the code for far too long I finally found a workaround. Most of the one* ruby scripts contain this block of commands near the top:

    RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
    GEMS_LOCATION     = '/usr/share/one/gems'
    GEMS_LOCATION     = ONE_LOCATION + '/share/gems'

If I add these two lines below it:

require 'nokogiri'
require 'xmlrpc/client'

then it works. I cannot explain why but I have spent far too long on this already, so I copied the /usr/bin/one* files to the ~oneadmin/bin subdir, edited the ruby scripts and added these two lines. Almost all of them now work (there’s still a problem with with onecfg command, but I am not planning on using that). A quick change to the PATH environment variable and my problem is solved.

Yes, it’s nasty and yes, it’s hacky but I’ve spent days trying to sort this out with no luck, at least this works for now. I’ll deal with the upgrade issues that will arrive later.

Hello @MartinW ,

IMHO the problem is that you don’t have a fresh CentOS 7.9 box as you claim.

Based on your output:

$ gem install nokogiri
Successfully installed nokogiri-1.12.4-x86_64-linux

you must have in your custom paths (/usr/local/bin/ ?) another different Ruby installation, as this Nokogiri version is not installable on Ruby 2.0 available in base CentOS/RHEL 7. That’s also why the OpenNebula services work for you, as they leverage the base Ruby 2.0, but interactive use of CLI fails for you, as your env. ($PATH ?) prioritizes your custom Ruby.

Plase, check ruby --version under different OS users (root, oneadmin).

The Ruby gems shipped with OpenNebula are always built against base Ruby available in the particular version of distribution, not any other.

If you have a reason to use different Ruby (but please note the OpenNebula is certified only with components available in base OS), you need to remove the /usr/share/one/gems symlink and install all gems system-wide via install_gems (see Single Front-end Installation — OpenNebula 6.0.3 documentation). Probably you’ll need to run this once for base Ruby and once for your custom Ruby.

And, since we are getting into a grey zone, I better recommend to avoid this completely and stay only with base OS components.

Best regards,

1 Like

Hi @vholer,

This is indeed a fresh CentOS 7.9 except that the user that set it up installed some extra dev stuff, including a newer version or Ruby, as you suggest:

# which ruby
# /opt/rh/rh-ruby25/root/usr/bin/ruby --version
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]

I checked the version in /usr/bin and after modifying my path to use that first and it worked:

$ /usr/bin/oneuser --version
Error: nokogiri gem not installed.
-bash-4.2$ export PATH=/usr/bin:$PATH
-bash-4.2$ /usr/bin/oneuser --version

`oneuser` <command> [<args>] [<options>]

Thank you for pointing this out.