Problem with ruby versions during database migration

I encountered a problem during database migration from Opennebula 5.10 to 5.12. After onedb upgrade command I see an error

> Attemp to run migrators compiled in other versionCompiled: 2.0, installed: 2.6

The function which generates this:

    def load_bytecode(file)
        file =, 'rb')
        data =


        data = Zlib::Inflate.inflate(data)
        data = Marshal.load(data)

        c_ruby_version =[1..2].join('.'))
        i_ruby_version ='.')[0..1].join('.'))

        if c_ruby_version != i_ruby_version
            raise 'Attemp to run migrators compiled in other version' \
                "Compiled: #{c_ruby_version}, installed: #{i_ruby_version}"

        new_iseq = RubyVM::InstructionSequence.load(data)

I thought that’s because i had different versions of ruby as a root (2.0.0.) and as a user (2.6.3). After change this (to 2.6: root has 2.6.6. and user has 2.6.3. version of ruby) I see the same error.

I tried run onedb upgrade command as a root too, but I encountered different problem:

> /usr/lib/one/ruby/opennebula/xml_utils.rb:144:in module:OpenNebula’: nokogiri gem not installed. (RuntimeError)`

Installation attempt failed:

    Building native extensions. This could take a while...
    ERROR:  Error installing nokogiri:
            ERROR: Failed to build gem native extension.

    current directory: /opt/rh/rh-ruby26/root/usr/local/share/gems/gems/nokogiri-1.10.10/ext/nokogiri
    /opt/rh/rh-ruby26/root/usr/bin/ruby -I /opt/rh/rh-ruby26/root/usr/share/rubygems -r ./siteconf20201103-67319-1vhrfa9.rb extconf.rb
    mkmf.rb can't find header files for ruby at /opt/rh/rh-ruby26/root/usr/share/include/ruby.h

    You might have to install separate package for the ruby development
    environment, ruby-dev or ruby-devel for example.

    extconf failed, exit code 1

    Gem files will remain installed in /opt/rh/rh-ruby26/root/usr/local/share/gems/gems/nokogiri-1.10.10 for inspection.
    Results logged to /opt/rh/rh-ruby26/root/usr/local/lib64/gems/ruby/nokogiri-1.10.10/gem_make.out

Thank you in advance for your help.

I solved the problem with nokogiri - rh-ruby26-ruby-devel.x86_64 0:2.6.2-118.el7 package was missing. After that i tried to run onedb upgrade as root and I still have the same error:
> Attemp to run migrators compiled in other versionCompiled: 2.0, installed: 2.6

Hello @Jagadaga

The migrators have been compiled in Ruby 2.0 and you are trying to run them with Ruby 2.6, that’s why you get the error.


@ahuertas Thank you for response.

So should I downgrade my ruby version to 2.0? There will be no complications? I was using 2.6 all the time.

I removed migration package, changed ruby version from 2.0.0. to 2.6.2, compiled migration package once again and I received the same error:

Attemp to run migrators compiled in other versionCompiled: 2.0, installed: 2.6

but i think installation did not end correctly:


# -------------------------------------------------------------------------- #
# Copyright 2019-2020, OpenNebula Systems S.L.                               #
#                                                                            #
# Licensed under the OpenNebula Software License for Non-Commercial Use      #
# (the "License"); you may not use this file except in compliance with       #
# the License. You may obtain a copy of the License as part of the software  #
# distribution.                                                              #
#                                                                            #
# See         #
# (or copy bundled with OpenNebula in /usr/share/doc/one/).                  #
#                                                                            #
# Unless agreed to in writing, software distributed under the License is     #
# KIND, either express or implied. See the License for the specific language #
# governing permissions and  limitations under the License.                  #
# -------------------------------------------------------------------------- #

OpenNebula Community Edition Migration package is distributed under the above
license only for non-commercial use. By installing the package, you agree with
the license. Installation will automatically continue in 10 seconds ...

Hello @Jagadaga

You need to install the version of Ruby where the migrators where compiled. This version is the default version in the Operating System you are using.