hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.28k stars 4.43k forks source link

"vagrant share --ssh" fails on Windows when scanning for open port #9036

Open cyrossignol opened 7 years ago

cyrossignol commented 7 years ago

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

tripeh commented 7 years ago

+1 same issue here!

a-r-m-i-n commented 7 years ago

+1 I can also reconstruct this issue

calmkram commented 6 years ago

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

dizid commented 6 years ago

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

bences commented 6 years ago

+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

dswersky commented 6 years ago

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

badrebelabbess commented 6 years ago

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

g-morishita commented 6 years ago

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

Foxtrod89 commented 5 years ago

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

marcusnewton commented 5 years ago

bump

this issue has been open for a long time

logicbox commented 5 years ago

another bump, having same issue...

azmuth94 commented 5 years ago

bump, same issue

nickosh commented 4 years ago

+1. Same issue.

Virtualbox 6.1.4 Vagrant 2.2.7 Vagrantbox: hashicorp/bionic64

uditrana commented 4 years ago

Same issue here. its been 3 years :octocat:

tantra35 commented 3 years ago

@briancain @chrisroberts (I saw you activity by adding/removing this issue to milestone) can you please share with community reason why this not yet solved? Source code of vagrant share addon is encoded by rubyencoder and we doesn't have any chance to resolve issue by ourself

kdavidfong commented 2 years ago

+1 Having this same issue on latest releases.

lkjimy commented 2 years ago

+1 Same error for me.

cyrossignol commented 2 years ago

Folks, open-source projects often prioritize work by sorting issues by the number of 👍 reactions on the original posts. Please 👍 the original issue to communicate your agreement and support. Developers and maintainers of large projects may not read the comments, so "+1" responses may only spam the people in this thread. Thanks!

P.S. I am not a Vagrant maintainer. Just sharing what I've seen at other projects.