Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save narath/11324688 to your computer and use it in GitHub Desktop.
Save narath/11324688 to your computer and use it in GitHub Desktop.
How we upgraded Phusion Passenger for Ruby 2.1 on Ubuntu Precise

After upgrading to Ruby 2.1, the rails app and apache we got the following error in our apache log:

/usr/bin/ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- phusion_passenger (LoadError)
	from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:76:in `<main>'
[ pid=56858 thr=140583398008576 file=ext/apache2/Hooks.cpp:884 time=2014-04-25 22:10:55.823 ]: Unexpected error in mod_passenger: Cannot spawn application '/home/web1.kmedcommunications.com/current': Could not read from the spawn server: Connection reset by peer (104)
  Backtrace:
     (empty)

To fix this you need to upgrade passenger. We previously had installed passenger using aptitude, but rerunning this did not help. So to upgrade it manually to support the new ruby version we did the following.

Switch to root

sudo -s

Install the passenger gem

gem install passenger

Install curl with ssl (required by the passenger install script)

apt-get install libcurl3 libcurl3-dev

Run the passenger install script

passenger-install-apache2-module

Now install this in Apache conf files. Since we had a previous installation, we just used the existing files passenger.load and passenger.conf

cd /etc/apache2/mods-available/
cp passenger.conf passenger.conf.bak
cp passenger.load passenger.load.bak

Edit the load file

vim passenger.load

Add this text

 LoadModule passenger_module /var/lib/gems/2.1.0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so

Edit the conf file

vim passenger.conf

Add this text

<IfModule mod_passenger.c>
   PassengerRoot /var/lib/gems/2.1.0/gems/passenger-4.0.41
   PassengerDefaultRuby /usr/bin/ruby2.1
 </IfModule>

Restart and you should be good to go.

apachectl restart
tail -f /var/log/apache2/error.log

Thanks as always to Stephen Smith.

@gelinger777
Copy link

You are fantastic, man! Saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment