13

When I try to start chef-solr as service it's failing with the following error

# service chef-solr start
Starting chef-solr: /usr/bin/env: ruby_noexec_wrapper: No such file or directory
                                                       [FAILED]

But when I run it manually from command line it's running successfully

# chef-solr -d -c /etc/chef/solr.rb -L /var/log/chef/solr.log -P /var/run/chef/solr.pid
# echo $?
0
# ps -ef | grep chef
root      2691     1 12 04:19 ?        00:00:01 java -Xmx256M -Xms256M -Dsolr.data.dir=/var/lib/chef/solr/data -Dsolr.solr.home=/var/lib/chef/solr/home -jar /var/lib/chef/solr/jetty/start.jar

Here is my rvm info

# rvm info

ruby-1.9.3-p194:

  system:
    uname:       "Linux Console 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.15.6 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "7 hours 1 minute 51 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "x86_64-linux"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]"

  homes:
    gem:          "/usr/local/rvm/gems/ruby-1.9.3-p194"
    ruby:         "/usr/local/rvm/rubies/ruby-1.9.3-p194"

  binaries:
    ruby:         "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/usr/local/rvm/gems/ruby-1.9.3-p194/bin/rake"

  environment:
    PATH:         "/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/lib64/qt-3.3/bin:/usr/java/default/bin:/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin:/root/bin"
    GEM_HOME:     "/usr/local/rvm/gems/ruby-1.9.3-p194"
    GEM_PATH:     "/usr/local/rvm/gems/ruby-1.9.3-p194:/usr/local/rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/usr/local/rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

Here are the corresponding environmental variables

declare -x GEM_HOME="/usr/local/rvm/gems/ruby-1.9.3-p194"
declare -x GEM_PATH="/usr/local/rvm/gems/ruby-1.9.3-p194:/usr/local/rvm/gems/ruby-1.9.3-p194@global"
declare -x IRBRC="/usr/local/rvm/rubies/ruby-1.9.3-p194/.irbrc"
declare -x MY_RUBY_HOME="/usr/local/rvm/rubies/ruby-1.9.3-p194"
declare -x PATH="/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/lib64/qt-3.3/bin:/usr/java/default/bin:/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin:/root/bin"
declare -x RUBY_VERSION="ruby-1.9.3-p194"

How to get this issue resolved?

Prakash
  • 601
  • 2
  • 9
  • 24

5 Answers5

24

make sure all the variables all set correctly, especially PATH and GEM_PATH, you can use this code to set the environment for you:

source /usr/local/rvm/environments/ruby-1.9.3-p194

add it in the service before chef-solr is run

mpapis
  • 52,729
  • 14
  • 121
  • 158
  • This is not only the case with chef-solr, while boot strapping all the components chef-solr, chef-server, chef-expander are failing like this and the init scripts getting generated evreytime I bootstrap. Hence made a crude fix of `source /etc/profile.d/rvm.sh` inside /etc/functions and it's working now. Not sure whether it's a right fix. – Prakash Aug 26 '12 at 05:43
  • if `/etc/functions` is sourced by all the services in your system then yes this is the right solution, it gives access to the ruby for all services, and it uses the lightweight method - by just updating environment, no extra wrappers/routing involved. – mpapis Aug 26 '12 at 14:16
  • 3
    You can also load default ruby by `source /home/deploy/.rvm/environments/default` – Lev Lukomsky Oct 10 '12 at 17:15
  • 5
    Ooooor even `source ~/.rvm/environments/default` – Besi Nov 02 '12 at 10:39
  • As @Besi said, if RVM is installed without root privileges, it's installed in user home. That solved my problem of a gem that wasn't on my bin path. – Alejandro García Iglesias Dec 03 '12 at 16:58
4

My problem was similar, and so was my answer:

My problem was

Permission denied - /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper

ruby_noexec_wrapper was in ruby-1.9.3-p194@global not in the listed path

My solution was

source /usr/local/rvm/environments/ruby-1.9.3-p194@global

I upvoted mpapis because his answer was critical in finding mine. Feel free to upvote him rather than me. Just adding an additional answer to try and help anybody with a similar problem.

Bryan Larsen
  • 9,468
  • 8
  • 56
  • 46
1

Answer not related to chef, but may help in future.

I had a similar issue, but since I was following a tutorial to setup thin in RVM. I fixed by using wrapper generated by RVM for thin service

/home/thin/.rvm/bin/bootup_thin

therefore changed line in init script

DAEMON=/home/thin/.rvm/gems/ree-1.8.7-2012.02/bin/thin

to

DAEMON=/home/thin/.rvm/bin/bootup_thin

Post on RVM wrappers RVM and thin, root vs. local user

Community
  • 1
  • 1
isawk
  • 436
  • 1
  • 4
  • 10
0

I try all these answers, all failed. But I found another way to solve this problem, could be helpful:

gem install rubygems-bundler

You can also find answer from noexec library

Livia Huang
  • 246
  • 2
  • 8
0

I got this problem after installing ruby 2.0 on my mac. Part of that was I installed the latest rvm

rvm get stable

Then I started getting this error. Maybe I ran some 'gemset pristine's after this.

In any event, for me, this worked. WARNING! If you proceed as I have done, your gemsets for the ruby in question will get completely removed and rebuilt. Maybe you want a fresh backup? But this is the hammer.

# WARNING!!! THIS RECIPE IS POTENTIALLY DESTRUCTIVE!
rvm remove ruby-1.9.3-p194 # this will remove the gemsets for this version as well
rvm install ruby-1.9.3-p194 # time for coffee
rvm use ruby-1.9.3-p194
rvm gemset create aura-rover-config # my gemset name
rvm use ruby-1.9.3-p194@aura-rover-config # do I need to do this?  Can't 'member
bundle
# now it all works

The fun part of this was, all the little hacks I made in my installed gemsets, those got blown away. MAKE A BACKUP

Bret Weinraub
  • 1,943
  • 15
  • 21