You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bundle stderr: /bin/bash: chruby: command not found #7
DEBUG[20def91d] Command: cd ~/app/releases/20140714154150 && /usr/local/bin/chruby-exec ruby-1.9.3-p547 -- bundle install --binstubs ~/app/shared/bin --path ~/app/shared/bundle --without development test --deployment --quiet
DEBUG[20def91d] /bin/bash: chruby: command not found
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 100.200.300.400: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: /bin/bash: chruby: command not found
A quick fix to this for those that are having this issue is to add the /etc/profile.d/chruby.sh script as the chruby README suggests:
if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
source /usr/local/share/chruby/chruby.sh
fi
This works because if you run chruby-exec from a non-interactive shell (which is what Capistrano does by default unless you set :pty, true) then it will run the sub-shell as a non-interactive, login shell. This means ~/.bashrc will not get loaded but /etc/profile.d will.
There is a pull request for fixing this at postmodern/chruby#250 but it looks like it needs to be updated.
So, I just ran into this bug and researched it all the way down to the root cause.
The script chruby-exec first does a source /usr/local/share/chruby/chruby.sh then does some logic and finally runs exec $SHELL ... chruby ....
This can not work. exec will not carry shell functions to the new fork. This behaviour was changed after shell-shock. Neither the Ubtunu-14.04 nor the Gentoo ~amd64 I have here will carry the chruby shell function in the newly forked shell after exec. So to make it clear, the exec statement clears all the shell functions that chruby-exec previously sourced to function properly.
I can not explain why some users above describe to only see this when using sudo. Perhaps some quirky work-around of the individual distro they are using? Perhaps not using Bash?
Activity
hungryzi commentedon Sep 2, 2014
I got the same error. Did you find out why @KamilLelonek ?
KamilLelonek commentedon Sep 2, 2014
I threw away
chruby.grzuy commentedon Sep 30, 2014
Same issue here. Anyone found the reason?
h0jeZvgoxFepBQ2C commentedon Nov 24, 2014
Anyone found a solution?
cannikin commentedon Dec 8, 2014
Also getting this. Logging into the server and running
chruby-execworks fine...fnordfish commentedon Dec 16, 2014
I had to
set :pty, true(which is not a good idea). Think it's achruby-execproblem.mxhold commentedon Dec 19, 2014
A quick fix to this for those that are having this issue is to add the
/etc/profile.d/chruby.shscript as the chruby README suggests:This works because if you run
chruby-execfrom a non-interactive shell (which is what Capistrano does by default unless youset :pty, true) then it will run the sub-shell as a non-interactive, login shell. This means~/.bashrcwill not get loaded but/etc/profile.dwill.There is a pull request for fixing this at postmodern/chruby#250 but it looks like it needs to be updated.
leehambley commentedon Dec 19, 2014
FWIW we documented this behaviour: http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/#which-shell-startup-files-do-get-loaded?
fnordfish commentedon Dec 19, 2014
Thanks for the pointers!
leehambley commentedon Dec 19, 2014
For sure that graphic is one that starts only to make sense once you actually understand what it tells you, but it won't teach you anything :-D
lfender6445 commentedon Mar 17, 2016
I ran into similar issue, but sudo appears to work fine
baccenfutter commentedon Apr 26, 2016
So, I just ran into this bug and researched it all the way down to the root cause.
The script
chruby-execfirst does asource /usr/local/share/chruby/chruby.shthen does some logic and finally runsexec $SHELL ... chruby ....This can not work.
execwill not carry shell functions to the new fork. This behaviour was changed after shell-shock. Neither the Ubtunu-14.04 nor the Gentoo ~amd64 I have here will carry thechrubyshell function in the newly forked shell afterexec. So to make it clear, theexecstatement clears all the shell functions thatchruby-execpreviously sourced to function properly.I can not explain why some users above describe to only see this when using sudo. Perhaps some quirky work-around of the individual distro they are using? Perhaps not using Bash?
... will never work.
baccenfutter commentedon Apr 26, 2016
Proposed fix: remove the exec.
Why
execin the first place?Why not just
$SHELL -c "chruby ..."?