Closed jlove4m closed 8 years ago
Forgot to add this - definitely where some of the weirdness is coming from Im sure!
Even when I run chruby to a new version, when I run the bug report it seems the older stuff is there, even though the output of 'env' seems to disagree
jenkins@Jenkins:~$ ./chruby_bug_report.sh
## System
Linux Jenkins 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
GNU bash, version 4.3.8(1)-release (x86_64-pc-linux-gnu) [/bin/bash]
tmux 1.8 [/usr/bin/tmux]
ruby 1.9.3p547 (2014-05-14) [x86_64-linux] [/opt/rubies/ruby-1.9.3-p547/bin/ruby]
Bundler version 1.9.2 [/opt/rubies/ruby-1.9.3-p547/bin/bundle]
chruby version 0.3.8 [/usr/local/bin/chruby-exec]
## Environment
CHRUBY_VERSION=0.3.8
SHELL=/bin/bash
PATH=/var/lib/jenkins/.gem/ruby/1.9.3/bin:/opt/rubies/ruby-1.9.3-p547/lib/ruby/gems/1.9.1/bin:/opt/rubies/ruby-1.9.3-p547/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
HOME=/var/lib/jenkins
RUBIES=(/opt/rubies/ruby-1.9.3-p547 /opt/rubies/ruby-2.2.1)
RUBY_ROOT=/opt/rubies/ruby-1.9.3-p547
RUBY_VERSION=1.9.3
RUBY_ENGINE=ruby
RUBY_AUTO_VERSION=
RUBYLIB=
RUBYOPT=
RUBYPATH=
RUBYSHELL=
GEM_ROOT=/opt/rubies/ruby-1.9.3-p547/lib/ruby/gems/1.9.1
GEM_HOME=/var/lib/jenkins/.gem/ruby/1.9.3
GEM_PATH=/var/lib/jenkins/.gem/ruby/1.9.3:/opt/rubies/ruby-1.9.3-p547/lib/ruby/gems/1.9.1
## Hooks
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
## Aliases
jenkins@Jenkins:~$ env
XDG_SESSION_ID=24
GEM_HOME=/var/lib/jenkins/.gem/ruby/2.2.1
SHELL=/bin/bash
TERM=xterm
OLDPWD=/var/lib/jenkins/jobs
USER=jenkins
MAIL=/var/mail/jenkins
PATH=/var/lib/jenkins/.gem/ruby/2.2.1/bin:/opt/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/bin:/opt/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD=/var/lib/jenkins
LANG=en_US.UTF-8
RUBY_ENGINE=ruby
SHLVL=1
HOME=/var/lib/jenkins
GEM_ROOT=/opt/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0
LOGNAME=jenkins
GEM_PATH=/var/lib/jenkins/.gem/ruby/2.2.1:/opt/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0
RUBY_ROOT=/opt/rubies/ruby-2.2.1
XDG_RUNTIME_DIR=/run/user/1001
RUBYOPT=
RUBY_VERSION=2.2.1
_=/usr/bin/env
Did you make sure bundler was installed when using ruby-2.2.1? I'm also curious how ruby-1.9.3 is being loaded for the debug script?
I faced this issue today and I think I know the what is causing this.
gem install bundler
under ruby 1.9.3 installs bundler into ~/.gem/ruby/1.9.1/bin
. Where as chruby adds ~/.gem/ruby/1.9.3/bin
to the PATH environment variable.
Also under ruby 1.9.3 ruby -e 'puts Gem.user_dir'
prints ~/.gem/ruby/1.9.1
. I don't know how chruby does this, but I think Gem.user_dir
must be checked before adding into the PATH.
@nikhildamle could you post the output of gem env
?
@jlove4m keep in mind that the bug_report.sh
script runs in a sub-shell. It could be activating a .ruby-version
or a chruby 1.9
in .bashrc
could be overriding the current ruby.
@postmodern Here is the output
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23.2
- RUBY VERSION: 1.9.3 (2014-11-13 patchlevel 551) [x86_64-darwin14.4.0]
- INSTALLATION DIRECTORY: /Users/nikhil/.gem/ruby/1.9.3
- RUBY EXECUTABLE: /Users/nikhil/.rubies/ruby-1.9.3-p551/bin/ruby
- EXECUTABLE DIRECTORY: /Users/nikhil/.gem/ruby/1.9.3/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/nikhil/.gem/ruby/1.9.3
- /Users/nikhil/.rubies/ruby-1.9.3-p551/lib/ruby/gems/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--user-install"
- REMOTE SOURCES:
- http://rubygems.org/
@nikhildamle ok so chruby is correctly setting GEM_HOME
to .gem/ruby/1.9.3
. What is the output of which bundle
and head -n 1 $(which bundle)
?
@postmodern which bundle
prints bundle not found
and head -n 1 "$(which bundle)"
prints head: bundle not found: No such file or directory
Before chruby I had used system ruby (ruby 2.0.0) that came with the OS and had gem: --user-install
set in my ~/.gemrc
to install gems without sudo. Today, with ruby 2.2.2 I noticed gem install
warning EXECUTABLE DIRECTORY
not in the PATH environment variable. Removing --user-install
from ~/.gemrc
and running gem install
again did not produce any warning and resolved this issue with both ruby-1.9.3
and ruby-2.2.2
when i tried.
I think what happening is with --user-install
, gem install
ignores GEM_HOME
set by chruby and instead install gems in value returned by Gem.user_dir
and executables in "#(Gem.user_dir}/bin"
(Gem.user_dir returns ~/.gem/ruby/1.9.1
for ruby-1.9.3
and ~/.gem/ruby/2.2.0
for ruby-2.2.2
in my computer). But chruby only adds $GEM_HOME/bin
to the PATH.
@nikhildamle yep, chruby uses different gem dirs per-ruby. Since the gem dirs are located in ~/.gem/
, --user-install
is redundant. Simply remove --user-install
and gem install bundler
.
@postmodern - Yes. Have removed --user-install
. No issues since. 👍
Going to close this since it appears resolved now.
Hello!
We're using chruby and ruby install. Installing to /opt/rubies.
I have two versions of ruby installed on this system:
However, when I run 'bundle install' from a directory, I get the following:
I've made sure to install rubies and gems like so:
This always worked for us in the past, but not sure why we're having this issue on this new box. Ubuntu 14.04 Server.
The jenkins user does not have a .gemrc file, there isnt an /etc/gemrc file.
I do have chruby.sh linked in /etc/profile.d though.
Any ideas?