I’m trying to install opennebula 5.10 RC (5.9.90-1) on a fresh CentOS 7 install.
Everything is fine until I try to start opennebula-sunstone:
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- json (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /usr/lib/one/sunstone/models/OpenNebulaJSON/JSONUtils.rb:19:in <module:OpenNebulaJSON>' from /usr/lib/one/sunstone/models/OpenNebulaJSON/JSONUtils.rb:17:in <top (required)>’
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /usr/lib/one/sunstone/models/OpenNebulaJSON/GroupJSON.rb:17:in <top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/lib/one/sunstone/models/OpenNebulaJSON.rb:20:in <top (required)>’
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /usr/lib/one/sunstone/models/SunstoneServer.rb:19:in <top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/lib/one/sunstone/sunstone-server.rb:111:in ’
Here is my gem list:
[oneadmin@one0-s324 ~]$ GEM_PATH=/usr/share/one/gems/ GEM_HOME=/usr/share/one/gems/ gem list
*** LOCAL GEMS ***
gem json is default one provided system-wide by package rubygem-json-1.7.7-36.el7.x86_64 which is an essential dependency for whole RubyGems and Ruby itself. For the reference: RubyGems Basics - RubyGems Guides
(Ruby ships with some gems by default, bigdecimal, io-console, json, minitest, psych, rake, rdoc, test-unit for ruby 2.0.0).
That’s why it’s not explicitly specified in Gemfiles and even doesn’t come bundled as our own gem package. But, even if it’s installed as a gem, it’s linked into the base Ruby paths, so that it can be used no matter how locations are configured.
See:
$ ls -la /usr/share/ruby/json.rb
lrwxrwxrwx. 1 root root 43 Nov 15 14:39 /usr/share/ruby/json.rb -> /usr/share/gems/gems
I’m afraid, I can’t reproduce the problem on my clean C7. Can you please check some of following commands, most likely we have missined something important…
[oneadmin@one0-s324 ~]$ rpm -q rubygem-json
rubygem-json-2.0.2-2.el7.x86_64
[oneadmin@one0-s324 ~]$ rpm -qi rubygem-json
Name : rubygem-json
Version : 2.0.2
Release : 2.el7
Architecture: x86_64
Install Date: Fri 15 Nov 2019 10:43:45 AM UTC
Group : Development/Languages
Size : 112953
License : Ruby
Signature : RSA/SHA1, Tue 05 Dec 2017 12:30:13 PM UTC, Key ID 4fd9532751bc2a13
Source RPM : rubygem-json-2.0.2-2.el7.src.rpm
Build Date : Thu 10 Aug 2017 10:26:58 AM UTC
Build Host : c1bj.rdu2.centos.org
Relocations : (not relocatable)
Packager : CBS <cbs@centos.org>
Vendor : CentOS
URL : http://flori.github.com/json
Summary : JSON Implementation for Ruby
Description :
This is a implementation of the JSON specification according
to RFC 4627 in Ruby.
You can think of it as a low fat alternative to XML,
if you want to store data to disk or transmit it over
a network rather than use a verbose markup language.
[oneadmin@one0-s324 ~]$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.0)
io-console (0.4.2)
json (2.0.2)
psych (2.0.0)
rdoc (4.0.0)
[oneadmin@one0-s324 ~]$ ruby --version
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
you have a strange version of rubygem-json package. What’s in the base distribution now is 1.7.7 built from ruby source package. See:
# rpm -qi rubygem-json
Name : rubygem-json
Version : 1.7.7
Release : 36.el7
Architecture: x86_64
Install Date: Fri 15 Nov 2019 02:39:32 PM UTC
Group : Development/Libraries
Size : 94878
License : Ruby or GPLv2
Signature : RSA/SHA256, Thu 22 Aug 2019 09:42:58 PM UTC, Key ID 24c6a8a7f4a80eb5
Source RPM : ruby-2.0.0.648-36.el7.src.rpm
Build Date : Thu 08 Aug 2019 12:30:13 PM UTC
Build Host : x86-02.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://ruby-lang.org/
Summary : This is a JSON implementation as a Ruby extension in C
I still can see that your package was built by CentOS guys, but its source is unclear to me (probably some additional SIG repository). Can you please ensure you have updated system and ideally replace (downgrade) the rubygem-json package with the base one?
Also, can you please check the origin of this package (just curious):
# yum info rubygem-json
Installed Packages
Name : rubygem-json
Arch : x86_64
Version : 1.7.7
Release : 36.el7
Size : 93 k
Repo : installed
From repo : base
^^^^
So I can confirm that with rubygem-json > 1.7.7 sunstone is not working fine.
I’ve secured this with an excludepkgs=rubygem-json in the centos-7-opstools repo config.
It should be great if opennebula-sunstone really needs a specific version of rubygem-json that this specific version should be mentionned in its RPM requires, don’t you think ? But that’s a big if, it could also be the rubygem-json package from opstools that is broken. Because I guess that the manual gem install json installed the latest version ? Not sure but I think it was a 2.0.2. But after this weekend, the sunstone process was dead. So maybe it really needs 1.7.7 ?
I’m not very happy about it, but it’s still better than to bundle core gem JSON on our own. BTW, Debian based distributions contain JSON in a core Ruby package (librubyX.Y), so there is not such problem.
The one from OpsTools is a broken at least in a way that it replaces base one, and doesn’t look/behave the same - doesn’t create a symlink.