Vagrant: "vagrant share --ssh" fails on Windows when scanning for open port

Created on 6 Oct 2017  路  14Comments  路  Source: hashicorp/vagrant

Attempting to use vagrant share --ssh on Windows with a fresh installation of Vagrant throws the error described below when activate.rb cycles through ports to find an open port to listen on. Reproduced when looking into this SO question.

Vagrant version

Vagrant 2.0.0, Ruby 2.3.0, vagrant-share 1.1.9

Host operating system

Windows 7/10 (64-bit)

Guest operating system

Ubuntu 16.04.3 LTS (Homestead) in VirtualBox 5.1.28

Vagrantfile

I'm using Homestead (with a default, out-of-the-box configuration), but this appears to be an implementation problem using the Ruby runtime on Windows unrelated to Homestead's Vagrantfile.

Debug output

I'll attach the full output shortly.

Short stack trace:

==> homestead-7: Creating Vagrant Share session...
C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:61:in `connect_internal': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - user specified timeout (Errno::ETIMEDOUT)
        from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:139:in `connect'
        from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:636:in `block in tcp'
        from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:231:in `each'
        from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:231:in `foreach'
        from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:626:in `tcp'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:304:in `acquire_port'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:312:in `acquire_port'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2360:in `block in start_share'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:235:in `block in with_target_vms'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:229:in `each'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:229:in `with_target_vms'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2273:in `start_share'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2967:in `execute'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/cli.rb:42:in `execute'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/environment.rb:308:in `cli'
        from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/bin/vagrant:138:in `<main>'

Expected behavior

Create a share tunnel.

Actual behavior

C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/socket.rb:61:in `connect_internal': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - user specified timeout (Errno::ETIMEDOUT)

This error seems to bubble up from the Windows Sockets API that Ruby appears to wrap.

Vagrant begins scanning for an open port starting with 65535 and working down. It exits with the error above as soon as it finds an open port (if I bind something to 65535 and 65534, it fails on 65533).

Steps to reproduce

  1. Install ngrok, add to path
  2. vagrant up
  3. vagrant share --ssh --ssh-no-password --disable-http

References

hoswindows share

Most helpful comment

Same issue here. its been 3 years :octocat:

All 14 comments

+1 same issue here!

+1 I can also reconstruct this issue

+1 I was able to reproduce this issue with Vagrant v2.0.1 on Windows 10 Enterprise edition

+1 same issue here.
Virtualbox 5.2.4
Vagrant 2.0.1
Windows 10, 64 bit
Vagrantbox used: hashicorp/precise64

+1 same issue here:
Virtualbox 5.2.4 r119785 (Qt5.6.2)
Vagrant 2.0.1
Windows 10 Home, 64 bit
Vagrantbox used: ubuntu/xenial64

+1 same
Virtualbox 5.2.6 r120293 (Qt5.6.2)
Vagrant 2.0.1
Windows 10 Pro 64 bit
Vagrantbox: bento/ubuntu-16.04

+1 same issue here
Virtualbox 5.1.26 r117224 (Qt5.6.2)
Vagrant 2.0.2
Windows 7 Pro 64 bit
Vagrantbox: hashicorp/precise32

Has this issue been solved yet?
I've got an error similar to this issue, too.

I'm using WSL.
Virtual box 5.1.30
Vagrant 2.1.2
Ubuntu 16.04 on Windows10
Vagrantbox: ubuntu/trusty64

==> default: Creating Vagrant Share session...
/opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:61:in `connect_internal': Connection timed out - user specified timeout (Errno::ETIMEDOUT) 
        from /opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:137:in `connect' 
        from /opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:627:in `block in tcp'
        from /opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:227:in `each'
        from /opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:227:in `foreach' 
       from /opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:617:in `tcp'    
        from /home/konankun/.vagrant.d/gems/2.4.4/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:304:in `acquire_port`
        from /home/konankun/.vagrant.d/gems/2.4.4/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:312:in `acquire_port' 
        from /home/konankun/.vagrant.d/gems/2.4.4/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2360:in `block in start_share' 
        from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/plugin/v2/command.rb:238:in `block in with_target_vms'
        from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/plugin/v2/command.rb:232:in `each'
        from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/plugin/v2/command.rb:232:in `with_target_vms'
        from /home/konankun/.vagrant.d/gems/2.4.4/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2273:in `start_share'
        from /home/konankun/.vagrant.d/gems/2.4.4/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2967:in `execute'
        from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/cli.rb:54:in `execute'
        from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/environment.rb:275:in `cli'
        from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/bin/vagrant:161:in `<main>' 

image

same issue
Vagrant 2.2.0
Host: Windows 7 x64
Guest: Ubuntu 18.04 LTS
snag-0000

bump

this issue has been open for a long time

another bump, having same issue...

bump, same issue

+1. Same issue.

Virtualbox 6.1.4
Vagrant 2.2.7
Vagrantbox: hashicorp/bionic64

Same issue here. its been 3 years :octocat:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cbednarski picture cbednarski  路  3Comments

bbaassssiiee picture bbaassssiiee  路  3Comments

DreadPirateShawn picture DreadPirateShawn  路  3Comments

janw-me picture janw-me  路  3Comments

hesco picture hesco  路  3Comments