Search code examples
ruby-on-railsrubylinuxapachepassenger

Ruby Upgrade permission error(Errno::EACCES)


I had ruby v1.9 installed ( and am running a few rails applications, e.g: redmine). I wanted to install GitLab, which required ruby >2.0. So I installed ruby following this guideline( compiled from source). Now after GitLab installation finished i restarted apache, now redmine has stopped working. Tried running gem install bundler and bundle install both of them gave the following error:

ERROR:  While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.10.5/.gitignore

I am guessing that I cannot run them cause they are in folders that only root can access. Anyway, now running with sudo didn't solve the problem. Apache log shows the following error:

[ 2015-07-22 13:51:30.0223 377/7f2ed6b49700 

age/Cor/Req/CheckoutSession.cpp:252 ]: [Client 1-82] Cannot checkout session because a spawning error occurred. The identifier of the error is f16d292b. Please see earlier logs for details about the error.
App 4932 stderr: *** ERROR ***: Cannot execute /usr/bin/ruby1.9.1: No such file or directory (2)
App 4932 stdout: 
[ 2015-07-22 13:51:30.4210 377/7f2ed40bf700 App/Implementation.cpp:303 ]: Could not spawn process for application /sites/www/6Qj8BHSbtswjs5gJXv1lXpao: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger.
  Error ID: b9bbbe68
  Error details saved to: /tmp/passenger-error-OA4S88.html
  Message from application: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger. Please read <a href="https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems">this article</a> for more information about this problem.<br>
<h2>Raw process output:</h2>
<pre>*** ERROR ***: Cannot execute /usr/bin/ruby1.9.1: No such file or directory (2)

</pre>

[ 2015-07-22 13:51:30.4274 377/7f2ed62c7700 age/Cor/Req/CheckoutSession.cpp:252 ]: [Client 2-82] Cannot checkout session because a spawning error occurred. The identifier of the error is b9bbbe68. Please see earlier logs for details about the error.

I am guessing that application is trying to use old ruby path, which is unavailable. Can somebody provide a solution that would solve this issue?


Solution

  • So I found out the problem. The main problem was that /etc/apache2/apache2.conf had the wrong path for passenger. That was the main reason for apache log error. I fixed that by re-running sudo passenger-install-apache2-module. As pointed out by @Srdjan, I had to install passenger specific to ruby version installed. After that it worked.