Skip to content
Advertisement

Can’t resolve rubygems.org (too many redirects)

For some reason my vagrant VM cannot resolve rubygems.org. It was working fine yesterday, today I made no changes and now it no longer works:

Fresh Ubuntu install

vagrant -v # 1.5.3
vagrant init hashicorp/precise64 # ubuntu
vagrant up
vagrant ssh

Installing ruby gems (fails)

sudo apt-get update
sudo apt-get install rubygems -y

# here comes the failure...
sudo gem install librarian-puppet

"ERROR:  Could not find a valid gem 'librarian-puppet' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
too many redirects (http://www1.dlinksearch.com/?..."

Can’t resolve rubygems.org

wget rubygems.org 

"Resolving rubygems.org (rubygems.org)... ::ffff:67.215.65.145, 54.245.255.174
Connecting to rubygems.org (rubygems.org)|::ffff:67.215.65.145|:80... connected.
HTTP request sent, awaiting response... 303 See Other
Location: http://www1.dlinksearch.com/?url=rubygems%2Eorg [following]
--2014-04-23 02:28:15--  http://www1.dlinksearch.com/?url=rubygems%2Eorg
Resolving www1.dlinksearch.com (www1.dlinksearch.com)... ::ffff:67.215.65.145, 
20 redirections exceeded."

Other websites seem fine

wget google.com
Resolving google.com (google.com)... 173.194.126.8, 173.194.126.14, 173.194.126.2, ...
HTTP request sent, awaiting response... 200 OK
2014-04-23 02:36:57 (651 KB/s) - `index.html.2' saved [13872]

I can resolve by IP address

wget 54.245.255.174 
--2014-04-23 02:44:59--  http://rubygems.org/
Resolving rubygems.org (rubygems.org)... ::ffff:67.215.65.145, 54.245.255.174
HTTP request sent, awaiting response... 200 OK

More Info

gem env 
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  ...
  - REMOTE SOURCES:
    - http://rubygems.org/

It was working

  • This was working fine yesterday night!
  • The VM /etc/hosts seems fine
  • I can access rubygems.org from my desktop browser without any issues
  • Already tried destroying and creating a new vm
  • Tried restarting my computer

Advertisement

Answer

So from the comments, apparently there is a DNS caching issue, where “::ffff:67.215.65.145” was coming back as a valid address for rubygems. “54.245.255.174” is a valid address, as dig @8.8.8.8 ANY rubygems.org would reveal.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement