2

I met trouble with redmine(or ruby configuration) when move from one server to another

redmine@dirty:~/www$ ruby script/rails server webrick -e production
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `require': Incorrect MySQL client library version! This gem was compiled for 5.5.17 but the client library is 5.1.59. (RuntimeError)
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'   
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'   
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
        from /home/redmine/redmine-2.4/config/application.rb:7:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

I use mysql2 adapter (coz mysql can't work with utf8 text in database, as I understand)

Additional information:

redmine@d:~/www$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.2.1
  - RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.0.0-p353
  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.0.0-p353/bin
  - SPEC CACHE DIRECTORY: /home/redmine/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.0.0-p353
     - /usr/local/rvm/gems/ruby-2.0.0-p353@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.0.0-p353/bin
     - /usr/local/rvm/gems/ruby-2.0.0-p353@global/bin


root@d:/usr/local/rvm# aptitude search '~imysql'
i   libmysqlclient-dev                            - Percona Server database development files               
i A libmysqlclient16                              - MySQL database client library                           
i A libmysqlclient18                              - Percona Server database client library                  
i   php5-mysql                                    - MySQL module for php5 

redmine@d:~/www$ svn info
Path: .
URL: http://svn.redmine.org/redmine/branches/2.4-stable
Repository Root: http://svn.redmine.org/redmine

I already reinstall gems, bundles and even packages many times but still no success.

UPD (suggestion by Michael Hampton♦):

redmine@d:~/www$ gem pristine --all
Restoring gems to pristine condition...
Restored actionmailer-3.2.16
Restored actionpack-3.2.16
Restored activemodel-3.2.16
Restored activerecord-3.2.16
Restored activeresource-3.2.16
Restored activesupport-3.2.16
Restored arel-3.0.3
Skipped bigdecimal-1.2.0, it is a default gem
Restored builder-3.2.2
Restored builder-3.0.0
Restored bundler-1.5.2
Restored bundler-unload-1.0.2
Restored coderay-1.1.0
Restored daemons-1.1.9
Restored erubis-2.7.0
Building native extensions.  This could take a while...
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.0.0-p353@global/bin in PATH, mode 040777
Restored eventmachine-1.0.3
Building native extensions.  This could take a while...
Restored gem-wrappers-1.2.3
Restored hike-1.2.3
Restored i18n-0.6.9
Skipped io-console-0.4.2, it is a default gem
Restored journey-1.0.4
Restored jquery-rails-2.0.3
Building native extensions with: ''
This could take a while...
Restored json-1.8.1
Skipped json-1.7.7, it is a default gem
Restored mail-2.5.4
Restored mime-types-1.25.1
Skipped minitest-4.3.2, it is a default gem
Restored multi_json-1.8.4
Building native extensions with: ''
This could take a while...
Restored mysql-2.8.1
Building native extensions with: ''
This could take a while...
Restored mysql2-0.3.14
Restored net-ldap-0.3.1
Restored polyglot-0.3.3
Skipped psych-2.0.0, it is a default gem
Restored rack-1.4.5
Restored rack-cache-1.2
Restored rack-openid-1.4.1
Restored rack-ssl-1.3.3
Restored rack-test-0.6.2
Restored rails-3.2.16
Restored railties-3.2.16
Restored rake-10.1.1
Skipped rake-0.9.6, it is a default gem
Skipped rdoc-4.0.0, it is a default gem
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Restored rdoc-3.12.2
Building native extensions with: ''
This could take a while...
Restored rmagick-2.13.2
Restored ruby-openid-2.3.0
Restored rubygems-bundler-1.4.2
Restored rvm-1.11.3.8
Restored sprockets-2.2.2
Skipped test-unit-2.0.0.0, it is a default gem
Building native extensions.  This could take a while...
Restored thin-1.6.1
Restored thor-0.18.1
Restored tilt-1.4.1
Restored treetop-1.4.15
Restored tzinfo-0.3.38

redmine@d:~/www$ ruby script/rails server webrick -e production
/usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:220: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.0.0-p353@global/bin in PATH, mode 040777
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `require': Incorrect MySQL client library version! This gem was compiled for 5.5.17 but the client library is 5.1.59. (RuntimeError)
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
        from /home/redmine/redmine-2.4/config/application.rb:7:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

UPD2:

On old system I use ruby from packages, on new ubuntu server 11.10 - ruby provided by rvm

1 Answer 1

5

You are using gems with native extensions, but they were compiled against libraries on the source system that have different versions on the target system.

So you need to rebuild your gems on the target system.

rvm use 2.0.0-p353
gem pristine --all

In future it's better if you just deploy your source code and let bundler handle the gems on the target system, rather than trying to copy your whole .rvm directory.

5
  • Thank you for response. I updated the question. On old server I used ruby-1.8.7 from ubuntu package so no .rvm folders were there
    – ruX
    Feb 9, 2014 at 13:55
  • You're clearly using a system-installed rvm on the target system, which has the same effect. You still need to be in that rvm gemset when you rebuild. I think you need to spend some time cleaning out the target system... Feb 9, 2014 at 15:43
  • On old system I use ruby from packages, on new ubuntu server - ruby provided by rvm
    – ruX
    Feb 9, 2014 at 19:19
  • It doesn't help. Same error :(
    – ruX
    Feb 15, 2014 at 21:26
  • If in the original machine there's no rvm at all then perhaps you are using the already configured rvm of that "dirty" user of the new server to launch redmine. learn to create a new rvm environment/gemset for redmine and switch it before launch webrick
    – theist
    Feb 17, 2014 at 16:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .