Cannot install Ruby Gems (Ubuntu 15.04) - "Network is unreachable" - ruby

I'm trying to install Jekyll on a fresh Vultr VPS running Ubuntu 15.04. I have installed Apache2 manually for the time being (I intend to scrap it for NodeJS later).
I am trying to install Jekyll however it is giving me the following error:
********#************:~$ gem install jekyll
ERROR: While executing gem ... (Errno::ENETUNREACH)
Network is unreachable - sendto(2) for "2001:19f0:300:1704::6" port 53
********#************:~$ gem update --system
ERROR: While executing gem ... (Errno::ENETUNREACH)
Network is unreachable - sendto(2) for "2001:19f0:300:1704::6" port 53
I have the latest version of ruby installed (as shown below), I've noticed in some other forums that I might have to install (downgrade) to ruby1.9.1-dev?
********#************:~$ ruby -v
ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu]
I am not sure what is happening, and I have searched and searched.
Could anyone please shed some light on my situation?

The "2001:19f0:300:1704::6" is ipv6 address of vultr vps's DNS server. You can add ipv6 address in the console of server management, restart the server.

It seems to be some sort of issue with name resolution in Vultr's setup. As a temporary fix, try opening /etc/resolv.conf and putting the IPv6 nameserver IP underneath the IPv4 nameserver IP.
I'm seeking the wisdom Vultr forums and will hopefully update this answer with a more permanent fix if I get any good answers.

Related

How to install vagrant plugin on Windows 7 without internet connection?

I'm trying to install vagrant-hostmanager plugin on Windows 7 without internet connection.
I have downloaded gem file from rubygems.org and copied to this machine to D:\distr\Vagrant.
Then I move to this folder and run in Command Prompt with Ruby (with Administrator privilegies):
vagrant plugin install vagrant-hostmanager --entry-point vagrant-hostmanager-1.8.6.gem
And get the following error:
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
Vagrant failed to load a configured plugin source. This can be caused
by a variety of issues including: transient connectivity issues, proxy
filtering rejecting access to a configured plugin source, or a configured
plugin source not responding correctly. Please review the error message
below to help resolve the issue:
Errno::ECONNREFUSED: No connection could be made because the target machine ac
tively refused it. - connect(2) for "api.rubygems.org" port 443 (https://api.rub
ygems.org/specs.4.8.gz)
Source: https://rubygems.org/
I put specs.4.8.gz to his folder too but it didn't help. I also put specs.4.8 to SPEC CACHE DIRECTORY and gem file to GEM PATHS defined in gem environment. It also didn't help.
Versions:
Windows Enterprise Service Pack 1 (32 bit)
vagrant_1.9.5.msi
VirtualBox-5.1.22-115126-Win.exe
rubygems 2.5.2
rubyinstaller 2.3.3 (2016-11-21 patchlevel 222) [i386-mingw32]
I also tried with another versions of vagrant and gem: vagrant_1.8.4.msi and vagrant-hostmanager-1.8.5.gem. Result is the same.
Is it possible to install vagrant plugin offline?
Thanks!

Error on installing Pod

Recently I have needed to install pod file. I have tried by
$ sudo gem install cocoapods
but after several seconds after entering password, I got bellow error:
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from http://rubygems.org/ - Errno::EHOSTUNREACH: No route to host - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
I searched this error, I found some questions similar, such as Stack question but none of solution resolved my problem. If there is any other way to try, please let me know.
I fixed this problem by changing my network to guest network. My main network has proxy authentication that prevented me from downloading the ruby from repo.
Steps to follow:
1.Switch to a different network
2. In terminal"sudo gem install cocoapods"
3.Close and restart terminal
4. Do "pod install"
The problem is fixed. The only change I have made on my system is installing the last stable version of node. Because I am not expert I can not explain how it solved.

failed to install vagrant-cachier plugin on windows

I am new to vagrant.
I have installed virtualbox and vagrant(1.7.4) and then follow the book type
$> vagrant plugin install vagrant-cachier
After some minutes,it reported an error:
> vagrant plugin install vagrant-cachier
Installing the 'vagrant-cachier' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing childprocess (0.5.7), and Bundler cannot continue.
Make sure that `gem install childprocess -v '0.5.7'` succeeds before bundling.
Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.Gem::RemoteFetcher::FetchError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A (https://rubygems.org/gems/childprocess-0.5.7.gem)
I know little about ruby and gem.Is there anything else need to be installed before install plugins?
Or maybe the network issue? (I tried at home and office,the same error)
vagrant works fine that I can init, up and ssh normally.
I ran into the same issue finding it is a matter of gems folder misconfiguration.
I solved it with the following steps:
check where are your gems inside your vagrant installation (e.g. %vagrant_home%/embedded/gems/gems)
check your gem configuration with the command gem environment and looking for the section named GEM PATHS (if gem is not in you path look for it under the vagrant installation folder, e.g. %vagrant_home%/embedded/bin)
if the path at point 1 is not present within the section at point 2, include it with the command export GEM_HOME=/path/to/gems/folder (e.g. export GEM_HOME=%vagrant_home%/embedded/gems/gems)
P.S. %vagrant_home% refers to the vagrant installation base folder, use set instead of export under windows ...and sorry if I mixed unix and windows syntaxes
Test Environment: Vagrant 1.8.1 (gem 2.4.5.1) on Windows 7 behind web proxy
I installed this plugin https://github.com/winnfsd/vagrant-winnfsd and now Vagrant Cachier works like a charm on Windows 10.
To run it on Ubuntu simply install the nfs-server
https://stackoverflow.com/a/52361432/1679541

Timeout when installing ruby gems

I'm trying to install the bundler gem using $ gem install bundler. When I execute the command, I receive the following response:
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/latest_specs.4.8.gz)
ERROR: Possible alternatives: bundler
In an effort to make sure I wasn't going crazy, I tried installing nokogiri:
ERROR: Could not find a valid gem 'nokogiri' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/latest_specs.4.8.gz)
ERROR: Possible alternatives: nokogiri
And a2z:
ERROR: Could not find a valid gem 'a2z' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/quick/Marshal.4.8/a2z-0.1.3.gemspec.rz)
If anyone has experience this issue before and can help me out it would be greatly appreciated.
If it helps, I'm running MacOS Mavericks and have gem version 2.2.2.
Too Late but i resolve this issue disabling the IPv6 connections in my system OS.
It forces the OS just use the IPv4 and then it works.
In your Gemfile set your
source 'http://production.s3.rubygems.org'
This may not be an official answer, but it worked for me after three frustrating days trying to access rubygems.org.
For people using Windows, the following worked for me on Windows 10. See also my reply on the ruby gems issues list.
Go to Control Panel > Network and Internet > Network connections
Select the network connection you're currently using
Right click on it and choose Properties
Remove check mark for Internet Protocol version 6 (TCP/IPv6)
Click OK
Run your gem command again
i had the same issue which i solved by disabling my VPN. try looking at proxies, VPNs, and other networking issues.
api.rubygems.org is having issues with IPV6 host address. I faced the same issue after I setup the ubuntu server in vbox. We need to configure it to use our host's IPV4 first and then try IPV6.
So we can change the priority by adding this line ti /etc/gai.conf:
# Debian defaults.
precedence ::1/128 50
precedence ::/0 40
precedence 2002::/16 30
precedence ::/96 20
precedence ::ffff:0:0/96 10
# Low precedence for api.rubygems.org IPv6 addresses.
precedence 2a04:4e42::0/32 5
And it worked like a charm!
ping rubygems.org and get the IP address.
Edit your /etc/hosts file and add the line: <IPADD> rubygems.org.
gem update --system.
For the people using macOS, the following worked me on macOS 12.3.1.
Go to System Preferences > Network
Click on the Advanced... button
Go to TCP/IP tab on the top
Change Configure IPv6 from Automatically to Manually
Click on the OK
Click on the Apply
Re-try installing your gems
Revert the changes back
just add --source http://rubygems.org to your installs. The issue most likely is with your internet connection.
In my case helped the following:
sudo gem update --system
Disable ipv6
sudo gem update --system
gem install bundler
I encountered this just now. I needed to disable IPv6. I had to set mine to link-local only to get it to work. Otherwise, it's the same as #chootti's list:
Go to System Preferences > Network
Click on the Advanced... button
Go to TCP/IP tab on the top
Change Configure IPv6 from Automatically to Link-local only
Click on OK
Then I ran sudo gem update --system to update RubyGems. I still couldn't install gems with IPv6 enabled, so it looks like that needs to be off to install from RubyGems.
Machine this worked on:
OS: MacOS Monterey 12.4
Machine: Apple M1 (2020)
Ruby install manager: ASDF
dig api.rubygems.org +short
Adding below line to /etc/hosts worked for me.
151.101.192.70 rubygems.org
I ran into the same issue. Try running:
bundle pristine

gem install XYZ locally (without connection to the internet)

I need to install win32-api and antlr3 on a computer without internet connection. Had it such a connection, I'd use gem like so:
gem install win32-api -r
gem install antlr3 -r
This won't obviously work. So, I thought there should be a way to download the gem and install it later, but I am not sure how I would proceed.
I found gem's which operator, which seemd to indicate the local location of a gem:
c:\>gem which antlr3
c:/tools/Ruby187/lib/ruby/gems/1.8/gems/antlr3-1.8.8/lib/antlr3.rb
however, it didn't work on win32-api:
c:\>gem which win32-api
ERROR: Can't find ruby library file or shared library win32-api
although I have previously installed it.
Can someone hint at the right direction to go on from here?
Try,
gem install --local path/to/file.gem
I had some problems with this on a VM. The VM intentionally did not have Internet access (sneaker-net test machine) but it still had some DNS servers configured.
For example:
$ gem install bundler-1.7.7.gem --local
ERROR: While executing gem ... (Errno::ENETUNREACH)
Network is unreachable - sendto(2) for "192.168.1.10" port 53
192.168.1.10 is the DNS server that VirtualBox configured. So what I had to do is comment out /etc/resolv.conf with ; at the beginning of all the lines. Even leaving in Google DNS would break it.
; /etc/resolv.conf
nameserver 8.8.8.8 ; nope. gem install --local doesn't like it
; You will get a Network is unreachable - sendto(2) for "8.8.8.8" port 53
If you comment out all of /etc/resolv.conf then you can install gems locally (from a file) it seems.
$ gem install bundler-1.7.7.gem --local
Successfully installed bundler-1.7.7
Parsing documentation for bundler-1.7.7
Installing ri documentation for bundler-1.7.7
Done installing documentation for bundler after 4 seconds
WARNING: Unable to pull data from 'https://rubygems.org/': no such name (https://rubygems.org/specs.4.8.gz)
1 gem installed
Ruby gems version: 2.4.4 on Ruby 2.1.5.
gem will first look in the current directory after .gem files. Try downloading the .gem files of the gems you want to install on a computer with an internet connection (and don't forget dependencies), then move the files over to the other computer and run gem install xyz in the same directory where you placed the .gem files.

Resources