Phusion Passenger is throwing errors after upgrading Ruby and Rails using rvm

Zachary Abresch picture Zachary Abresch · Dec 5, 2011 · Viewed 10.1k times · Source

I recently upgraded my Rails setup to 3.1.3 and I'm having issues with Phusion Passenger loading an older app on this server. I got everything running on a testapp but I'm still having issues with this one app. When I run the Webrick server on port 3000 my app runs perfectly but when attempting to access it through the virtual host I continue to get Passenger errors. Here's the info:

Error being thrown by Passenger

Ruby (Rack) application could not be started

Error message:

Could not find activesupport-3.0.7 in any of the sources (Bundler::GemNotFound)

Exception class:

PhusionPassenger::UnknownError

Application root:

/home/admin/rails/bnkpics

Backtrace:

    #   File    Line    Location
    0   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/spec_set.rb  88  in `materialize'
    1   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/spec_set.rb  82  in `map!'
    2   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/spec_set.rb  82  in `materialize'
    3   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb    90  in `specs'
    4   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb    135 in `specs_for'
    5   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb    124 in `requested_specs'
    6   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/environment.rb   23  in `requested_specs'
    7   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb   11  in `setup'
    8   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler.rb   110 in `setup'
    9   /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb 326 in `prepare_app_process'
    10  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb  156 in `initialize_server'
    11  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb 572 in `report_app_init_status'
    12  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb  154 in `initialize_server'
    13  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   204 in `start_synchronously'
    14  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   180 in `start'
    15  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb  129 in `start'
    16  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 253 in `spawn_rack_application'
    17  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb    132 in `lookup_or_add'
    18  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 246 in `spawn_rack_application'
    19  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb    82  in `synchronize'
    20  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb    79  in `synchronize'
    21  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 244 in `spawn_rack_application'
    22  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 137 in `spawn_application'
    23  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
    24  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   357 in `__send__'
    25  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   357 in `server_main_loop'
    26  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   206 in `start_synchronously'
    27  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server  99  

Server Information (Rackspace Cloud Server)

  • Distributor ID: Ubuntu
  • Description: Ubuntu 10.04.3 LTS
  • Release: 10.04
  • Codename: lucid

Ruby and Rails Versions

  • ruby -v = ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
  • rails -v = Rails 3.1.3
  • rvm -v = rvm 1.9.2 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]

Ruby and Rails locations

  • which ruby = /home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
  • which rails = /home/admin/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rails
  • which rvm = /home/admin/.rvm/bin/rvm
  • which passenger = /usr/bin/passenger

Results of gem list

    *** LOCAL GEMS ***

    abstract (1.0.0)
    actionmailer (3.1.3, 3.0.7)
    actionpack (3.1.3, 3.0.7)
    activemodel (3.1.3, 3.0.7)
    activerecord (3.1.3, 3.0.7)
    activeresource (3.1.3, 3.0.7)
    activesupport (3.1.3, 3.0.7)
    arel (2.2.1, 2.0.10)
    builder (3.0.0, 2.1.2)
    bundler (1.0.21)
    carrierwave (0.5.8)
    erubis (2.7.0, 2.6.6)
    hike (1.2.1)
    i18n (0.6.0, 0.5.0)
    jquery-rails (1.0.19)
    json (1.6.3)
    mail (2.3.0, 2.2.19)
    mime-types (1.17.2)
    mini_magick (3.3)
    multi_json (1.0.4)
    polyglot (0.3.3)
    rack (1.3.5, 1.2.4)
    rack-cache (1.1)
    rack-mount (0.8.3, 0.6.14)
    rack-ssl (1.3.2)
    rack-test (0.6.1, 0.5.7)
    rails (3.1.3, 3.0.7)
    railties (3.1.3, 3.0.7)
    rake (0.9.2.2)
    rdoc (3.11)
    rubygems-update (1.8.12, 1.8.11)
    sprockets (2.1.2, 2.0.3)
    sqlite3 (1.3.5)
    subexec (0.2.0, 0.1.0)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
    tzinfo (0.3.31)

Results of bundle list

Gems included by the bundle:
  * abstract (1.0.0)
  * actionmailer (3.0.7)
  * actionpack (3.0.7)
  * activemodel (3.0.7)
  * activerecord (3.0.7)
  * activeresource (3.0.7)
  * activesupport (3.0.7)
  * arel (2.0.10)
  * builder (2.1.2)
  * bundler (1.0.21)
  * carrierwave (0.5.8)
  * erubis (2.6.6)
  * i18n (0.5.0)
  * jquery-rails (1.0.19)
  * mail (2.2.19)
  * mime-types (1.17.2)
  * mini_magick (3.3)
  * polyglot (0.3.3)
  * rack (1.2.4)
  * rack-mount (0.6.14)
  * rack-test (0.5.7)
  * rails (3.0.7)
  * railties (3.0.7)
  * rake (0.9.2.2)
  * sqlite3 (1.3.5)
  * subexec (0.1.0)
  * thor (0.14.6)
  * treetop (1.4.10)
  * tzinfo (0.3.31)

Results of rvm info

    ruby-1.9.3-p0@rails313:

      system:
        uname:       "Linux ror-stack 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux"
        bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
        zsh:         " => not installed"

      rvm:
        version:      "rvm 1.9.2 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]"

      ruby:
        interpreter:  "ruby"
        version:      "1.9.3p0"
        date:         "2011-10-30"
        platform:     "x86_64-linux"
        patchlevel:   "2011-10-30 revision 33570"
        full_version: "ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]"

      homes:
        gem:          "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313"
        ruby:         "/home/admin/.rvm/rubies/ruby-1.9.3-p0"

      binaries:
        ruby:         "/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/ruby"
        irb:          "/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/irb"
        gem:          "/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/gem"
        rake:         "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rake"

      environment:
        PATH:         "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313/bin:/home/admin/.rvm/gems/ruby-1.9.3-p0@global/bin:/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin:/home/admin/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
        GEM_HOME:     "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313"
        GEM_PATH:     "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313:/home/admin/.rvm/gems/ruby-1.9.3-p0@global"
        MY_RUBY_HOME: "/home/admin/.rvm/rubies/ruby-1.9.3-p0"
        IRBRC:        "/home/admin/.rvm/rubies/ruby-1.9.3-p0/.irbrc"
        RUBYOPT:      ""
        gemset:       "rails313"

Gemfile Contents

    source 'http://rubygems.org'

    gem 'rails'

    # Bundle edge Rails instead:
    # gem 'rails', :git => 'git://github.com/rails/rails.git'

    gem 'sqlite3'

    gem 'jquery-rails', '>= 1.0.3'

    gem 'carrierwave'

    gem 'mini_magick'

    gem 'rake'

    gem 'activesupport'

Passenger settings in apache.conf

    LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
    PassengerRuby /usr/bin/ruby1.8

App Config in /etc/apache2/sites-enabled

    <VirtualHost 174.143.141.247:81>

      RailsEnv      development
      DocumentRoot /home/admin/rails/bnkpics/public
      <Directory /home/admin/rails/bnkpics/public>
          AllowOverride all
          Options -MultiViews
       </Directory>
      ServerName  174.143.141.247
      NameVirtualHost 174.143.141.247:81

    </VirtualHost>

Contents of /etc/apache2/ports.conf

    NameVirtualHost *:80
    Listen 80
    Listen 81
    # Listen 82
    # Listen 83

    <IfModule mod_ssl.c>
        # If you add NameVirtualHost *:443 here, you will also have to change
        # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
        # to <VirtualHost *:443>
        # Server Name Indication for SSL named virtual hosts is currently not
        # supported by MSIE on Windows XP.
        Listen 443
    </IfModule>

    <IfModule mod_gnutls.c>
        Listen 443
    </IfModule>

Results of bundle list

    Using rake (0.9.2.2) 
    Using abstract (1.0.0) 
    Using activesupport (3.0.7) 
    Using builder (2.1.2) 
    Using i18n (0.5.0) 
    Using activemodel (3.0.7) 
    Using erubis (2.6.6) 
    Using rack (1.2.4) 
    Using rack-mount (0.6.14) 
    Using rack-test (0.5.7) 
    Using tzinfo (0.3.31) 
    Using actionpack (3.0.7) 
    Using mime-types (1.17.2) 
    Using polyglot (0.3.3) 
    Using treetop (1.4.10) 
    Using mail (2.2.19) 
    Using actionmailer (3.0.7) 
    Using arel (2.0.10) 
    Using activerecord (3.0.7) 
    Using activeresource (3.0.7) 
    Using bundler (1.0.21) 
    Using carrierwave (0.5.8) 
    Using thor (0.14.6) 
    Using railties (3.0.7) 
    Using jquery-rails (1.0.19) 
    Using subexec (0.1.0) 
    Using mini_magick (3.3) 
    Using rails (3.0.7) 
    Using sqlite3 (1.3.5) 
    Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

I included as much as possible because at this point, I have no idea where to go hunting. Can anyone see what I'm missing? I'm still new to using rvm and Rails 3.1.3 so I'm sure it's something simple. Is there any other information I can provide to assist in troubleshooting this issue? I am in need of an answer because this was a client's app that has been running for some time now but wasn't used, of course, until the day I broke it. Any help would be greatly appreciated!

Answer

David Burrows picture David Burrows · Dec 5, 2011

You're not using the RVM ruby in the Apache config, in your apache conf your pointing to the old system versions

 LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
 PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
 PassengerRuby /usr/bin/ruby1.8

You need to use the 1.9.3 that RVM has installed, easiest way is to install the passenger gem again and look at the output, when it's compiled it'll give you the correct conf, mine looks something like:

LoadModule passenger_module /Users/admin/.rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /Users/admin/.rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.9
PassengerRuby /Users/admin/.rvm/wrappers/ruby-1.9.3-p0/ruby