Breaking of : RAILS_ENV=production rake db:migrate

Added by john moe over 6 years ago

Hi everyone,

I'm quite new with ruby, so please be kind, i'll try to be as efficient as possible with your answers ;)

I'm working on a fedora 17 server, and try to install the last stable redmine 2.1 got with the svn
I guess i've installed quite everything ruby, rails. I have mysql running fine for other services.

I'm running the install guide here : http://www.redmine.org/projects/redmine/wiki/RedmineInstall
I've run bundle install --without development test without any error.

my config/database.yml is like this :

production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: ****
encoding: utf8

rake generate_secret_token was ok, no error message.

but now, i try to run RAILS_ENV=production rake db:migrate and here comes troubles...
i have the following answer :

_rake aborted!
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (cannot load such file -- mysql2/mysql2)

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)_

I've read things about the database.yml, but guess i've fixed it. I also guessed that i've looked at things that could go wrong according to faqs and things found on the net, but the error is still here, and don't know how to deal with it.

Does anyone knows what to do to solve this ?

Thanks for any idea
Best regards
R

Replies (10)

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by john moe over 6 years ago

I haven't seen any answer, and try to see what could be wrong, but still haven't got any clue...
Any hints ?
Regards
R

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by Etienne Massip over 6 years ago

There is something wrong with your mysql2 gem installation.

What gives bundle show?

What Ruby platform are you running Redmine on? Rubinius? MRI?

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by john moe over 6 years ago

Hello Etienne, here's the bundle show :

Gems included by the bundle:
  * actionmailer (3.2.8)
  * actionpack (3.2.8)
  * activemodel (3.2.8)
  * activerecord (3.2.8)
  * activeresource (3.2.8)
  * activesupport (3.2.8)
  * arel (3.0.2)
  * builder (3.0.0)
  * bundler (1.2.1)
  * coderay (1.0.7)
  * erubis (2.7.0)
  * hike (1.2.1)
  * i18n (0.6.1)
  * journey (1.0.4)
  * jquery-rails (2.0.3)
  * json (1.7.5)
  * mail (2.4.4)
  * mime-types (1.19)
  * multi_json (1.3.6)
  * mysql2 (0.3.11)
  * net-ldap (0.3.1)
  * pg (0.14.1)
  * polyglot (0.3.3)
  * rack (1.4.1)
  * rack-cache (1.2)
  * rack-openid (1.3.1)
  * rack-ssl (1.3.2)
  * rack-test (0.6.2)
  * rails (3.2.8)
  * railties (3.2.8)
  * rake (0.9.2.2)
  * rdoc (3.12)
  * ruby-openid (2.1.8)
  * sprockets (2.1.3)
  * thor (0.16.0)
  * tilt (1.3.3)
  * treetop (1.4.10)
  * tzinfo (0.3.33)

Concerning the platform, i don't know if the answer is accurate, but i've installed it on a fedora 17, using yum install... hope the answer is not too lame.. ;)

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by Etienne Massip over 6 years ago

Sorry, I meant: what Ruby interpreter did you install?

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by john moe over 6 years ago

I've installed the one provided by fedora ie ruby-1.9.3.194-16.fc17.i686
here are the rpm on my fedora
ruby-libs-1.9.3.194-16.fc17.i686
ruby-1.9.3.194-16.fc17.i686
jruby-yecht-1.6.3-3.fc17.noarch
rubygem-json-1.6.5-1.fc17.i686
rubygem-bigdecimal-1.1.0-16.fc17.i686
postgresql-plruby-doc-0.5.3-6.fc17.i686
rubygem-io-console-0.3-16.fc17.i686
jruby-1.6.3-3.fc17.noarch
rubygem-rdoc-3.12-4.fc17.noarch
ruby-irb-1.9.3.194-16.fc17.noarch
rubygems-1.8.24-1.fc17.noarch
ruby-devel-1.9.3.194-16.fc17.i686

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by Etienne Massip over 6 years ago

message:#32588 suggest you have some mixed Ruby installation.

Maybe you could try reinstall ruby 1.9.3 if you installed jRuby after.

Curious, what give gem env and bundle exec gem env commands respectively?

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by john moe over 6 years ago

gem env gives me this :
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i386-linux]
- INSTALLATION DIRECTORY: /usr/local/share/gems
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/local/share/gems
- /root/.gem/ruby/1.9.1
- /usr/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

and bundle exec gem env :

RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i386-linux]
- INSTALLATION DIRECTORY: /usr/local/share/gems
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/local/share/gems
- /root/.gem/ruby/1.9.1
- /usr/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

I'll try to reinstall ruby and let you know if things have changed...

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by john moe over 6 years ago

Ok, i've 'removed' ruby with a rpm -e --justdb --no-deps ruby and reinstall it with a yum install ruby...

here's the result of the faulty command :

RAILS_ENV=production rake db:migrate --trace
  • Invoke db:migrate (first_time)
  • Invoke environment (first_time)
  • Execute environment
    rake aborted!
    Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (cannot load such file -- mysql2/mysql2)
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    /usr/local/share/gems/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    /usr/local/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:4:in `<top (required)>'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    /usr/local/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
    /usr/local/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
    /usr/local/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
    /usr/local/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection'
    /usr/local/share/gems/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
    /usr/local/share/gems/gems/activerecord-3.2.8/lib/active_record/base.rb:721:in `<top (required)>'
    /root/redmine-2.1/lib/plugins/acts_as_activity_provider/init.rb:2:in `block in <top (required)>'
    /root/redmine-2.1/config/initializers/00-core_plugins.rb:12:in `eval'
    /root/redmine-2.1/config/initializers/00-core_plugins.rb:12:in `block in <top (required)>'
    /root/redmine-2.1/config/initializers/00-core_plugins.rb:2:in `each'
    /root/redmine-2.1/config/initializers/00-core_plugins.rb:2:in `<top (required)>'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `block in load'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
    /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/engine.rb:587:in `block in <class:Engine>'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
    /root/redmine-2.1/config/environment.rb:14:in `<top (required)>'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/application.rb:103:in `require'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/application.rb:103:in `require_environment!'
    /usr/local/share/gems/gems/railties-3.2.8/lib/rails/application.rb:295:in `block (2 levels) in initialize_tasks'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
    /usr/share/ruby/monitor.rb:211:in `mon_synchronize'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
    /usr/share/ruby/monitor.rb:211:in `mon_synchronize'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /usr/local/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
    /usr/local/share/gems/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
    /usr/local/bin/rake:23:in `load'
    /usr/local/bin/rake:23:in `<main>'
    Tasks: TOP => db:migrate => environment

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by Etienne Massip over 6 years ago

Looks like it find the gem in /usr/local/share/gems/gems/mysql2-0.3.11/lib/ but maybe not a dependency, probably the mysql client library.

I'm sorry I don't know much linux and Fedora systems so I'm not able to tell you how to get it visible from the gem.

RE: Breaking of : RAILS_ENV=production rake db:migrate - Added by sperling sperling about 6 years ago

This solved situation for me on F17:


cd your_redmine_dir
ln -s /usr/local/share/gems/gems/mysql2-0.3.11/ext/mysql2/mysql2.so mysql2/mysql2.so

(1-10/10)