# \[5.9.90\] json gem seems to be missing

**URL:** <https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833>\
**Category:** Installation & Configuration\
**Created:** [November 15, 2019, 12:18pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833 "2019-11-15T12:18:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [November 15, 2019, 12:18pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/1 "2019-11-15T12:18:33Z")

</div>

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 \*\*\*
> 
> activesupport (4.2.11.1)  
> addressable (2.7.0)  
> amazon-ec2 (0.9.17)  
> aws-eventstream (1.0.3)  
> aws-sdk (2.11.387)  
> aws-sdk-core (2.11.387)  
> aws-sdk-resources (2.11.387)  
> aws-sigv4 (1.1.0)  
> azure (0.7.10)  
> azure-core (0.1.15)  
> builder (3.2.3)  
> chunky\_png (1.3.11)  
> concurrent-ruby (1.1.5)  
> configparser (0.1.7)  
> curb (0.9.10)  
> daemons (1.3.1)  
> eventmachine (1.2.7)  
> faraday (0.17.0)  
> faraday\_middleware (0.13.1)  
> ffi (1.11.1)  
> ffi-rzmq (2.0.7)  
> ffi-rzmq-core (1.0.7)  
> hashie (3.6.0)  
> highline (1.7.10)  
> i18n (0.9.5)  
> inflection (1.0.0)  
> ipaddress (0.8.3)  
> jmespath (1.4.0)  
> memcache-client (1.8.5)  
> mime-types (3.3)  
> mime-types-data (3.2019.1009)  
> mini\_portile2 (2.1.0)  
> minitest (5.11.3)  
> multipart-post (2.1.1)  
> mysql2 (0.5.2)  
> net-ldap (0.16.1)  
> nokogiri (1.6.8.1)  
> ox (2.11.0)  
> parse-cron (0.1.4)  
> polyglot (0.3.5)  
> public\_suffix (2.0.5)  
> rack (1.6.11)  
> rack-protection (1.5.5)  
> rotp (5.1.0)  
> rqrcode (0.10.1)  
> scrub\_rb (1.0.1)  
> sequel (5.25.0)  
> sinatra (1.4.8)  
> sqlite3 (1.4.1)  
> systemu (2.6.5)  
> thin (1.7.2)  
> thor (0.20.3)  
> thread\_safe (0.3.6)  
> tilt (2.0.10)  
> treetop (1.6.10)  
> trollop (2.9.9)  
> tzinfo (1.2.5)  
> uuidtools (2.1.5)  
> xml-simple (1.1.5)  
> zendesk\_api (1.16.0)

Is that normal ? no json ?

Best regards,  
Edouard

---

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [November 15, 2019, 12:53pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/2 "2019-11-15T12:53:54Z")

</div>

I’ve just manually installed json gem and now sunstone is able to start. Any idea why the opennebula-rubygem-json is missing ?

---

<div class="post-metadata">

**Author:** ![vholer](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/vholer/32/4392_2.png) [@vholer](https://forum.opennebula.io/u/vholer)\
**Post date:** [November 15, 2019, 3:06pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/3 "2019-11-15T15:06:39Z")

</div>

Hello @madko ,

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](https://guides.rubygems.org/rubygems-basics/#listing-installed-gems)

> (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:

```auto
$ 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…

```auto
$ rpm -qi rubygem-json

### system-wide installed gems
$ gem list

***LOCAL GEMS***

bigdecimal (1.2.0)
io-console (0.4.2)
json (1.7.7)
psych (2.0.0)
rdoc (4.0.0)

$ ruby --version
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

$ ruby -rjson -e1

$ GEM_PATH=/usr/share/one/gems/ GEM_HOME=/usr/share/one/gems/ ruby -rjson -e1

```

Thank you,  
Vlastimil

---

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [November 15, 2019, 3:17pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/4 "2019-11-15T15:17:38Z")

</div>

Thank you @vholer for your answer.

Rubygem-json is of course installed system wide:

```
[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]

```

but the sunstone service can’t find it.

```
[oneadmin@one0-s324 ~]$ ruby -rjson -e1
[oneadmin@one0-s324 ~]$ GEM_PATH=/usr/share/one/gems/ GEM_HOME=/usr/share/one/gems/ ruby -rjson -e1
/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'

```

If I run `gem install json` as root, it fixes that issue, and sunstone can start. Don’t quite understand why. Any idea?

---

<div class="post-metadata">

**Author:** ![vholer](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/vholer/32/4392_2.png) [@vholer](https://forum.opennebula.io/u/vholer)\
**Post date:** [November 15, 2019, 3:38pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/5 "2019-11-15T15:38:10Z")

</div>

Hello @madko ,

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:

```auto
# 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):

```auto
# 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
              ^^^^

```

Thank you,  
Vlastimil

---

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [November 18, 2019, 8:53am UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/6 "2019-11-18T08:53:27Z")

</div>

My rubygem-json is from official centos-7-opstools repository (we use that for collectd I think), I will try to downgrade to the one from base repo.

---

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [November 18, 2019, 10:31am UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/7 "2019-11-18T10:31:48Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![vholer](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/vholer/32/4392_2.png) [@vholer](https://forum.opennebula.io/u/vholer)\
**Post date:** [November 18, 2019, 12:51pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/8 "2019-11-18T12:51:30Z")

</div>

> [@madko](#):
>
> 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 ?

I have already locked version to the base distribution one [https://github.com/OpenNebula/packages/commit/4b1fb5163b10269a60780d9270a2ae6585627a24](https://github.com/OpenNebula/packages/commit/4b1fb5163b10269a60780d9270a2ae6585627a24)

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.

Thank you,  
Vlastimil

---

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [November 18, 2019, 1:14pm UTC](https://forum.opennebula.io/t/5-9-90-json-gem-seems-to-be-missing/7833/9 "2019-11-18T13:14:38Z")

</div>

Thank you for your help Vlastimil, your commit is perfect and should prevent this kind of issue.

Best regards,  
Edouard
