23
$ rvm use
Using /home/owner/.rvm/gems/ruby-2.1.2
$ gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 80 (http://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/thread_safe-0.3.4.gemspec.rz)
$ gem update --system
...
$ gem -v
2.4.1
$ gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 80 (http://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/rails-4.1.5.gemspec.rz)

I have attempted:

  1. Installing other gems (devise, activerecord). I get the same error.
  2. Reinstalling RVM
  3. Running gem update --system
  4. Setting static DNS to google's 8.8.8.8 and 8.8.4.4
  5. Adding https://production.cf.rubygems.org as a gem source (see below for error)
  6. Installing 14.04 over my previous 12.04. Error persists. The source of the error must be outside my computer.

Additional information about my connection:

  1. I can connect to https://rubygems.org/ through my browser
  2. My modem's firewall is completely disabled.
  3. $ curl -v --head https://rubygems.org output: http://pastebin.com/ca6DAvaU

My /etc/resolv.conf

$ cat /etc/resolv.co
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 75.75.75.75
search home.network

Add direct gem source

Ref: https://stackoverflow.com/a/19299266/3993020

owner@owner-Z87X-UD3H:~$ gem sources --add https://production.cf.rubygems.org
Error fetching https://production.cf.rubygems.org:
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443 (https://your-dns-needs-immediate-attention.network/specs.4.8.gz)

Additional debug information for gem install rails

owner@owner-Z87X-UD3H:~$ gem install rails --debug -V
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/resolv.rb:169 - LoadError
HEAD https://api.rubygems.org/api/v1/dependencies
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=rails
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
200 OK
Exception `Resolv::DNS::Config::NXDomain' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/resolv.rb:547 - _rubygems._tcp.api.rubygems.org
Exception `Errno::ECONNREFUSED' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/http.rb:879 - Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443
Exception `Gem::RemoteFetcher::FetchError' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/remote_fetcher.rb:286 - Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443 (https://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/rails-4.1.5.gemspec.rz)
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443 (https://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/rails-4.1.5.gemspec.rz)
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/remote_fetcher.rb:286:in `rescue in fetch_path'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/remote_fetcher.rb:259:in `fetch_path'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/source.rb:146:in `fetch_spec'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/resolver/api_specification.rb:76:in `spec'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/resolver/installer_set.rb:77:in `add_always_install'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/dependency_installer.rb:461:in `resolve_dependencies'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:238:in `install_gem'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:299:in `block in install_gems'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:295:in `each'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:295:in `install_gems'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:202:in `execute'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/command.rb:307:in `invoke_with_build_args'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/command_manager.rb:168:in `process_args'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/command_manager.rb:138:in `run'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:54:in `run'
    /home/owner/.rvm/rubies/ruby-2.1.2/bin/gem:21:in `<main>'
Community
  • 1
  • 1
tmtmtmtmt
  • 225
  • 1
  • 2
  • 5
  • I should mention I'm able to browse the internet flawlessly. This question was posted from the same computer that generated the DNS error. – tmtmtmtmt Aug 30 '14 at 15:27
  • 1
    Wondering that where `"your-dns-needs-immediate-attention.network"` message coming from. Post your Gemfile – RAJ Aug 30 '14 at 15:33
  • there is no role of gemfile in installing rvm,ruby,rails – Rahul Singh Aug 30 '14 at 15:36
  • I just got this error too. Here I tried installing the Treat gem. – DiegoSalazar Aug 30 '14 at 19:37
  • 1
    I just got "your-dns-needs-immediate-attention.network" and when I googled it, it lead me here. The big difference? I got it from Outlook which was asking me if I wanted to get redirected there to get new settings. Never seen it before. – Jonathan Martin Aug 30 '14 at 23:10
  • Can you provide more details of your connection? is your browser capable of accessing https://rubygems.org? Is your system running behind a transparent proxy or some proxy firewall? – Luis Lavena Aug 31 '14 at 01:25
  • @LuisLavena I have updated my post to include the information you requested. How would I know if I'm behind a transparent proxy, or a proxy firewall? – tmtmtmtmt Aug 31 '14 at 16:40
  • @tmtmtmtmt can you run a `curl -v --head https://rubygems.org` and tell us how it resolves the IP/configuration? – Luis Lavena Aug 31 '14 at 17:32
  • @LuisLavena My output for running `curl -v --head https://rubygems.org`: http://pastebin.com/ca6DAvaU – tmtmtmtmt Aug 31 '14 at 18:15
  • I was able to run `gem install rails` successfully after swapping out my Comcast modem for another. Any advice on further debugging to determine what the difference between the two is? – tmtmtmtmt Sep 01 '14 at 04:44
  • The your-dns-needs-immediate-attention message is from the ICANN. See https://icann.org/namec ollision and https://www.icann.org/en/system/files/files/name-collision-mitigation-01aug14-en.pdf page 21 – Nope Dec 29 '14 at 10:59

14 Answers14

30

Like blasio pointed out. It seems like the Xfinity modems are setting up the search domain to home.network and this is messing things up for the reasons he mentioned (essentially, home.network is now a valid domain name that the modems are trying to contact before making a connection).

I had the same problem and the modification on resolv.conf seem to do the trick, and that should probably be an accepted solution for linux environments. I had this problem while attempting this on a virtual machine running ubuntu, and my host(OSX Mavericks) was passing down the search home.network like the modem is, so I wanted to see if I could find a solution that could be done at the host OS level because the same problem happened when I attempted gem install rails on my OSX terminal.

If you go to the OSX network settings, under DNS you'll see the home.network line under the Search Domains area. After some googling it seems that comcast recently changed this from http://hds1.ma.comcast.net'. I changed it back, restarted and gave gem install rails another shot, which worked with no problem.

Strange issue but this is a better solution that swapping modems or changing gem sources.

jalvarado91
  • 408
  • 3
  • 7
  • What, exactly, did you change, where? The home.network search domain is greyed out in the DNS tab in Network Preferences, which means it's coming from somewhere else, right? – tamouse Sep 06 '14 at 20:39
  • Thanks, after going wild trying all crazy different stuff this helped. – fcastellanos Sep 07 '14 at 02:10
  • 1
    @tamouse, this is coming from your modem. You're essentially adding something down the hierarchy. So on the DNS tab, where you see home.network, you should see a plus sign to add a new search domain. Inter `http://hds1.ma.comcast.net` there and you should be good to go. – jalvarado91 Sep 08 '14 at 21:03
  • 4
    Thanks, @jalvarado91. I actually added home.local, which is what it used to be at some point, and that works, for me. I don't think an `http://` URL is going to work in that field, though. DNS isn't using port 80 to search, as far as I know. – tamouse Sep 10 '14 at 00:45
  • This fixed it! Thank you for saving me hours of my life. – Dustin Falgout Sep 13 '14 at 23:22
  • This solves the problem and also occurs when I'm behind a Comcast network. From my testing, it seems like both `http://hds1.ma.comcast.net` and `hds1.ma.comcast.net` work when added to the search domains section under **DNS**, in the _Network_ preference pane. – mikeho Oct 07 '14 at 22:32
  • This fixed it! What a strange combination of things going wrong. – Dustin Oct 28 '14 at 17:38
  • Thanks that helped. For OSX I had to reconnect to the network to apply the search domain change. – Albert Schulz Mar 20 '17 at 08:56
7

I had the same issue with Comcast xFinity and Compass.

Update for Windows 7 users:

Go to Control Panel > Network and Sharing Center
Under "Active Networks" select "Connections: Local Area Connections"
In the "Local Area Connection Status" dialogue box, click on "Properties"
Double click the IPv4 item
In the "Internet Proptocol Verion 4" icon or click the "Properties" button, then click "Advanced"
In the DNS tab, just above the 2nd input box, click the "Append These DNS suffixes (in order)" radio button,
    then click "Add", enter "home.lan", then click OK until the dialogue closes.

    Many thanks to John Smith for the Vista fix and Somnambulent for Win 8.1 fix.
Bob Rast
  • 105
  • 6
5

Your DNS error seems to be related to .network becoming a TLD and your resolv.conf missing the ndots configuration. I just run into this issue with .prod.

Unless you have your own DNS server at home for internal .network domain, removing the search home.network from /etc/resolv.conf should fix the issue.

Since your /etc/resolv.conf is generated by resolveconf as it says in your resolv.conf, you might want to remove the home.network from your configuration, see here for example

Community
  • 1
  • 1
blasio
  • 1,154
  • 8
  • 5
4

I just want to say thank you to you all. Since I'm new here. I cannot add a comment even vote up. So I can only come to the answer part.

I got a problem as follow when I tried to install cocoapods:

➜  ~  gem install cocoapods
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ETIMEDOUT: Operation timed out - connect(2) for "your-dns-needs-immediate-attention.network" port 443 (https://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/cocoapods-0.33.1.gemspec.rz)`enter code here`

Adding home.local into the DNS Search Domains fixes it.

Thanks again! I admire your spirit!!!

Roden Luo
  • 366
  • 2
  • 11
  • Are you saying that adding `home.local` is actually a viable solution to the question? Otherwise this should be closed as "Not An Answer". – DanM7 Sep 14 '14 at 02:45
  • 1
    Yes, adding home.local is a viable solution to the question! – Roden Luo Sep 15 '14 at 03:01
3

I'm using RVM (1.25.29), Ubuntu 14.04 and ruby 2.0.0. This was a fresh RVM and ruby 2.0 installation.

In my case I was trying to install OpenShift Online's command-line tool: rhc with "gem install rhc".

I finally fixed it by using bundle install and a Gemfile. I'm not sure why but bundle was able to get the gems via https to rubygems.org, but "gem install" could not.

Try creating a Gemfile with your gem in it as a temporary fix to get the gem installed.

Gemfile:

source 'https://rubygems.org'

# have bundle handle the gem install via https
gem 'rails'

Then run:

 bundle install

The only way I was able to get it to work using "gem install" was to use:

gem install --source http://rubygems.org

But that's unsafe and NOT recommended.

I haven't been able to determine why bundle can install via https, but gem can't. I'm relatively new to ruby and rvm.

The bundler gem came with the rvm installation, but rubygems came with ruby2.0.0-p481. At first and because of the error I thought it had something to do with openssl, but after a lot of trial and error it seems to be related to missing, dependent gems.

After the gem was installed via bundle, I was able to uninstall it and then re-install via "gem install". I noticed that "bundle install" installed some missing network and ssl-related gems before installing "rhc".

Without knowing a whole lot about how bundle and gem install work I'm thinking that the bundler gem had "everything" it needed to go out via https while rubygems (which came with the ruby 2.0 install) didn't. And that would explain why after the bundle install, gem install worked.

I hope this works for anyone else that's encountered this. If not, at least it's one more thing to try ;-).

lauracw100
  • 93
  • 1
  • 6
3

I'm using openSUSE 13.1 OS for my rails development. Suddenly I got the same issue and reported to the SUSE mailing list. And then got an very good explanation about the problem here.

Background: the tld ".site" is offically registered and thus no longer available for private use.

ToDo: Change your private tld, to something NOT registered.

Gotchas: ".local" is reserved for mDNS / ZeroConf / Bonjour / Rendezvous. Do NOT use it for DNS / DHCP !

Examples: ".box", ".lan" : both are suggested by some Internet-Connect-Routers (DSL/Cable/Fibre) ".lnet", ".your-name-here" (.ArupRakshit for you) : possible, worth to try.

HTH, Yamaban.

I followed his instrutions here

For future reader goto YAST -> Netwrok devices -> Network Settings -> Hostname/DNS -> Domain Name (and here put your name).

[arup@Rails]$ gem install rails --no-ri --no-rdoc
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2 


Fetching: i18n-0.7.0.gem (100%) 
........
........
[arup@Rails]$ rails -v
Rails 4.2.0

Now all is set. :)

Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
2

New top level domains - .prod, .network are real domains not be be used as internal placeholder - https://icann.org/namecollision

1

For me "your-dns-needs-immediate-attention", actually meant "your gem sources are not valid".

gem source --list

Check the output. If the current list isn't valid, then you can simply

gem source -a https://rubygems.org

...or whatever other sources are appropriate. Then use the -r flag to remove the invalid sources.

Gerry
  • 10,584
  • 4
  • 41
  • 49
0

it appears comcast recently appended home.network to customers DNS search path

I resolved this issue by completing the following steps on Windows Vista:

control panel -> network and sharing center -> manage network connections -> wireless properties -> ip4 properties -> advanced -> dns tab -> select append these dns suffices in order and added home.lan.

now gem install runs without a hitch

John Smith
  • 27
  • 5
0

FWIW, if anyone's encountering this in Windows, here's how I fixed it (in 8.1).

  1. Go to Control Panel\Network and Internet\Network and Sharing Center
  2. Click into your network adaptor's status, and from there into its properties
  3. Double click the IPv4 item
  4. In the IPv4 Properties, click Advanced...
  5. In the DNS tab, look for the 'home.network' suffix, and remove it.
  6. Hit OK a bunch of times :)

Now you should be good to go!

0

For me downloading and reinstalling gem from this page: https://rubygems.org/pages/download solved the Errno::ECONNREFUSED problem.

Lut Ze
  • 123
  • 2
  • 10
0

If you work on a Mac system, you can try to

sudo vi /etc/resolv.conf

by edit search statement with appending .local to a word.

EX:

# This file is automatically generated.
#
search network.local

NOTE: Above network is the domain for this case. You can use any word.

allen
  • 356
  • 5
  • 8
0

I had the same problem when trying to install premailer and upgrading ruby to current stable version (2.3.0) fixed the issue.

with rvm:

rvm install 2.3.0

rvm use 2.3.0

gem install premailer 

of course, this applies to any gem, not just premailer

dnshio
  • 914
  • 1
  • 8
  • 21
-3

Replace the modem Comcast provided with another (Motorola Surfboard SB6141 in this case).

This is an unsatisfying solution, but a solution nonetheless.

tmtmtmtmt
  • 225
  • 1
  • 2
  • 5