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

拥有回忆 提交于 2019-12-18 14:52:29

问题


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?


回答1:


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




回答2:


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.




回答3:


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




回答4:


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




回答5:


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



来源:https://stackoverflow.com/questions/12127603/usr-bin-env-ruby-noexec-wrapper-fails-with-no-file-or-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!