2

I am on RHEL 6, and have built Ruby from source and installed into /usr/local.

The server I am on does not have outside internet access, EXCEPT to access Rubygems.org. That is the only outside connection it is permitted to make. This is a corporate security restriction and there is nothing I can do, so please don't say 'use rvm'. I would if I could...

I need to run bundle install as a certain user, ciwasadm. But when I do, the terminal just hangs. When I run bundle install or gem install whatever as my username, wannia1, I am able to connect to Rubygems.org and get wahtever I need.

For some reason, the hanging only occurs when I am sudo'ed into ciwasadm. The Ruby installation for both users is working and I can run ruby files in the command line. I just don't understand why bundler is any different.

Running gem env for ciwasadm returns:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /home/ciwasadm/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.0.0
     - /home/ciwasadm/.gem/ruby/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /sbin
     - /bin
     - /usr/sbin
     - /usr/bin
     - /opt/groovy-1.8.3/bin

Running gem env for wannia returns:

 RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /home/wannia1/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.0.0
     - /home/wannia1/.gem/ruby/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/lib64/qt-3.3/bin
     - /usr/local/bin
     - /bin
     - /usr/bin
     - /usr/local/sbin
     - /usr/sbin
     - /sbin
     - /opt/groovy-1.8.3/bin
     - /home/wannia1/bin
  • You said you don't understand why bundler is different. Well, the bundler gem has a fair bit of code in it that runs when you do `bundle install`, and there might be something in there causing it to hang. My first idea would be to edit the source files of the bundler gem on your machine and add `puts` statements so you can see some kind of useful debugging output when you run `bundle install`. If you do this methodically, you can find the exact line where the code is hanging. You could also try running `strace bundle install`. – David Grayson Jul 09 '15 at 20:29
  • Try adding the `--verbose` option to bundler to get a more detailed output of what is happening. Maybe this will provide more clues? Another thing I would look at is what happens when curling rubygems.org when sudo'd as ciwasadm. Are you able to curl the url as both users? Maybe the method of white-listing rubygems.org is somehow tied to a specific user or group? Another random thing to check is your loading ruby from when sudo'd by typing which ruby and comparing it to the other user. Maybe your getting a different version of ruby? –  Jul 12 '15 at 05:31

1 Answers1

2

I'll post my solution here with the hopes that it helps someone else in the future.

Bundler was hanging because it could not reach the rubygems.org server. This is because a proxy was required, but had not been set.

I was able to run export http_proxy=<insert proxy info here> in my bash shell, and then was able to dial out.