Gem gem sources 加不上 taobao.org

449241025 · 2015年04月12日 · 最后由 canjianx 回复于 2015年04月22日 · 6581 次阅读

这是什么情况,怎么哪个也不行了,网上搜只是说 rubygems.org 可能被什么,怎么 taobao.org 也不行啊

hao@linux-qtew:~> gem sources -a https://ruby.taobao.org
Error fetching https://ruby.taobao.org:
        Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.site" port 443 (https://your-dns-needs-immediate-attention.site/specs.4.8.gz)
hao@linux-qtew:~> gem sources -a http://ruby.taobao.org
Error fetching http://ruby.taobao.org:
        Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.site" port 80 (http://your-dns-needs-immediate-attention.site/specs.4.8.gz)
hao@linux-qtew:~> gem sources -a https://rubygems.org/
Error fetching https://rubygems.org/:
        Errno::ETIMEDOUT: Connection timed out - connect(2) for "s3.amazonaws.com" port 443 (https://api.rubygems.org/specs.4.8.gz)

下面是 debug 信息,大神帮忙看看是什么情况

hao@linux-qtew:~> gem sources -a https://ruby.taobao.org --debug -V
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /home/hao/.rvm/rubies/ruby-2.2.1/lib64/ruby/2.2.0/resolv.rb:168 - LoadError
Exception `Resolv::DNS::Config::NXDomain' at /home/hao/.rvm/rubies/ruby-2.2.1/lib64/ruby/2.2.0/resolv.rb:546 - _rubygems._tcp.ruby.taobao.org
Exception `Errno::EEXIST' at /home/hao/.rvm/rubies/ruby-2.2.1/lib64/ruby/2.2.0/fileutils.rb:252 - File exists @ dir_s_mkdir - /home/hao/.gem/specs/your-dns-needs-immediate-attention.site%443
Exception `Errno::ENOENT' at /home/hao/.rvm/rubies/ruby-2.2.1/lib64/ruby/site_ruby/2.2.0/rubygems/remote_fetcher.rb:300 - No such file or directory @ rb_file_s_stat - /home/hao/.gem/specs/your-dns-needs-immediate-attention.site%443/specs.4.8
Exception `Errno::ECONNREFUSED' at /home/hao/.rvm/rubies/ruby-2.2.1/lib64/ruby/2.2.0/net/http.rb:879 - Connection refused - connect(2) for "your-dns-needs-immediate-attention.site" port 443
Exception `Gem::RemoteFetcher::FetchError' at /home/hao/.rvm/rubies/ruby-2.2.1/lib64/ruby/site_ruby/2.2.0/rubygems/remote_fetcher.rb:286 - Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.site" port 443 (https://your-dns-needs-immediate-attention.site/specs.4.8.gz)
Error fetching https://ruby.taobao.org:
        Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.site" port 443 (https://your-dns-needs-immediate-attention.site/specs.4.8.gz)

已解决,我用的系统是 opensuse13.2 的,它自动成的主机名是带 site 域名的

hao@linux-qtew:~> hostname
linux-qtew.site

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. 修改:goto YAST -> Netwrok devices -> Network Settings -> Hostname/DNS -> Domain Name (and here put your name).

还要修改:/etc/resolve.conf,注掉 search site

hao@linux-qtew:~> cat /etc/resolv.conf
### Please remove (at least) this line when you modify the file!
#search site
nameserver 223.5.5.5
nameserver 223.6.6.6

你网络有大大的问题

提示信息里面有 your-dns-needs-immediate-attention.site,说明你的 DNS 可能有问题,或者网络本身有问题导致无法正确收到 DNS 的结果。

检查一下路由器 DNS 有没有被劫持。 运营商是不是靠谱。 本机的 /etc/resolv.conf 文件里面有没有不正常的内容。 有没有运行会乱改 hosts 的工具。

#2 楼 @kgen

hao@linux-qtew:~> cat /etc/resolv.conf
### Please remove (at least) this line when you modify the file!
search site
#nameserver 223.5.5.5
#nameserver 223.6.6.6
nameserver 192.168.1.1
hao@linux-qtew:~> nslookup https://ruby.taobao.org      
Server:         192.168.1.1
Address:        192.168.1.1#53

Non-authoritative answer:
https://ruby.taobao.org canonical name = www.gslb.taobao.com.danuoyi.tbcache.com.
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 121.18.239.251
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 61.182.138.251
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 121.18.239.151
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 121.18.239.241

hao@linux-qtew:~> gem sources -a https://ruby.taobao.org
Error fetching https://ruby.taobao.org:
        Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.site" port 443 (https://your-dns-needs-immediate-attention.site/specs.4.8.gz)
hao@linux-qtew:~> cat /etc/resolv.conf
### Please remove (at least) this line when you modify the file!
search site
nameserver 223.5.5.5
nameserver 223.6.6.6
#nameserver 192.168.1.1
hao@linux-qtew:~> nslookup https://ruby.taobao.org
Server:         223.5.5.5
Address:        223.5.5.5#53

Non-authoritative answer:
https://ruby.taobao.org canonical name = www.gslb.taobao.com.danuoyi.tbcache.com.
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 121.18.239.151
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 61.182.138.241
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 121.18.239.141
Name:   www.gslb.taobao.com.danuoyi.tbcache.com
Address: 61.182.138.251
hao@linux-qtew:~> gem sources -a https://ruby.taobao.org
Error fetching https://ruby.taobao.org:
        Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.site" port 443 (https://your-dns-needs-immediate-attention.site/specs.4.8.gz)

是 hostname 的问题,把.site 去掉后好了。THX

需要 登录 后方可回复, 如果你还没有账号请 注册新账号