Question

Ruby Update on Redmine Instance Error

After successful attempt to update Redmine ( from 3.0.3 to 3.3.3 ) I tried to update Ruby version ( from 2.0.0 to 2.1.4 or 2.2.1 or 2.3.1 ) using rvm The commands that I used are :

  • rvm install 2.2.1 / 2.1.4 / 2.3.1
  • rvm user --default 2.2.1 / 2.1.4 / 2.3.1
  • cd /srv/redmine
  • bundle update
  • bundle exec rake db:migrate RAILS_ENV=production
  • bundle exec rake redmine:plugins:migrate RAILS_ENV=production
  • bundle exec rake tmp:cache:clear tmp:sessions:clear RAILS_ENV=production
  • touch tmp/restart.txt

After doing those steps successfully, I encounter below error

[ 2017-03-10 11:42:09.6397 1680/7f1db50ec700 App/Implementation.cpp:303 ]: Could not spawn process for application /srv/redmine: An error occured while starting up the preloader.
  Error ID: f1f723b1
  Error details saved to: /tmp/passenger-error-NLN2oJ.html
  Message from application: <p>It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:</p>

  <pre class="commands">bundle install</pre>

<p>If that didn't work, then maybe the problem is that your gems are installed to <code>/var/www/.rvm/gems</code>, while at the same time you set <code>PassengerRuby</code> (Apache) or <code>passenger_ruby</code> (Nginx) to <code>/usr/local/rvm/wrappers/ruby-2.0.0-p643/ruby</code>. Because of the latter, RVM does not load gems from the home directory.</p>

<p>To make RVM load gems from the home directory, you need to set <code>PassengerRuby</code>/<code>passenger_ruby</code> to an RVM wrapper script inside the home directory:</p>

<ol>
  <li>Login as www-data.</li>
  <li>Enable RVM mixed mode by running:
      <pre class="commands">rvm user gemsets</pre></li>
  <li>Run this to find out what to set <code>PassengerRuby</code>/<code>passenger_ruby</code> to:
      <pre class="commands">/usr/local/rvm/gems/ruby-2.0.0-p643/wrappers/ruby \
/usr/bin/passenger-config --detect-ruby</pre></li>
</ol>

<p>If that didn't help either, then maybe your application is being run under a different environment than it's supposed to. Please check the following:</p>

<ol>
  <li>Is this app supposed to be run as the <code>www-data</code> user?</li>
  <li>Is this app being run on the correct Ruby interpreter? Below you will
      see which Ruby interpreter Phusion Passenger attempted to use.</li>
  <li>Please check whether the correct RVM gemset is being used.</li>
  <li>Sometimes, RVM gemsets may be broken.
      <a href="https://github.com/phusion/passenger/wiki/Resetting-RVM-gemsets">Try resetting them.</a></li>
</ol>

<p>-------- The exception is as follows: -------</p>
Could not find json-1.8.6 in any of the sources (Bundler::GemNotFound)
<pre>  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/spec_set.rb:87:in `block in materialize&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/spec_set.rb:80:in `map!&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/spec_set.rb:80:in `materialize&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/definition.rb:176:in `specs&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/definition.rb:235:in `specs_for&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/definition.rb:224:in `requested_specs&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/runtime.rb:118:in `block in definition_method&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/runtime.rb:19:in `setup&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler.rb:100:in `setup&#39;
  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.14.5/lib/bundler/setup.rb:20:in `&lt;top (required)&gt;&#39;
  /usr/local/rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require&#39;
  /usr/local/rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require&#39;
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:399:in `activate_gem&#39;
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:277:in `block in run_load_path_setup_code&#39;
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:404:in `running_bundler&#39;
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:276:in `run_load_path_setup_code&#39;
  /usr/share/passenger/helper-scripts/rack-preloader.rb:99:in `preload_app&#39;
  /usr/share/passenger/helper-scripts/rack-preloader.rb:153:in `&lt;module:App&gt;&#39;
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `&lt;module:PhusionPassenger&gt;&#39;
  /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `&lt;main&gt;&#39;</pre>


[ 2017-03-10 11:42:09.6570 1680/7f1db60ee700 age/Hel/Req/CheckoutSession.cpp:252 ]: [Client 1-2] Cannot checkout session because a spawning error occurred.

I’m not too familiar with ruby & passenger but I think that my the passenger is still detecting ruby 2.0.0 as my main ruby installation ( even though rvm list already pointing into another ruby version )

Any help would be much appreciated :D

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Finally found the answer.

I should update the passenger_ruby entry on /etc/nginx/nginx.conf

update the entry to your ruby installation path should fix the issue

This comment has been deleted

Hi hansen,

Thanks for the response, however I don’t think that it was the case since if I run bundle list then json version 1.8.6 is included in the list. I think the problem lies in passenger that is still searching in ruby 2.0.0 even though I already update my ruby to 2.3.1

bundle list
...
  * hashie (1.2.0)
  * htmlentities (4.3.1)
  * i18n (0.7.0)
  * iconv (1.0.4)
  * inifile (3.0.0)
  * jquery-rails (3.1.4)
  * json (1.8.6)
  * listen (3.0.8)
  * loofah (2.0.3)
  * lumberjack (1.0.11)
...

You’re missing a specific “bundle”, called JSON version 1.8.6 - try running this to install it:

gem install json -v '1.8.6'

I’ve never played with Ruby, just saw the error and searched for a solution.