I want to run a ruby script on my Raspberry Pi. I've installed ruby via rvm. I'm sure, i'm using the right version:

$ rvm current

when i run my script, then i get following:

/home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/port_prober.rb:25:in `initialize': Address family not supported by protocol - socket(2) (Errno::EAFNOSUPPORT)
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/port_prober.rb:25:in `new'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/port_prober.rb:25:in `block in free?'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/port_prober.rb:23:in `each'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/port_prober.rb:23:in `free?'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/port_prober.rb:5:in `above'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/chrome/service.rb:33:in `default_service'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/chrome/bridge.rb:14:in `initialize'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
from /home/pi/.rvm/gems/ruby-1.9.3-p194/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver.rb:65:in `for'
from ./test.rb:82:in `block in <main>'
from ./test.rb:54:in `each'
from ./test.rb:54:in `<main>'

Any ideas, what is wrong? I've tried to restart, this doesn't solve the problem...

edit: here the content of test.rb

#!/usr/bin/env ruby
# encoding: utf-8

require 'selenium-webdriver'
require 'headless'

headless = Headless.new

driver = Selenium::WebDriver.for :chrome
driver.get "http://www.google.com" 

  • Your ruby install is current. Sep 13, 2012 at 9:13
  • Please post test.rb. Sep 13, 2012 at 9:13
  • Does this help? stackoverflow.com/q/3603373/961353 Sep 13, 2012 at 9:22
  • 1
    Could you try running you script through strace, like strace -f -e socket -O /tmp/trace.txt ./test.rb and paste /tmp/trace.txt content? Sep 13, 2012 at 9:26
  • this script works on ubuntu...but not here, so i'm pretty sure, that my code is correct. Here one line output from strace: [pid 14694] socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = -1 EAFNOSUPPORT (Address family not supported by protocol). Maybe i must disable ipv6 and only use ipv4...
    – cupakob
    Sep 13, 2012 at 9:41

1 Answer 1


So...i've disabled ipv6. For that, i made changes in the files /etc/modprobe.d/ipv6.conf and /etc/hosts. They looks as follow:


# Don't load ipv6 by default
alias net-pf-10 off
alias ipv6 off

/etc/hosts       localhost
#::1            localhost ip6-localhost ip6-loopback
#fe00::0                ip6-localnet
#ff00::0                ip6-mcastprefix
#ff02::1                ip6-allnodes
#ff02::2                ip6-allrouters       raspberrypi

Now i get another exception, but this is a problem with my chromedriver (unable to connect to chromedriver (Selenium::WebDriver::Error::WebDriverError) and not with the exception above. This is easy to solve imho. Thanks a lot.

  • Your answer helped get rmate working on my pi... so I think Selenium was a victim, and the problem lies in the ip stack.
    – IAmNaN
    Aug 12, 2013 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.