Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update

Added by Matej Sychra about 5 years ago

Well, I have to admit, that I'm down today. I've updated my Ubuntu and that rendered Redmine 2.1.2 completely dead. Any suggestions as of to what should I update or reconfigure? I'm trying not to use Ruby/Rails/Passenger blindly but it's tough as it's not my expertise. I'd like to USE Redmine instead.

Top of the Passenger error log is below, but feel free to check whole page at http://redmine.teacloud.net:

It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:

bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:

Is this app supposed to be run as the nobody user?
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------

Could not find rake-10.3.2 in any of the sources (Bundler::GemNotFound)
/var/lib/gems/1.8/gems/bundler-1.3.4/lib/bundler/spec_set.rb:92:in `block in materialize'
... see http://redmine.teacloud.net for whole error log and ask for more if needed.

• I have no clue, what user should this app supposed to be run as. Everything else uses www-data by default, however the redmine application folder in filesystem is owner by root and seems that it always was (whether it was safe or not).

• Everything was working for two years on ruby 1.8 that is not on my system now. I've managed to install lowest version 1.8.7, latest 2.1.2... and I have no idea where does the 1.9.1 get from.

• I don't understand how 'bundle install' and 'bundle update' is related to current ruby version switched to using rvm.

• I am not sure, at what point will my Redmine MySQL database be migrated or destroyed if I'll need to upgrade Redmine (so I have backup).

Replies (10)

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Alex Wilhelmy about 5 years ago

I am no expert but encountered a similar error when installing redmine and the reason was exactly what is shown in the error screen: gems were missing and a bundle install or manual gem install helped me out.

Alex

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Jan Niggemann (redmine.org team member) about 5 years ago

Go to your redmine installation directory and type bundle install. Then report back with the new status.

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Matej Sychra about 5 years ago

What is weird is that rvm list did not show ruby 1.9.1 at all. What is even more weird is that it does not list mysql, which was actually a clue to the final solution.

$ bundle install
Using rake 10.3.2
Using i18n 0.6.11
Using multi_json 1.10.1
Using activesupport 3.2.8
Using builder 3.0.0
Using activemodel 3.2.8
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.2
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.1.3
Using actionpack 3.2.8
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.4.4
Using actionmailer 3.2.8
Using arel 3.0.3
Using tzinfo 0.3.40
Using activerecord 3.2.8
Using activeresource 3.2.8
Using coderay 1.0.9
Using fastercsv 1.5.5
Using rack-ssl 1.3.4
Using json 1.8.1
Using rdoc 3.12.2
Using thor 0.19.1
Using railties 3.2.8
Using jquery-rails 2.0.3
Using mysql 2.9.1
Using mysql2 0.3.16
Using net-ldap 0.3.1
Using ruby-openid 2.1.8
Using rack-openid 1.4.2
Using bundler 1.6.5
Using rails 3.2.8
Using rmagick 2.13.3
Your bundle is complete!
Gems in the groups development, test, postgresql and sqlite were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ ruby --version
ruby 1.8.7 (2014-01-28 patchlevel 376) [x86_64-linux]
$ rvm list

rvm rubies

=* ruby-1.8.7-head [ x86_64 ]
ruby-1.8.7-p374 [ x86_64 ]
ruby-2.1.2 [ x86_64 ]

  1. => - current
  2. =* - current && default
  3. * - default

$ cat /etc/apache2/mods-available/passenger.conf
<IfModule mod_passenger.c>
PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
PassengerRuby /usr/bin/ruby
PassengerDefaultRuby /usr/bin/ruby
</IfModule>

MY NEXT STEPS BASED ON YOUR INPUTS:

What I think I'm trying to achieve is installing Redmine into the same Ruby environment, that is used by Apache/Passenger now. Hopefully there is such a thing :o)

'gem install rake' didn't help at first, I had to ''rvm use system ' first and now it gives me another error (missing i18n gem so I'll go through all of them now).

$ bundle install
-bash: /usr/local/bin/bundle: /usr/bin/ruby1.8: bad interpreter: No such file or directory

$ sudo ln -s /usr/bin/ruby /usr/bin/ruby1.8

$ bundle install
/usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler [...]

$ sudo gem install bundler

$ bundle install

...

Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.) (LoadError)

$ sudo gem install activerecord-mysql-adapter

$ sudo gem install mysql

No change, still Please install the mysql adapter.

Added gem "mysql" to the Gemfile

$ bundle install (gives warning multiple mysql gems)

Passenger now reports (the file exists and has fairly open access rights):
libruby1.8.so.1.8: cannot open shared object file: No such file or directory - /var/lib/gems/1.8/gems/mysql-2.9.1/lib/mysql/mysql_api.so (LoadError)

< Removed #SetEnv GEM_HOME /var/lib/gems/1.8/ from apache config.
< Removed gem "mysql" from the Gemfile.

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Alex Wilhelmy about 5 years ago

Now the error message at http://redmine.teacloud.net/ recommends:

gem install activerecord-mysql-adapter

as this is not part of the bundle. So I would exactly do that (or add it to gemfile and run bundle install), look at the error message and proceed.

Cheers

Alex

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Matej Sychra about 5 years ago

While the installation is in progress, the question is whether this should be rather configured to mysql2 (I've seen it in Gemfile + docs to config/database.yml, that there's varying mysql dependency for different ruby version).

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Matej Sychra about 5 years ago

I have apparently issue with colliding mysql drivers. The bundle install command never listed mysql based on my current Gemfile (however it is contained). I've decided to experiment a bit and replace whole database gem section in the Gemfile with fresh one from redmine's github repo and see what happens.

And there it is... ALMOST SOLVED! Following output from production log happens on admin account only. Users seem to be able to sign in normally.

So thank you very much for help so far with understanding the japanese syntax (install gem mysql, not activerecord-mysql-adapter).

Started GET "/my/page" for 37.48.46.156 at 2014-08-05 16:04:17 +0000
Processing by MyController#page as HTML
  Current user: admin (id=1)
  Rendered issues/_list_simple.html.erb (95.2ms)
  Rendered my/blocks/_issuesreportedbyme.html.erb (259.0ms)
  Rendered my/page.html.erb within layouts/base (262.7ms)
Completed 500 Internal Server Error in 296ms

ActionView::Template::Error (invalid byte sequence in UTF-8):
    14:         <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;', :id => nil) %>
    15:         <%= link_to(h(issue.id), :controller => 'issues', :action => 'show', :id => issue) %>
    16:       </td>
    17:       <td class="project"><%= link_to_project(issue.project) %></td>
    18:       <td class="tracker"><%=h issue.tracker %></td>
    19:       <td class="subject">
    20:         <%= link_to h(truncate(issue.subject, :length => 60)), :controller => 'issues', :action => 'show', :id => issue %> (<%=h issue.status %>)
  app/helpers/application_helper.rb:146:in `link_to_project'
  app/views/issues/_list_simple.html.erb:17:in `block (2 levels) in _app_views_issues__list_simple_html_erb___2380197332227106742_70106622710240'
  app/views/issues/_list_simple.html.erb:11:in `each'
  app/views/issues/_list_simple.html.erb:11:in `block in _app_views_issues__list_simple_html_erb___2380197332227106742_70106622710240'
  app/views/issues/_list_simple.html.erb:2:in `_app_views_issues__list_simple_html_erb___2380197332227106742_70106622710240'
  app/views/my/blocks/_issuesreportedbyme.html.erb:8:in `_app_views_my_blocks__issuesreportedbyme_html_erb___1822870375837577094_55091400'
  app/views/my/page.html.erb:11:in `block in _app_views_my_page_html_erb___3004314163713120_54903660'
  app/views/my/page.html.erb:8:in `each'
  app/views/my/page.html.erb:8:in `_app_views_my_page_html_erb___3004314163713120_54903660'

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Matej Sychra about 5 years ago

Last thing I had to do was changing mysql to mysql2 in config/database.yml and running bundle install once again. This seems to have restored the functionality back to normal. Time for a cold beer and a backup.

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Alex Wilhelmy about 5 years ago

congratulations and enjoy your beer! (if problems in admin our my_account section persist, it's most commonly a file permission problem on some directories)

Cheers

Alex

RE: Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update - Added by Matej Sychra about 5 years ago

Permissions and missing plugin assets folder in public. Done upgrading to Redmine 2.5.2.

(1-10/10)