UnsetEnv when PassengerUserSwitching ia on?

24 views
Skip to first unread message

Tony Primerano

unread,
Sep 30, 2016, 2:14:03 PM9/30/16
to Phusion Passenger Discussions

I have a rails application running with bundler under passenger 5.0.30

I just moved from RH to Ubuntu and my application is not starting because there is a GEM_HOME in the environment that points to gems that were compiled on RH.

For the life of me I can't figure out where this GEM_HOME is being set.

I did a "bundle install --deployment" to ensure the application would only reference local gems but the config.ru fails before bundler is brought into the mix due to the bad GEM_HOME.

I added  the following to my apache configuration inside the a Directory directive.

UnsetEnv GEM_HOME

This had no impact.  

Should this work?  Should I set it in VirtualHost directive instead?

Since it is using PassengerUserSwitching should it honor what I have in my .cshrc?  (yes, i'm using csh) or does passenger always invoke the bash shell?

Or is passenger setting GEM_HOME based on where PassengerRuby is pointing? 

My PassengerRuby is

    PassengerRuby /opt/ruby2/bin/ruby

and the GEM_HOME is

GEM_HOME = /in a totally different directory/ruby/2.1.0

At one point I did set GEM_HOME in my .cshrc but I removed it and restarted apache.

So i'm stumped. What is setting GEM_HOME?

(as a side not the front of my PATH now begins with

/in a totally different directory/ruby/2.1.0/bin

help!!!

Thanks
Tony


Camden Narzt

unread,
Oct 3, 2016, 10:18:05 AM10/3/16
to Phusion Passenger Discussions
Which user is apache run as, are you sure they use csh not bash? Also, look at the scripts in /etc for the shell of the correct user.

Also if you are using user switching in passenger be sure to check the shell and related scripts for that user as well.

Tony Primerano

unread,
Oct 3, 2016, 1:39:07 PM10/3/16
to Phusion Passenger Discussions
Yes, I have user switching on.   Will UnsetEnv work with user switching or is that only for the apache user process?

If this is true.  does passenger spawn the user in their default shell (in my case csh) or does it force /bin/sh?

Camden Narzt

unread,
Oct 3, 2016, 3:28:36 PM10/3/16
to Phusion Passenger Discussions
You shouldn't have to use UnsetEnv at all, you will have far fewer headaches if you simply remove the incorrect state from your shell's config.

Now most of your problems seem to be related to the environment of your interactive login, such as not being able to run bundler and your PATH, I'd recommend hitting Ctrl-D until you exit the login with these problems, re-login and if the problem persists then look in the files listed when you run this command:

ls /etc/csh.* ~/.cshrc

You're looking for any mention of the GEM_HOME or PATH or rvm or rbenv. Let me know what you find.

Tony Primerano

unread,
Oct 3, 2016, 4:40:36 PM10/3/16
to Phusion Passenger Discussions
If i log into the machine as the user that passenger runs the process as GEM_HOME and GEM_PATH are unset.  All references to GEM_HOME and GEM_PATH have been removed from .cshrc and elsewhere.

but when passenger fails to start the application the returned "Web application could not be started"  page has GEM_HOME set.  :-\

Last week GEM_HOME was being set in my .cshrc file but I removed it and restarted apache.   Maybe this setting is being cached elsewhere by passenger?

Camden Narzt

unread,
Oct 4, 2016, 3:46:42 PM10/4/16
to Phusion Passenger Discussions
No, when you restart apache everything gets setup fresh, there's no cache that survives a restart. Do you start apache with the init.d script? have you checked in there? Also how is your ruby installed, it's in opt so that sounds like you built it from source yourself, but I want to check.

Tony Primerano

unread,
Oct 11, 2016, 9:09:03 AM10/11/16
to Phusion Passenger Discussions
Sorry for the slow reply here.  My focus has shifted.

We grepped all of /etc and we aren't setting GEM_HOME.   And yes, we built ruby from source.

Tony Primerano

unread,
Oct 11, 2016, 9:41:16 AM10/11/16
to Phusion Passenger Discussions

Found my issue..   passenger was not pointing to the install i thought it was.   User error.  Thanks for the help!

Please close this out.
Reply all
Reply to author
Forward
0 new messages