27

I have done a Phusion Passenger setup on Ubuntu 10.04, with Apache2. Whenever I restart the Apache server I got the following error message, and the Rails application is not running.

[error] *** Passenger could not be initialized because of this error: Unable to start the Phusion Passenger watchdog because its executable (/usr/lib/phusion-passenger/agents/PassengerWatchdog) does not exist. This probably means that your Phusion Passenger installation is broken or incomplete, or that your 'PassengerRoot' directive is set to the wrong value. Please reinstall Phusion Passenger or fix your 'PassengerRoot' directive, whichever is applicable.
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
suvankar
  • 1,548
  • 1
  • 20
  • 28
  • 3
    I just had the same issue with apache 2.4, passenger 4.0.58. After some digging in, it turned out that my EC2 micro instance just did not have enough memory to compile the apache passenger module—it was failing with an out of memory error. Upgrading to the next instance size fixed the issue. – Shyam Habarakada May 13 '15 at 03:11
  • Just to expand on Shyam's issue. My passenger compilation failed once, succeeded on subsequent runs, but the passenger install was left in a bad state (_the subsequent successful runs did not go back and correct the original bad compilation_). I took a different route...created a new micro instance, added some swap and saw Passenger compile and fire up successfully. – Kevin M Jul 27 '15 at 19:54

5 Answers5

63

I ran into the same problem when compiling from source, but it was intermittent, which was really frustrating (I think it has to w/ Rails environments). We couldn't use the passenger-install-apache2-module/passenger-install-nginx-module scripts, because we needed a customized nginx installation.

I finally fixed the problem by going to whatever the passenger-config --root is, then running: rake nginx.

Update February 2016 (by Passenger author):

The officially supported method to compile PassengerAgent (without also compiling Nginx, as passenger-install-nginx-module does) is with this command:

passenger-config compile-agent

Passenger 5.0.26 and later will automatically detect the error described in this StackOverflow question, and will automatically suggest running the above command.

Hongli
  • 18,682
  • 15
  • 79
  • 107
dylst
  • 689
  • 8
  • 15
  • You may have to switch to your "root" user account, or whichever account you used when setting up passenger-install-nginx-module. – s2t2 Sep 04 '13 at 20:11
  • 1
    "passenger-config --root" points to the version of the passenger gem that the Gemfile.lock of the current project has specified. That might explain why it was intermittent for you as different Rails projects may use different versions of Passenger. – Sv1 Sep 21 '13 at 04:34
  • 1
    If compilation fails with a error about curl, run `apt-get install libcurl4-openssl-dev` ([source](http://www.drewblas.com/2012/09/)). – mgold Aug 12 '14 at 02:16
  • Adding the path from `passenger-config --root` to my nginx.conf was helpful for me. – Adam Grant Sep 29 '15 at 00:17
9

I've just hit this error myself and struggled to find a good answer, so here's my writeup. In my setup I'm going for Ubuntu, Apache2, the latest Passenger and Rails 2.3.

  1. Install Ruby and Rubygems NB: make (very) sure your gem -v is correct, if it's wrong you'll do all this twice
  2. sudo gem install passenger
  3. cd /usr/lib
  4. wget http://rubyforge.org/frs/download.php/76005/passenger-3.0.12.tar.gz
  5. tar zxvf passenger-3.0.12.tar.gz
  6. cd passenger-3.0.12
  7. ./bin/passenger-install-apache2-module
  8. Add export PATH=/var/lib/gems/1.8/bin:$PATH to ~/.bashrc
  9. ln -s /usr/lib/passenger-3.0.12 /usr/share/phusion-passenger # => this fixes a world of hurt to do with PassengerWatchdog. NB: PassengerWatchdog doesn't come down with apt-get which is why we grabbed the binaries.
  10. ln -s /usr/lib/passenger-3.0.12 /usr/lib/phusion-passenger # => similar issues.

This is from memory following thrashing it through for the last day and a half, I'll tidy up when I have to go through it again.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
TomDunning
  • 4,829
  • 1
  • 26
  • 33
7

Try to install passenger module by running script passenger-install-apache2-module . I had same problem but on nginx; I installed passenger via gem and then recompiled nginx manually with passenger module - this caused error described by you. After running passenger-install-nginx-module such error disappeared.

Piotr
  • 173
  • 1
  • 2
  • 11
0

It had been a while since I had restarted nginx and in the meantime the path to passenger had changed. I looked in the nginx.conf to see what the passenger_root was set to and realized that it was the old value:

http {
    passenger_root /home/nginx/rails_app/myapp/shared/bundle/ruby/1.9.1/gems/passenger-enterprise-server-3.0.17;

There are often two places to change:

server {
    listen 8888;
    root /home/nginx/rails_app/myapp/current/public;

I restarted nginx and the error was gone.

Kevin Trotter
  • 151
  • 1
  • 3
-2

I had the same issue on my Nginx-Server.
In my case, the passenger_root directory was not correct, because of gem update.

[1] On Linux, i searched the passenger Directory with the following Command:

find / -name PassengerWatchdog

[2] Now i changed my 'passenger_root' Value to this Directory.
[3] And restart the Server.

suvankar, Maybe you should change your Passenger Path too.

stephanfriedrich
  • 563
  • 5
  • 20