Foreman Phusion Passenger: no passenger_native_support.so found

Hi,

I installed foreman 1.6 on Linux 6.5 machine. At the end when foreman tried
to start, got error in /var/log/httpd/error_log:

6510 stderr] *** Phusion Passenger: no passenger_native_support.so found
for the current Ruby interpreter
. Compiling one (set
PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)…
[ 2014-09-26 08:10:43.1370 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App
6510 stderr]
[ 2014-09-26 08:10:43.1370 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App
6510 stderr] # mkdir -p
/usr/share/foreman/.passenger/native_support/4.0.18/ruby-1.9.3-x86_64-linux
[ 2014-09-26 08:10:43.1370 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App
6510 stderr]
[ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App
6510 stderr] # cd
/usr/share/foreman/.passenger/native_support/4.0.18/ruby-1.9.3-x86_64-linux
[ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App
6510 stderr]
[ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App
6510 stderr] # /opt/rh/ruby193/root/usr/bin/ruby
'/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ruby_extension_source/extconf.rb'
[ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App
6510 stderr]
[ 2014-09-26 08:10:43.1622 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App
6510 stderr] /opt/rh/ruby193/root/usr/bin/ruby
[ 2014-09-26 08:10:43.1622 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App
6510 stderr] : No such file or directory –
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ruby_extension_source/extconf.rb
(LoadError)
[ 2014-09-26 08:10:43.1636 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App
6510 stderr] Compilation failed.

I checked and found I do have those rpm installed on the Linux (rpm
-qa|grep native)

ruby193-rubygem-passenger-native-4.0.18-9.5.el6.x86_64
rubygem-passenger-native-libs-4.0.18-9.5.el6.x86_64
ruby193-rubygem-passenger-native-libs-4.0.18-9.5.el6.x86_64
rubygem-passenger-native-4.0.18-9.5.el6.x86_64

And I found passenger_native_support.so here:
/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/native/passenger_native_support.so

I checked /etc/httpd/conf.d/passenger.conf and it says:
LoadModule passenger_module modules/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/locations.ini
PassengerRuby /usr/bin/ruby
</IfModule>

Then I checked
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/locations.ini:

[locations]
natively_packaged=true
bin_dir=/usr/bin
agents_dir=/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/agents
helper_scripts_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts
resources_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/resources
doc_dir=/usr/lib/ruby/gems/1.8/doc/passenger-4.0.18
ruby_libdir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib
lib_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib
include_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/include
apache2_module_path=/usr/lib64/httpd/modules
ruby_extension_source_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ruby_extension_source
nginx_module_source_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ngx_http_passenger_module

So my question is:
*1. Why foreman can't find m**y existing passenger_native? *
*2. Can I modify locations.ini to tell passenger where
my passenger_native_support.so is located? If yes, how? What is the
variable name for it? *

Thanks a million!

I did some research and found an article talking about this problem.

I copy passenger_native_support.so
from
/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/native/
to
/usr/share/foreman/.passenger/native_support/4.0.18/ruby-1.9.3-x86_64-linux

and now it doesn't complain about this problem any more.
Hope it will help other people.

Here is the article:
The Phusion Passenger Ruby libraries

phusion_passenger.rb

The Phusion Passenger administration tools are written in Ruby. So the
first thing they do is trying to load phusion_passenger.rb, which is the
source file responsible for figuring out where all the other Phusion
Passenger files are. It tries to look for phusion_passenger.rb in
<OWN_DIRECTORY>/…/lib where <OWN_DIRECTORY> is the directory that the tool
is located in. If phusion_passenger.rb is not there, then it tries to load
it from the normal Ruby load path.

Ruby extension

The Phusion Passenger loader scripts try to load the Phusion Passenger Ruby
extension (passenger_native_support.so) from the following places, in the
given order:

If Phusion Passenger is originally packaged, it will look for the Ruby 

extension in <SOURCE_ROOT>/libout/ruby/<ARCH>. Otherwise, this step is
skipped.
The Ruby library load path.
~/.passenger/native_support/<VERSION>/<ARCH>

If it cannot find the Ruby extension in any of the above places, then it
will attempt to compile the Ruby extension and store it in
~/.passenger/native_support/<VERSION>/<ARCH>.

Conclusion for packagers

If you're packaging Phusion Passenger then you should put both
phusion_passenger.rb and passenger_native_support.so somewhere in the Ruby
load path, or make sure that that directory is included in the $RUBYLIB
environment variable. You cannot specify a custom directory though the
location configuration file.

··· On Friday, September 26, 2014 8:54:38 AM UTC-4, staceyt...@gmail.com wrote: > > Hi, > > I installed foreman 1.6 on Linux 6.5 machine. At the end when foreman > tried to start, got error in /var/log/httpd/error_log: > > [ 2014-09-26 08:10:43.1369 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App > 6510 stderr] *** *Phusion Passenger: no passenger_native_support.so found > for the current Ruby interpreter*. Compiling one (set > PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)... > [ 2014-09-26 08:10:43.1370 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App > 6510 stderr] > [ 2014-09-26 08:10:43.1370 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App > 6510 stderr] # mkdir -p > /usr/share/foreman/.passenger/native_support/4.0.18/ruby-1.9.3-x86_64-linux > [ 2014-09-26 08:10:43.1370 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App > 6510 stderr] > [ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App > 6510 stderr] # cd > /usr/share/foreman/.passenger/native_support/4.0.18/ruby-1.9.3-x86_64-linux > [ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App > 6510 stderr] > [ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App > 6510 stderr] # /opt/rh/ruby193/root/usr/bin/ruby > '/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ruby_extension_source/extconf.rb' > [ 2014-09-26 08:10:43.1375 6476/7f13c4765700 Pool2/Spawner.h:151 ]: [App > 6510 stderr] > [ 2014-09-26 08:10:43.1622 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App > 6510 stderr] /opt/rh/ruby193/root/usr/bin/ruby > [ 2014-09-26 08:10:43.1622 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App > 6510 stderr] : No such file or directory -- > /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ruby_extension_source/extconf.rb > (LoadError) > [ 2014-09-26 08:10:43.1636 6476/7f13c4765700 Pool2/Spawner.h:159 ]: [App > 6510 stderr] Compilation failed. > > *I checked and found I do have those rpm installed on the Linux (rpm > -qa|grep native)* > ruby193-rubygem-passenger-native-4.0.18-9.5.el6.x86_64 > rubygem-passenger-native-libs-4.0.18-9.5.el6.x86_64 > ruby193-rubygem-passenger-native-libs-4.0.18-9.5.el6.x86_64 > rubygem-passenger-native-4.0.18-9.5.el6.x86_64 > > *And I found passenger_native_support.so here:* > > /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/native/passenger_native_support.so > > *I checked /etc/httpd/conf.d/passenger.conf and it says:* > LoadModule passenger_module modules/mod_passenger.so > > PassengerRoot > /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/locations.ini > PassengerRuby /usr/bin/ruby > > > *Then I checked > /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/locations.ini:* > [locations] > natively_packaged=true > bin_dir=/usr/bin > agents_dir=/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/agents > > helper_scripts_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts > resources_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/resources > doc_dir=/usr/lib/ruby/gems/1.8/doc/passenger-4.0.18 > ruby_libdir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib > lib_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib > include_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/include > apache2_module_path=/usr/lib64/httpd/modules > > ruby_extension_source_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ruby_extension_source > > nginx_module_source_dir=/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/ngx_http_passenger_module > > *So my question is:* > *1. Why foreman can't find m**y existing passenger_native? * > *2. Can I modify locations.ini to tell passenger where > my passenger_native_support.so is located? If yes, how? What is the > variable name for it? * > > *Thanks a million!* >

Hey,

> /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/native/
> to
> /usr/share/foreman/.passenger/native_support/4.0.18/ruby-1.9.3-x86_64-linux

I am afraid now you mix and match native library from system passenger
rubygem (which is an older version) with ruby193 rubygem. Are you sure
this is working correctly?

I was tracking down the exactly same problem some time ago using
SystemTap.

http://lukas.zapletalovi.com/2014/05/systemtap-as-a-system-wide-strace-tool.html

On the same page, you can see how Passenger from ruby193 tries to open
up paths on RHEL 6.4…

I thought we've fixed this already. Strange. What version of Foreman is
this?

··· -- Later, Lukas #lzap Zapletal