Unable to start the Phusion Passenger watchdog? - ruby-on-rails

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.

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.

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.
Install Ruby and Rubygems NB: make (very) sure your gem -v is correct, if it's wrong you'll do all this twice
sudo gem install passenger
cd /usr/lib
wget http://rubyforge.org/frs/download.php/76005/passenger-3.0.12.tar.gz
tar zxvf passenger-3.0.12.tar.gz
cd passenger-3.0.12
./bin/passenger-install-apache2-module
Add export PATH=/var/lib/gems/1.8/bin:$PATH to ~/.bashrc
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.
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.

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.

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.

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.

Related

Passenger PassengerAgent does not exist

I'm updating the passenger for my app with rvm. Afterwards I used passenger-config --root to find the passenger and added it to my nginx.conf. This is the directory:
shared/bundle/ruby/2.3.0/gems/passenger-5.0.30
I'm not sure why the passenger root is this one. I thought it'll be the one installed under .rvm. Anyway, I got this error:
Unable to start Phusion Passenger: Support binary PassengerAgent not found...
I am able to use back my previous passenger, and I noticed the difference is the new package has no buildout/support-binaries/PassengerAgent. Am I missing something here?
Setup:
Ubuntu 14.04
rvm 1.29.3
rails 4.2.10
ruby 2.3
capistrano 3
It seems that I installed passenger with rvm. So I need to follow the instructions here and run passenger-install-nginx-module to do it correctly.

Passenger doesn't seem to be running (Capistrano/Rails/Apache/Ubuntu)

Deploying a Rails app using Capistrano to an Ubuntu VM running Apache with Passenger enabled.
I followed this tutorial: https://www.phusionpassenger.com/library/install/apache/install/oss/trusty/ with a few changes given that I'm on 17.04, not 14.04 LTS.
passenger-config validate-install says everything looks fine with both Passenger and Apache. passenger-memory-stats shows both Passenger and Apache processes.
I have sudo apache2ctl restarted several times, with no warnings. But passenger-status, and therefore the passenger-config restart-app that Capistrano runs, reports that Passenger "doesn't seem to be running." So my deploy stops.
There's only one Ruby on the machine, ruby-2.4.1 installed using ruby-install. I have apt-get update and upgraded in case of version mismatches.
Apache logs don't show any errors, certainly none related to Passenger.
Why would Passenger internally disagree, saying that it's both configured properly and there are processes running, but then later saying that it's not running?
I needed to customize the instance registry directory, as suggested by Tony Vincent:
/etc/apache2/mods-enabled/passenger.conf on the server:
PassengerInstanceRegistryDir /home/MYUSER/passenger_temp
config/deploy/production.rb in the Rails app:
set :default_env, { 'PASSENGER_INSTANCE_REGISTRY_DIR' => '/home/MYUSER/passenger_temp' }
Sorry to harp on this but did you run passenger-config validate-install on the ubuntu server (not osx)? Same for passenger-memory-stats and sudo apache2ctl restart.
Based on /tmp not having a passenger.randomstring dir, it sounds like you are confusing local and remote commands. /tmp is the default location for PassengerInstanceRegistryDirs on Ubuntu so if Passenger is running there should be a dir in /tmp that starts with passenger..

Can't install passanger mod_rails

I am trying to install passenger server for my rails application using this guide http://www.modrails.com/documentation/Users%20guide%20Apache.html The problem occurs in step passenger-install-apache2-module.
When I run this command I get this -
WARNING: Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM
How can I solve this? My OS is Ubuntu 13.10 and I have already installed all necessary packages: apache2-bin apache2-data apache2-mpm-worker libapache2-mod-passenger
As Brad Werth said, https://serverfault.com/questions/546924/installing-phusion-passenger-4-0-20-on-ubuntu-13-10 provides a solution.
This problem is caused by a bug in Phusion Passenger's passenger-install-apache2-module program. Ubuntu 13.10 changed the way the httpd -V command works, so passenger-install-apache2-module was unable to correctly detect the MPM for your Apache, resulting in an incorrect warning message. You can safely ignore this warning.
I've fixed the problem in Phusion Passenger now. The fix will be included in version 4.0.34: https://github.com/phusion/passenger/commit/6f5af46de7cb80dd88ef3b35c7c5c4bfbfa0cfd3

Upgrade Phusion Passenger without reinstalling Nginx

Is it possible to upgrade Phusion Passenger to a newer version when it is already running (with Nginx in my case)?
I installed Passenger 4.0.0.rc6 using passenger-install-nginx-module. My Nginx config now contains
passenger_root /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.rc6;
passenger_ruby /usr/local/bin/ruby;
Now I want to upgrade to Passenger 4.0.2. I can install the gem, but when I run passenger-install-nginx-module again, it tries to recompile and reinstall Nginx. (I thought it would be so clever to notice there is already a installed Nginx in the location I specify using --prefix)
I tried to manually change passenger_root to the new Passenger gem location but the I get the following error in the Nginx error log:
2013/05/12 12:30:13 [alert] 14298#0: Unable to start the Phusion Passenger watchdog because its executable (/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.2/agents/PassengerWatchdog) does not exist. This probably means that your Phusion Passenger installation is broken or incomplete, or that your 'passenger_root' directive is set to the wrong value. Please reinstall Phusion Passenger or fix your 'passenger_root' directive, whichever is applicable. (-1: Unknown error)
Apparently the PassengerWatchdog is built when running passenger-install-nginx-module. I don't want to copy over PassengerWatchdog from the old gem because something might have changed.
So... what is the proper way to upgrade Passenger without recompiling and reinstalling Nginx (or Apache)?
#Wukerplank's comment put me on the right track. I checked the output when running passenger-install-nginx-module again and it says:
Nginx doesn't support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.
Do you want this installer to download, compile and install Nginx for you?
1. Yes: download, compile and install Nginx for me. (recommended)
The easiest way to get started. A stock Nginx 1.4.1 with Passenger
support, but with no other additional third party modules, will be
installed for you to a directory of your choice.
2. No: I want to customize my Nginx installation. (for advanced users)
Choose this if you want to compile Nginx with more third party modules
besides Passenger, or if you need to pass additional options to Nginx's
'configure' script. This installer will 1) ask you for the location of
the Nginx source code, 2) run the 'configure' script according to your
instructions, and 3) run 'make install'.
Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.
The important part being that Nginx has to be recompiled to work with Passenger and that existing Nginx configurations are preserved.
So the right way to upgrade Passenger is to
install the new Passenger gem
execute passenger-install-nginx-module with exactly the same parameters as the first time (so the same Nginx version and modules are compiled, it's installed in the same directory etc.)
before installing, check that it says "Welcome to the Phusion Passenger Nginx module installer, v4.0.2." with the new version on top (4.0.2 in my case)
after Nginx is installed, change the passenger_root in your existing Nginx conf (path/to/nginx/conf/nginx.conf) to point to the new gem version (just replace the old version number with the new)
Restart Nginx
Profit
You cannot upgrade without recompiling Nginx. Full upgrade instructions can be found in the Phusion Passenger for Nginx manual. From the manual:
Nginx is a different from other web servers in that it does not support loadable modules. The only way to extend Nginx is to recompile it entirely from source. Since Phusion Passenger consists of some external executables plus an Nginx module, you must recompile Nginx when first installing Phusion Passenger, but also when upgrading Nginx itself or when upgrading the Phusion Passenger version.
Recompiling Nginx and the Phusion Passenger executables is what we will do in this step. The good news is that Phusion Passenger provides a tool to make this easy for you.
If you’ve already installed Nginx before, but without Phusion Passenger support, then you should uninstall it first. You don’t have to, because you can also install another Nginx with Phusion Passenger support, in parallel to the existing Nginx. We merely recommend uninstalling the existing in order to avoid user confusion, but the choice is yours.
If you had previously installed Nginx with Phusion Passenger support, and you are upgrading, then you don’t have to uninstall your existing Nginx first. Instead we’ll overwrite it this step. But it is important that you recompile Nginx with the configure parameters that you used last time.

I can't install Phusion Passenger to run Rails

The problem is simple.
I use the following command to install Passenger
passenger-install-nginx-module
When Passenger automatically installs nginx, I can't launch it.
nginx -v
Returns there's no nginx installed.
How can I fix this?
Notice that passenger-install-nginx-module asks you where to install Nginx to? The nginx binary is in there. Make sure the appropriate directory is in your $PATH. If you don't know what $PATH is or how to use it then you should read a book about basic Unix/Linux command line skills.
You need install Nginx. the webserver.
If you use passenger 3 in standalone, you just need launch passenger start command
I solved this.
Actually, Passenger did install nginx, it just wasn't in the default category.
I recommend to tell passenger to install nginx in /usr/local/nginx

Resources