Passenger 2.2.2 + Ruby 1.9.1-p129 + Rails 2.3.2

42 views
Skip to first unread message

ZhayTee

unread,
Jun 2, 2009, 1:47:20 AM6/2/09
to Phusion Passenger Discussions
Hi all,

I've got a fresh install of Ruby 1.9.1-p129 and Rails 2.3.2 running on
my Ubuntu 9.04 amd64 server. Everything works fine until Passenger (as
an apache2 module) is thrown into the mix. Put simply: my Rails apps
can't find the "rails" gem when executed via Passenger! The exact
error message is as follows:

"Missing the Rails 2.3.2 gem. Please `gem install -v=2.3.2 rails`,
update your RAILS_GEM_VERSION setting in config/environment.rb for the
Rails version you do have installed, or comment out RAILS_GEM_VERSION
to use the latest version installed."

This error message comes from config/boot.rb in the rails app itself;
it's caused because the runtime is unable to find the "rails" gem.
However, here is the output from "gem list":


*** LOCAL GEMS ***
actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
fastthread (1.0.7)
passenger (2.2.2)
pg (0.8.0)
rack (1.0.0)
rails (2.3.2)
rake (0.8.4)

As you can see, Rails 2.3.2 (and all of its support libraries) are in
place! I even checked the filesystem to make sure the gems are really
there-- and yes, they are.

So what's the story here? Is Passenger 2.2.2 + Ruby 1.9.1-p129 + Rails
2.3.2 just not a good combination? Should I downgrade?

Any help would be appreciated!

Thanks,

JT

DrMark

unread,
Jun 2, 2009, 3:04:16 AM6/2/09
to Phusion Passenger Discussions
JT,

Are you sure that you only have Ruby 1.9 installed? Just because you
get 1.9 when you do it in the console doesn't mean that Nginx will get
the same version. Check your paths carefully and check the paths for
the user that is running Nginx. I suspect that Nginx is seeing a
different version of Ruby (which doesn't have Rails installed).

Good luck!

DrMark

ZhayTee

unread,
Jun 2, 2009, 1:43:06 PM6/2/09
to Phusion Passenger Discussions
On Jun 2, 12:04 am, DrMark <drm...@gmail.com> wrote:
> Are you sure that you only have Ruby 1.9 installed?

Hi DrMark. Yes, I am sure. To be extra paranoid, I even ran an
extremely thorough search on the server's filesystem. The only Ruby on
the system is Ruby 1.9.1-p129, installed at "/opt/ruby-1.9.1-p129". As
far as checking paths is concerned, here's the relevant output:

$ script/console
Loading production environment (Rails 2.3.2)
>> Gem.path
=> ["/home/zhaytee/.gem/ruby/1.9.1", "/opt/ruby-1.9.1-p129/lib/ruby/
gems/1.9.1"]

And:

$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.1
- RUBY VERSION: 1.9.1 (2009-05-12 patchlevel 129) [x86_64-linux]
- INSTALLATION DIRECTORY: /opt/ruby-1.9.1-p129/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /opt/ruby-1.9.1-p129/bin/ruby
- EXECUTABLE DIRECTORY: /opt/ruby-1.9.1-p129/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /opt/ruby-1.9.1-p129/lib/ruby/gems/1.9.1
- /home/zhaytee/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/

And:

$ ls -l /opt/ruby-1.9.1-p129/lib/ruby/gems/1.9.1/gems
actionmailer-2.3.2/
actionpack-2.3.2/
activerecord-2.3.2/
activeresource-2.3.2/
activesupport-2.3.2/
fastthread-1.0.7/
passenger-2.2.2/
pg-0.8.0/
rack-1.0.0/
rails-2.3.2/

If there's anything wrong with this setup, I'm unable to see it. And
yet, Passenger still refuses to acknowledge the presence of the
"rails" gem! Here are the configuration directives in my Apache config
files:

PassengerRoot /opt/ruby-1.9.1-p129/lib/ruby/gems/1.9.1/gems/
passenger-2.2.2
PassengerRuby /opt/ruby-1.9.1-p129/bin/ruby

Also, I'm using Apache 2.2.11, not Nginx.

Thanks for your reply,

JT

JBB

unread,
Jul 2, 2009, 3:32:31 AM7/2/09
to Phusion Passenger Discussions
I have the exact same issue. I tried setting ENV['GEM_PATH'] at the
top of environment.rb and that had no effect. 'gem environment' shows
the appropriate environmental variables. Very confusing why passenger/
apache can't find the Rails gem.

Ubuntu 8.10/Ruby 1.9.1-p129/Rails 2.3.2/Passenger 2.2.4/Apache 2.2.11

Any help is greatly appreciated.

JBB

On Jun 2, 10:43 am, ZhayTee <zhay...@zhaymusic.com> wrote:
> On Jun 2, 12:04 am, DrMark <drm...@gmail.com> wrote:
>
> > Are you sure that you only have Ruby 1.9 installed?
>
> Hi DrMark. Yes, I am sure. To be extra paranoid, I even ran an
> extremely thorough search on the server's filesystem. The only Ruby on
> the system is Ruby 1.9.1-p129, installed at "/opt/ruby-1.9.1-p129". As
> far as checking paths is concerned, here's the relevant output:
>
> $ script/console
> Loading production environment (Rails2.3.2)>>Gem.path
>
> => ["/home/zhaytee/.gem/ruby/1.9.1", "/opt/ruby-1.9.1-p129/lib/ruby/
> gems/1.9.1"]
>
> And:
>
> $gemenvironment
> RubyGems Environment:
>   - RUBYGEMS VERSION: 1.3.1
>   - RUBY VERSION: 1.9.1 (2009-05-12 patchlevel 129) [x86_64-linux]
>   - INSTALLATION DIRECTORY: /opt/ruby-1.9.1-p129/lib/ruby/gems/1.9.1
>   - RUBY EXECUTABLE: /opt/ruby-1.9.1-p129/bin/ruby
>   - EXECUTABLE DIRECTORY: /opt/ruby-1.9.1-p129/bin
>   - RUBYGEMS PLATFORMS:
>     - ruby
>     - x86_64-linux
>   -GEMPATHS:
>      - /opt/ruby-1.9.1-p129/lib/ruby/gems/1.9.1
>      - /home/zhaytee/.gem/ruby/1.9.1
>   -GEMCONFIGURATION:
>      - :update_sources => true
>      - :verbose => true
>      - :benchmark => false
>      - :backtrace => false
>      - :bulk_threshold => 1000
>   - REMOTE SOURCES:
>      -http://gems.rubyforge.org/

Hongli Lai

unread,
Jul 2, 2009, 3:38:10 AM7/2/09
to phusion-...@googlegroups.com
On Thu, Jul 2, 2009 at 9:32 AM, JBB<jay.bor...@gmail.com> wrote:
>
> I have the exact same issue.  I tried setting ENV['GEM_PATH'] at the
> top of environment.rb and that had no effect.

Try calling Gem.clear_paths right after you've set this.

>  'gem environment' shows
> the appropriate environmental variables.  Very confusing why passenger/
> apache can't find the Rails gem.

Apache is started by a system service script, which sets its own
environment variables and does not use the environment variables of
your shell. It's possible that your system service script for some
reason sets GEM_PATH or GEM_HOME.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Adrien Lamothe

unread,
Jul 3, 2009, 5:20:46 PM7/3/09
to Phusion Passenger Discussions
I don't see any reference to a GEM_PATH in the apache2 startup script.
Does the passenger mod set the GEM_PATH?

I'm also having the same problem; apache2 can't find the rails gem.

thanks,

Adrien


On Jul 2, 12:38 am, Hongli Lai <hon...@phusion.nl> wrote:
> On Thu, Jul 2, 2009 at 9:32 AM, JBB<jay.borenst...@gmail.com> wrote:
>
> > I have the exact same issue.  I tried setting ENV['GEM_PATH'] at the
> > top of environment.rb and that had no effect.
>
> Try calling Gem.clear_paths right after you've set this.
>
> >  'gem environment' shows
> > the appropriate environmental variables.  Very confusing why passenger/
> > apache can't find the Rails gem.
>
> Apache is started by a system service script, which sets its own
> environment variables and does not use the environment variables of
> your shell. It's possible that your system service script for some
> reason sets GEM_PATH or GEM_HOME.
>
> --
> Phusion | The Computer Science Company
>
> Web:http://www.phusion.nl/
> E-mail: i...@phusion.nl

rogerdpack

unread,
Jul 4, 2009, 8:05:02 AM7/4/09
to Phusion Passenger Discussions
> I've got a fresh install of Ruby 1.9.1-p129 and Rails 2.3.2 running on
> my Ubuntu 9.04 amd64 server. Everything works fine until Passenger (as
> an apache2 module) is thrown into the mix. Put simply: my Rails apps
> can't find the "rails" gem when executed via Passenger! The exact
> error message is as follows:

You could vendorize rails until a fix is found. [rake
rails:freeze:gems]

I was able to recreate this with ruby 1.8.7, so...it's not a ruby 1.9
problem. Hongli I could give you access to a machine to recreate it
[though a virtualbox running ubuntu would probably suffice].

running 'gem env' from within the script [i.e. adding it to boot.rb
line 67 or so] shows the "expected" "right" gem env.

Adding a Gem.clear_paths to the top of environment.rb seems to fix the
problem as well.

It reports the problem whether rails gem is install in ~/.gem or in
the global location.

Thanks.
=r

rogerdpack

unread,
Jul 4, 2009, 8:06:01 AM7/4/09
to Phusion Passenger Discussions
> Are you sure that you only have Ruby 1.9 installed? Just because you
> get 1.9 when you do it in the console doesn't mean that Nginx will get
> the same version. Check your paths carefully and check the paths for
> the user that is running Nginx. I suspect that Nginx is seeing a
> different version of Ruby (which doesn't have Rails installed).

Good point--I wonder if the RUBY_PLATFORM or RUBY_DESCRIPTION couldn't
be added to modrails' debug outputs?
=r

JBB

unread,
Jul 5, 2009, 3:19:59 AM7/5/09
to Phusion Passenger Discussions
ENV['GEM_HOME']
Gem.clear_paths

in environment.rb does solve the issue of the Rails gem not being
located. Thanks for the help.

Adrien Lamothe

unread,
Jul 6, 2009, 12:52:38 PM7/6/09
to Phusion Passenger Discussions
I'm glad that worked for you, but it didn't work for me.

I'd like to suggest a new product logo for Passenger:

"Rails deployment that just works - once you get it working"

Adrien Lamothe

unread,
Jul 6, 2009, 12:55:12 PM7/6/09
to Phusion Passenger Discussions
I'm glad that worked for you, it didn't work for me.

I'd like to suggest a new product logo for Passenger:

"Rails deployment that just works - once you get it working"



On Jul 5, 12:19 am, JBB <jay.borenst...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages