Passenger could not be initialized because of this error: Option 'agents_dir' missing in file - Rails 4 + Passenger deployment
Asked Answered
J

4

5

I have been banging my head against a door trying to deploy a Rails 4 app on Ubuntu 14 + Apache2 + Passenger. I seemed to have made some progress: passenger is installed properly with the proper apache modules, my apache conf files are set up, everything is restarted, etc.. when I go to my site I get a listing of my Rails App's public directory. I investigated the logs and found the following:

Passenger could not be initialized because of this error: Option 'agents_dir' missing in file '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'

I different SO post said something about mods-available stuff so here's /etc/apache2/mods-available/passenger.conf:

<IfModule mod_passenger.c> PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini PassengerDefaultRuby /usr/bin/ruby </IfModule>

And /etc/apache2/mods-available/passenger.load:

LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so

What am I doing wrong? I'm going to kiss whoever solves this, I swear.

Joyejoyful answered 13/3, 2015 at 1:20 Comment(0)
D
4

I just ran into this problem and fixed it by reinstalling the passenger package using the following command:

sudo apt-get install --reinstall passenger passenger-dev
Dishtowel answered 14/3, 2015 at 14:39 Comment(2)
Yes, i ended up running sudo apt-get purge passenger passenger-dev apache2 to completely remove all of the packaged and then reinstalled and it worked properly. So, a reinstall was the easiest route.Joyejoyful
Just found this due to the same problem. It's caused by a not completely clean upgrade. More importantly, this is only part of the fix - you need to complete stop and start the server again, a reload wouldn't fix things for me. Ref: github.com/phusion/passenger/issues/1434Arvizu
D
4

If you happen to have same issue while Upgrading Nginx and Passenger on Ubuntu 14.04

sudo apt-get purge passenger
sudo apt-get remove nginx (it won't remove your config files)

and then

sudo apt-get install nginx-full passenger
Devy answered 27/8, 2015 at 21:55 Comment(0)
C
2

locations.ini is a passenger + ngnix config related item, and does not apply for passenger + apache config.

See the Phusion Passenger users guide, Apache version for details about how to configure passenger with apache.

Or see Phusion Passenger users guide, Nginx version for configuring passenger with nginx.

If you are going the passenger + apache route, the key step you seem to be missing is to run passenger-install-apache2-module which provides the right values for PassengerRoot, PassengerDefaultRuby, etc.

Cormac answered 13/3, 2015 at 1:30 Comment(2)
Thanks for the reply! However, when I run that command I get The Phusion Passenger Apache module is correctly installed :-). Additional help would be appreciated! Come to think of it, I think I may have initially set it up for nginx, but decided to switch to apache. Perhaps the apache passenger installation didn't override some of the nginx passenger installation?Joyejoyful
The users guide I linked is fairly detailed; please follow the steps detailed there, restarting from scratch if need be. Running passenger-install-apache2-module should give correct value to specify for PassengerRoot instead of the totally incorrect ..../locations.ini.Cormac
A
0

I just installed a fresh Apache/Passenger setup on Ubuntu 14.04 and ran into this. I have built this same setup at least a dozen times.

My /etc/apache2/mods-enabled/passenger.conf:

### Begin automatically installed Phusion Passenger config snippet ###
<IfModule mod_passenger.c>
  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerDefaultRuby /usr/bin/passenger_free_ruby
</IfModule>
### End automatically installed Phusion Passenger config snippet ###

My /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini:

[locations]
packaging_method=deb
bin_dir=/usr/bin
support_binaries_dir=/usr/lib/passenger/support-binaries
lib_dir=/usr/lib/passenger
helper_scripts_dir=/usr/share/passenger/helper-scripts
resources_dir=/usr/share/passenger
include_dir=/usr/share/passenger/include
doc_dir=/usr/share/doc/passenger
ruby_libdir=/usr/lib/ruby/vendor_ruby
node_libdir=/usr/share/passenger/node
apache2_module_path=/usr/lib/apache2/modules/mod_passenger.so
ruby_extension_source_dir=/usr/share/passenger/ruby_extension_source
nginx_module_source_dir=/usr/share/passenger/ngx_http_passenger_module

So, yeah, the locations.ini absolutly contains Apache configuration information ...but this file is identical on all my machines working or not.

Reinstalling via --reinstall didn't work ...so I purged everything.

sudo apt-get purge passenger passenger-dev \ 
                   libapache2-mod-passenger \
                   apache2 apache2-threaded-dev;
sudo apt-get autoremove;
sudo rm -rf /etc/apache2;

Then reinstalled:

sudo apt-get install apache2 apache2-threaded-dev \
                     libapache2-mod-passenger;

sudo a2enmod rewrite expires deflate passenger status;
sudo apache2ctl restart;

Validated install:

sudo passenger-config validate-install;

And confirmed that Passenger was running:

sudo passenger-memory-stats;

Then, finally, re-enabled my app's Apache config. One last sudo apache2ctl restart and I'm happily running!

$ ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

$ passenger --version
Phusion Passenger version 5.0.15
Anishaaniso answered 13/8, 2015 at 9:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.