can't install Rails on RVM, OS Linux Mint 17 - ruby-on-rails

I installed RVM. And then followed this guide to install Ruby 2.1.3 version d and create GEMSET. after that I tried to install Rails 4 by executing this command:
gem install rails -v 4.0 but got this error:
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.hi.link" port 443 (https://your-dns-needs-immediate-attention.hi.link/quick/Marshal.4.8/thread_safe-0.3.4.gemspec.rz)
I researched multiple similair questions but non of them could solve my issue.

First, I'd like to second the use of rbenv over rvm. Rbenv is super simple and I have never had problems with it which I cannot say about rvm. However, this looks like a dns resolution issue. In resolv.conf try setting your dns servers to googles. If that fixes it then follow this to make the changes permanent. https://askubuntu.com/questions/157154/how-do-i-include-lines-in-resolv-conf-that-wont-get-lost-on-reboot
EDIT
well since that didn't work I found this link https://github.com/rubygems/rubygems/issues/1001,
are you by any chance a comcast customer? If so, this link should help, aparently comcast recently appended some wierd domain for all search path, which would explain why youre getting this issue. I hope this helps.

Related

Ruby on Rails SSL Issue with Windows 10

I'm new to Ruby and following the course Ruby on Rails Intro on course era and on the very first chapter installing software on Windows. After installing all the required software when the instructor asks me to run 'ruby new test_install' get the following exception:
Fetching source index from https://rubygems.org/
Could not verify the SSL certificate for
https://rubygems.org/quick/Marshal.4.8/sqlite3-0.0.0.gemspec.rz.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see "bit.ly/ruby-ssl". To connect
without using SSL, edit your Gemfile sources and change 'https' to 'http'.
I should mention that I tried with gem -a sources http://rubygems.org but to no avail and I initially installed the rails 4.2.3 by giving it --source http://rubygems.org however nothing seems to work for this particular instance of command.
So far there's no fix for this that I can find. It's not limited to Win10, either. I've come across Win7 users with the same issue, so it seems to be a Rail on Windows problem.
There are also lots of Gemfiles. It's not clear which one(s) need(s) to be changed. I've tried changing couple of them with no luck.
It does look like using Linux instead of Windows is the quickest way to a solution. It might be worth giving that a try. Other than the Mac-like weirdness of the Unity interface, Ubuntu is easy to get used to and VMWare Player is free. I wouldn't bother with Virtual Box, the versions I've tried, including the latest, have been flaky.
If you do decide to try Ubuntu, you can find instructions here: https://gorails.com/setup/ubuntu/16.04
That page recommends using MySQL or Postgres. If you do use something other than SQLite (probably a good idea, in which case Postgres is probably the better option), the creation of a new rails app requires setting the database at creation:
rails new myapp --database=postgresql
for instance.
I solved the same problem with this line:
gem install bundler
Source:
I solved the problem like this:
gem source -r https://rubygems.org/
gem source -a http://rubygems.org/
gem update

passenger: Unable to autodetect the currently active RVM gem set name

Trying to run passenger-install-apache2-module which exits with error message:
Unable to autodetect the currently active RVM gem set name. This could happen if you ran this program using 'sudo' instead of 'rvmsudo'. When using RVM, you're always supposed to use 'rvmsudo' instead of 'sudo!'.
Please try rerunning this program using 'rvmsudo'. If that doesn't help, please contact this program's author for support.
I am not running it via sudo command. RVM is installed globally in /usr/local/rvm/bin/rvm. I'm on RHEL 6.
Have you tried to run the mentioned rvmsudo.
I would check first of all whether your RVM installation is valid and functional.
Activating Ruby environment with rvm did the trick.
After wrestling with this for quite some time I switched from rvm to rbenv and this completely cleared up. My theory is that my system ruby#2.4.1 was somehow being invoked by passenger instead of the ruby I wanted to use #2.4.4 and rbenv just doesn't have this issue.

"gem install rails" fails with DNS error

$ 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:
Installing other gems (devise, activerecord). I get the same error.
Reinstalling RVM
Running gem update --system
Setting static DNS to google's 8.8.8.8 and 8.8.4.4
Adding https://production.cf.rubygems.org as a gem source (see below for error)
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:
I can connect to https://rubygems.org/ through my browser
My modem's firewall is completely disabled.
$ 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>'
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.
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.
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
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!!!
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 ;-).
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. :)
New top level domains - .prod, .network are real domains not be be used as internal placeholder - https://icann.org/namecollision
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.
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
FWIW, if anyone's encountering this in Windows, here's how I fixed it (in 8.1).
Go to Control Panel\Network and Internet\Network and Sharing Center
Click into your network adaptor's status, and from there into its properties
Double click the IPv4 item
In the IPv4 Properties, click Advanced...
In the DNS tab, look for the 'home.network' suffix, and remove it.
Hit OK a bunch of times :)
Now you should be good to go!
For me downloading and reinstalling gem from this page: https://rubygems.org/pages/download solved the Errno::ECONNREFUSED problem.
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.
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
Replace the modem Comcast provided with another (Motorola Surfboard SB6141 in this case).
This is an unsatisfying solution, but a solution nonetheless.

ERROR: Could not find a valid gem 'rails' (>= 0) in any repository

I installed rvm and ruby successfully in a linux environment. When I try to install rail, that time I face following error:
$ gem install rails
/home/bathakarai/.rvm/rubies/ruby-1.9.3-p385/bin/gem:4: warning: Insecure world writable dir /home/bathakarai in PATH, mode 040777
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::EHOSTUNREACH: No route to host - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
My gem version is
1.8.25
Rvm version is "rvm 1.18.19 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]".
Please help me by letting me know why this error occurs.
You can use to install with below command
gem install rails --source http://rubygems.org
Yes, Finally I got the result. It seems like some sort of proxy problem. I set the proxy using export "$HTTP_PROXY=IPAddress which is given in browser:portnumber".
For any reference http://khylo.blogspot.in/2007/12/ruby-on-rails-headaches.html
Try running
sudo gem install rails
This may overcome the permission problem you are having
You also look to be having an internet connectivity problem based on the error message.
In my case the culprit was avast! Internet Security software on my MacBook Pro. I went to System Preferences, clicked on avast!, clicked on the lock to enable changes, and disabled the Web Shield and File System shield.
After that, I was able to install gems.
I have struggled to install rails for two days (I've been getting almost the same error message, but, without that "Insecure world ..." line). And at last I did it using the script below (provided at RailsGirls):
bash < <(curl -sL https://raw.github.com/railsgirls/installation-scripts/master/rails-install-ubuntu.sh)
I don't know why it worked. Just leaving it here with the hope that it will be helpful for some other soul as well. ;P
You should try disabling your IPV6 to install the required Gem file since the rails fetcher could not locate the source. If you are using a linux machine, you can check this link for the steps on how to disable your IPV6 https://www.linuxbabe.com/ubuntu/disable-ipv6-on-ubuntu

CTRL+C to Webbrick server ignored

In the past, I could exit my rails application launched using webbrick using CtrlC. At some point in development, this functionality broke ( CtrlC does nothing now). I'm lead to believe this was caused by changes in one of my gem dependencies, as the problem is also present when checking out a really old version of the application, using the current gemset.
My question is: how can I fix this problem, or at least find the out what is causing it?
For windows users, this was broken in more recent builds of rails (3.2+). Try using
ruby script\rails server
instead. More details here.
Try Ctrl+Break. It should work.
I had the same issue with an application. It would seem that the issue is not with the authlogic gem but with the ":git" option. My entry causing webrick & mongrel to stop responding to Ctrl+C was
gem 'globalize3', :git => 'git://github.com/refinerycms/globalize3.git'
Interesting experience (and good workaround for the next weeks):
If you are under Ubuntu and use Guake for quick terminal access, you can launch
rails s
there. Ctrl + C reproducibly works there for me and stops the server.
Hope I could help! :)
Seemed to have solved my own problem. Authlogic
gem "authlogic", :git => 'http://github.com/binarylogic/authlogic.git'
appears to be the root cause of this problem. I've opened an issue here
I have been experiencing similar issues, specifically on Ubuntu 11.04 (things were fine on 10.04). I've created another question that was more specific to my particular setup, but it sounds like there is a lot of crossover, so people might be interested in reading it as well:
Can't stop WEBrick 1.3.1 with ctrl-c on Ubuntu 11.04
I was experiencing this problem on Ubuntu 11.04, Ruby 1.9.2p290. This fixed it for me:
Remove all existing Ruby & Ruby-related packages
Install RVM
Install Ruby 1.9.3
$ rvm install 1.9.3
$ rvm use 1.9.3
Make sure it works
$ ruby -v
ruby 1.9.3dev (2011-09-23 revision 33323) [x86_64-linux]
Install all your gems, etc...
why not trap()ing signals?
http://theriyanto.wordpress.com/2006/04/05/develop-a-simple-webserver-using-webrick/

Resources