Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/usr/bin/env ruby_noexec_wrapper fails with no file or directory

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 <[email protected]>, Michal Papis <[email protected]> [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?

like image 268
Prakash Avatar asked Aug 26 '12 04:08

Prakash


3 Answers

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

like image 84
mpapis Avatar answered Nov 11 '22 15:11

mpapis


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.

like image 25
Bryan Larsen Avatar answered Nov 11 '22 15:11

Bryan Larsen


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

like image 1
isawk Avatar answered Nov 11 '22 15:11

isawk