Skip to content

bundle stderr: /bin/bash: chruby: command not found #7

Open

Description

@KamilLelonek
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

Activity

  1. hungryzi commented on Sep 2, 2014

    @hungryzi

    I got the same error. Did you find out why @KamilLelonek ?

  2. KamilLelonek commented on Sep 2, 2014

    @KamilLelonek
    Author

    I threw away chruby.

  3. grzuy commented on Sep 30, 2014

    @grzuy

    Same issue here. Anyone found the reason?

  4. h0jeZvgoxFepBQ2C commented on Nov 24, 2014

    @h0jeZvgoxFepBQ2C

    Anyone found a solution?

  5. cannikin commented on Dec 8, 2014

    @cannikin

    Also getting this. Logging into the server and running chruby-exec works fine...

  6. fnordfish commented on Dec 16, 2014

    @fnordfish

    I had to set :pty, true (which is not a good idea). Think it's a chruby-exec problem.

  7. mxhold commented on Dec 19, 2014

    @mxhold

    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.

  8. fnordfish commented on Dec 19, 2014

    @fnordfish

    Thanks for the pointers!

  9. leehambley commented on Dec 19, 2014

    @leehambley
    Member

    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

  10. lfender6445 commented on Mar 17, 2016

    @lfender6445

    I ran into similar issue, but sudo appears to work fine

    › /bin/bash -c '/usr/local/bin/chruby-exec 2.2.3 -- gem -v'
    chruby-exec: RUBY and COMMAND required
    › /bin/bash -c 'sudo /usr/local/bin/chruby-exec 2.2.3 -- gem -v'
    2.4.5.1
    
  11. baccenfutter commented on Apr 26, 2016

    @baccenfutter

    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?

    source <some-shell-functions>
    exec $SHELL -c 'binary-using-shell-functions-above'
    

    ... will never work.

  12. baccenfutter commented on Apr 26, 2016

    @baccenfutter

    Proposed fix: remove the exec.

    Why exec in the first place?
    Why not just $SHELL -c "chruby ..."?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions