13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS 7 で Phusion Passenger の passenger-status を実行するとエラーとなる

Posted at

知らなかった。

  • CentOS Linux release 7.1.1503 (Core)
  • Passenger 5.0.21

以下のように passenger-status を実行するとエラーとなる。

~# passenger-status 
ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it is running,
then the causes of this problem could be:

1. You customized the instance registry directory using Apache's PassengerInstanceRegistryDir option,
Nginx's passenger_instance_registry_dir option, or Phusion Passenger Standalone's --instance-registry-dir
command line argument. If so, please set the environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that
directory and run passenger-status again.
2. The instance directory has been removed by an operating system background service. Please set a different
instance registry directory using Apache's PassengerInstanceRegistryDir option, Nginx's
passenger_instance_registry_dir option, or Phusion Passenger Standalone's --instance-registry-dir
command line argument.

特に設定をいじったりしていない。Passenger のドキュメントを確認する。

The default value for this option is as follows:

  • If you are on Red Hat and CentOS, and installed Passenger through the RPMs provided by Phusion, then the default value is /var/run/passenger-instreg.
  • Otherwise, the default value is the value of the $TMPDIR environment variable. Or, if $TMPDIR is not set, /tmp.

gem install passenger したものなので上記の後者。
探してみるが関係していそうなものが無い。

~# echo $TMPDIR

~# ls /tmp
ks-script-tlgcPw  systemd-private-mBNl7v  yum.log

ここで強引に探してみる。それらしきものが見つかる。

~# find / -iname '*passenger*'
... 省略 ...
/tmp/systemd-private-mBNl7v/tmp/passenger.aFePViS
... 省略 ...

指定してみると passenger-status が動く。

~# PASSENGER_INSTANCE_REGISTRY_DIR=/tmp/systemd-private-mBNl7v/tmp passenger-status 
Version : 5.0.21
Date    : 2015-11-30 23:36:48 +0900
Instance: 2Wqc3QMb (Apache/2.4.6 (CentOS) Phusion_Passenger/5.0.21)

----------- General information -----------
Max pool size : 6
App groups    : 1
Processes     : 1
Requests in top-level queue : 0

----------- Application groups -----------
/var/lib/redmine:
  App root: /var/lib/redmine
  Requests in queue: 0
  * PID: 2473    Sessions: 0       Processed: 1       Uptime: 5m 22s
    CPU: 0%      Memory  : 125M    Last used: 5m 22s ago

では systemd-private-xxxxxx とは何か。ググる。

Because systemd is configured to give nginx a private /tmp. If you must use the system /tmp instead for some reason then you will need to modify the .service file to read "PrivateTmp=no".

Another very simple but powerful configuration switch is PrivateTmp=:

If true, sets up a new file system namespace for the executed processes and mounts private /tmp and /var/tmp directories inside it that is not shared by processes outside of the namespace.

Passenger は Apache HTTP Server (yum でインストールしたやつ) が使っている。
Apache の PrivateTmp の設定値を確認する。
設定ファイルは下記で分かった。

~# systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
... 省略 ...

下記のように true だった。

~# cat /usr/lib/systemd/system/httpd.service 
... 省略 ...
PrivateTmp=true
... 省略 ...

正直よくわからない。

13
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?