Troubleshooting Passenger Standalone and Ruby

This page provides guidence on what to do when you encounter problems.

Table of contents

  • Loading...

First things to try

1 Check the Passenger log file

One of the first things you should do upon encountering a problem, is to check the Passenger log file. The log file is where Passenger prints to when it encounters a problem or when it wants to tell you something.

This log file contains:

  • Passenger info, warning and error messages.
  • Everything that the application writes to STDOUT and STDERR. This typically consists of errors that the application encounters during startup, but not errors that it encounters when it's handling requests.

The default log file is located in log/passenger.XXX.log, where XXX is the port number that Passenger listens on.

Or, if you passed the --log-file / "log_file" configuration, then the log file is in the referenced file.

Not finding anything useful in the Passenger error log? Please read Troubleshooting logging problems.

2 Check the application log file

The application or web framework may have its own log file that is independent from the Passenger log file. You should also check that file to see whether your application or web framework has logged any important messages.

For example, Ruby on Rails logs to log/development.log and log/production.log. When an error occurs during request handling, it is typically logged here. Note that this file does not contain errors that Rails encounters during startup – those kinds of errors are typically written to STDERR, which means they end up in the Passenger log instead.

3 Upgrade Passenger to the latest version

Some problems are caused by bugs in Passenger. Passenger is under active maintenance and development, so there is a chance that – assuming you really ran into a bug – the bug is already fixed. Please upgrade Passenger to the latest version and check whether the problem is still there.

If you suspect that your problem is a bug in Passenger, and upgrading didn't fix it, please report the bug to our Github issue tracker.

If upgrading Passenger didn't help, and you don't think your problem is caused by a bug, then please continue with this troubleshooting guide.

4 Consult the in-depth topics

Passenger takes care of a lot of things for you under the hood. If you don't know what Passenger does, then problems may seem opaque. Try learning more about the activities that Passenger perform; it may help you with understanding the problem and with troubleshooting.

5 Out of ideas? Try the support resources

If you are stuck with a problem, please do not hesitate to contact one of the support resources. Passenger has a friendly community of users who look out for each other. We – Passenger's authors – are also ready to help you whenever we can.

Stack Overflow
Post a question on Stack Overflow if you are experiencing problems. Support on Stack Overflow is provided by the community, and our own developers also watch Stack Overflow on a regular basis. But support here is provided on a best-effort basis, so sometimes a bit of patience will help. Be sure to use the "passenger" tag.
Github issue tracker
If you are experiencing a problem that you believe is a bug, please report it here.
Security vulnerabilities email address
Please report security vulnerabilities to security@phusion.nl. We will do our best to respond to you as quickly as we can, so please do not disclose the vulnerability until then.
Priority support for Enterprise customers
If you are a Passenger Enterprise customer, then you are eligible for basic priority support. Please submit your support ticket via the interface in the customer area.

For most customers, this basic priority support has a response time of 3 working days, with a maximum of 1 support incident per month. Please consult your contract for the exact support level that you are eligible for.

Premium support contracts
We also provide premium support contracts for those who desire higher support levels, for example 24x7 phone support with a response time of 1 hour.

Common problems

I get "command not found" when running a Passenger command through sudo

Symptoms

Passenger commands can be found as a normal user, but not when run through sudo:

$ passenger-status
...some output, but no "command not found" error...
$ passenger-install-apache2-module
...some output, but no "command not found" error...
$ sudo passenger-status
sudo: passenger-status: command not found
$ sudo passenger-install-apache2-module
sudo: passenger-install-apache2-module: command not found

Cause

The operating system looks up commands using the PATH environment variable. However, sudo resets all environment variables to a default value, dictated by sudo. If Passenger was installed to a location that is not in the default sudo PATH value, then sudo will not be able to find the Passenger commands.

In addition, if you installed Passenger using a Ruby interpreter that was installed through RVM, then you must use rvmsudo instead of sudo. As a rule, when you're an RVM user, always use rvmsudo instead of sudo.

Solution

Execute the command using its full path. You can use which as a normal user to lookup the full path:

$ which passenger-status
/somewhere/bin/passenger-status
Next, run full path of the command using either sudo or rvmsudo:
$ sudo /somewhere/bin/passenger-status

# -OR, if you're using RVM:-

$ rvmsudo /somewhere/bin/passenger-status

When using sudo, you will probably run into similar "command not found" issues in the future, with components other than Passenger. We strongly recommend you to learn about environment variables so that you know what to do in the future.

Upon uploading a file, Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)"

Symptoms

When performing an HTTP POST call, the request sometimes fails, with Passenger reporting an error along the lines of:

/tmp/passenger-standalone.8583/client_body_temp/0000000022" failed (2: No such
file or directory), client: 127.0.0.1, server: www.foo.com

Cause

Passenger buffers HTTP POST bodies (file uploads) to a temporary directory, by default /tmp/passenger-standalone.xxx. This error means that Passenger that that directory has been removed, probably by some other program.

Solution

Tell Passenger to use a different directory to store its temporary files by setting the TMPDIR environment variable. For example:

mkdir $HOME/tmp
cd /path-to-your-app
export TMPDIR=$HOME/tmp
passenger start

Common problems specific to Ruby

The application reports during startup that it cannot find a gem

Symptoms

Despite the fact that you have already run bundle install, you see an error page that contains the following messages:

It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:

  bundle install

...

Could not find XXX in any of the sources (Bundler::GemNotFound)

Causes and solutions

The most common cause of this problem, is that your system has multiple Ruby interpreter (or multiple RVM gemsets), and your application is not being run under the correct Ruby interpreter. The bundle install command installs gems into a directory that is specific to one Ruby interpreter, so when your app is being run under a different Ruby interpreter, Bundler cannot find its gems.

To solve this problem, you must explicitly tell Passenger what Ruby interpreter to use. You can do this with the --ruby / "ruby".

The second most common cause of this problem, is that your application is being run under the wrong user. The bundle install command often installs gems into a user-specific directory. So if Passenger for some reason runs your app as a different user than the one that invoked bundle install, Bundler may not be able to find its gems.

To solve this problem, you must explicit tell Passenger what user to run as by using the --user / "user" option.

If this didn't solve your problem, try following the tips in the error message. Also be sure to double check the settings printed on the error page. Be sure to double check all environment variables, user IDs, etc and check whether they are what you expect.

Common problems specific to Ruby on Rails

This section lists some common problems that are specific to the Ruby on Rails web framework.

The "About your application's environment" link only works if the application is started in the "development" environment. Passenger starts the application in the "production" environment by default.

Use the --environment / "environment" option to change this.

The Rails application reports that it's unable to start because of a permission error

Please check whether your Rails application's directory has the correct permissions. By default, Rails applications are started as the owner of the file config.ru, except if the file is owned by root. If the file is owned by root, then the Rails application will be started as 'nobody' (or as the user specified by the --user / "user" option).

The Rails application cannot find my database

If your Rails application cannot find your database, then you probably didn't configure Passenger correctly, or didn't configure your database.yml correctly. By default, Passenger runs Rails applications in 'production' mode, so please either make sure that your database.yml contains an entry for the production environment, or configure Passenger to start your app in the 'development' environment.