vagrant up fail in 1.9.3 on windows10

Created on 22 Mar 2017  ยท  32Comments  ยท  Source: hashicorp/vagrant

Vagrant version

1.9.3

Host operating system

windows10

Guest operating system

custom box base on ubuntu/trusty64

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "wyzccloud/gxy"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"
  config.vm.synced_folder "../", "/vagrant", owner: "www-data",group:"www-data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

Debug output

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'wyzccloud/gxy'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'wyzccloud/gxy' is up to date...
==> default: Setting the name of the VM: common_default_1490158319530_15235
==> default: Destroying VM and associated drives...
F:/tool/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in initialize': The requested address is not valid in its context. - connect(2) for "0.0.0.0" port 8080 (Errno::EADDRNOTAVAIL) from F:/tool/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:innew'
from F:/tool/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in `block in is_port_open?'
..... more

Expected behavior

vagrant up successfully

Actual behavior

vagrant up fail

Steps to reproduce

vagrant up (first up)

bug hoswindows networking

Most helpful comment

Had the same problem on Windows 7.
This problem seems to be caused by the new host_ip parameter for the port forwarding feature.
I suggest that for compatibility reason, the default host_ip parameter should be set to 127.0.0.1 instead of 0.0.0.0
I managed to make the 1.9.3 version working by rewritten all my Vagrantfile(s) and adding the host_id: "127.0.0.1" parameter for each of the "forwarded_port" network configuration.
E.g.:
config.vm.network "forwarded_port", guest: 22, host: 1022, host_ip: "127.0.0.1", id: 'ssh'

All 32 comments

Same problem here:
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in initialize': Indirizzo richiesto non valido nel proprio contesto. - connect(2) for "0.0.0.0" port 8000 (Errno::EADDRNOTAVAIL) from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in new' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in block in is_port_open?' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:88:in block in timeout' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in block in catch' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in catch' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in catch' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:103:in timeout ...'

My colleague has the same problem on Windows 8 with port 9000

C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_o
pen.rb:21:in `initialize': The requested address is not valid in its context. -
connect(2) for "0.0.0.0" port 9000 (Errno::EADDRNOTAVAIL)

Had the same problem on Windows 7.
This problem seems to be caused by the new host_ip parameter for the port forwarding feature.
I suggest that for compatibility reason, the default host_ip parameter should be set to 127.0.0.1 instead of 0.0.0.0
I managed to make the 1.9.3 version working by rewritten all my Vagrantfile(s) and adding the host_id: "127.0.0.1" parameter for each of the "forwarded_port" network configuration.
E.g.:
config.vm.network "forwarded_port", guest: 22, host: 1022, host_ip: "127.0.0.1", id: 'ssh'

@Ericbla thanks, it was driving me crazy
For anyone using Homestead the line to change is 90 at Homestead\scripts\homestead.rb

@Ericbla Thanks, had the same issue which is now solved.

@blasco991 and @Ericbla thanks for this workaround.
To further elaborate... anybody running Homestead with Vagrant 1.9.3, change line 90 (file Homestead/scripts/homestead.rb) to read:
config.vm.network "forwarded_port", guest: guest, host: host, host_ip: "127.0.0.1", auto_correct: true

Thanks fixed same issue i had.
Any plan to fix it?

@khalilj Yes, fix was applied via #8399 and will be included in the next release.

@Ericbla thanks, solved my problem.

Muchas gracias, ya pude desplegar vagrant

Thanks a lot

On Sun, Mar 26, 2017, 03:05 Chris Roberts notifications@github.com wrote:

@khalilj https://github.com/khalilj Yes, fix was applied via #8399
https://github.com/mitchellh/vagrant/pull/8399 and will be included in
the next release.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mitchellh/vagrant/issues/8395#issuecomment-289248377,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACrIBy13bXhbNLerx9wXfRBltaaUEJ9Yks5rpauzgaJpZM4Mku5f
.

>

Best Regards.
Khalil Jiries.

just ran into this, this is now a blocking issue for some of our users on 1.9.3. on win10.

thanks for the fix, any word when we can expect 1.9.4 to be released for the fix?

CC @robruana @kitsuta

Thanks for this. Saved and made my day

Uhm... the explicit loopback workaround is nice, but how can I make port forwarding work for all interfaces/addresses? I guess it used to work with default 0.0.0.0. Why doesn't it work anymore?

mlt

I ran into this problem today, and it seems that typing "localhost" instead of "0.0.0.0" for the host_ip will cause Vagrant to listen on all interfaces.

127.0.0.1 => Only listens on 127.0.0.1
0.0.0.0 => Error, does not work
localhost => Listens on all interfaces

This is on Win 7.

@Anon348923578 are you saying localhost is a better replacement for 0.0.0.0 then 127.0.0.1

I'm on Windows 10 using homestead. I changed my homestead/scripts/homestead.rb file to add host_id: "localhost" for both lines that forward the port (lines 90 and 98). I am still getting the same error:

C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in 'initialize': The requested address is not valid in its context. - connect(2) for "0.0.0.0" port 8000 (Errno::EADDRNOTAVAIL) from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in 'new' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in 'block in is_port_open?' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:88:in 'block in timeout' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in 'block in catch' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in 'catch' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in 'catch' from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:103:in 'timeout'

Any idea as to what I should do to fix this? @blasco991

I'm on Windows 10 using homestead. I changed my homestead/scripts/homestead.rb file to add host_id: "localhost" for both lines that forward the port (lines 90 and 98). I am still getting the same error:

@amyhre16 think meant to say host_ip

@dogi thanks! I should have figured that out lol

Fix not working when using vagrant-vmware-workstation (4.0.18). Anyone got the host_ip trick working with VMWare?

@dogi
In my case yes it was, because I needed to connect to my VM from a different physical computer than the one on which it was running. If you will only ever connect to your VM locally then "127.0.0.1" would probably be preferred.
IMO the behavior seems backwards, it ought to treat "0.0.0.0" as "any IP" and "localhost" as "127.0.0.1 only".

@dogi
In my case yes it was, because I needed to connect to my VM from a different physical computer than the one on which it was running. If you will only ever connect to your VM locally then "127.0.0.1" would probably be preferred.
IMO the behavior seems backwards, it ought to treat "0.0.0.0" as "any IP" and "localhost" as "127.0.0.1 only".

@Anon348923578 it looks like you speak my language here - I also need to be able to connect from remote ;)

Thanks @Ericbla

I tried the fix as well, and after it initially hung up the first time I tried vagrant up, it BSOD. Tried again after reboot and got the same thing, but instead of hanging it happened shortly after it began forwarding ports.

Edit: Whoops. my bad still had HyperV running.

For anyone using Ericbla's fix and getting error:
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MachineWrap, interface IMachine

make sure VitualBox is up to date.

@blasco991 Gracias , no entendia en que archivo iba a realizar la modificacion,ya estaba que me cambiaba a la version anterior de vagrant pero todo funciono bien :) . Thanks, I did not understand which file I was going to make the modification, I was already changing to the previous version of vagrant but everything worked fine :)

1.9.4 is out now, works fine.

@Ericbla ty sir, solved my issue.

@blasco991ย andย @Ericblaย thanks for this workaround.To further elaborate... anybody running Homestead with Vagrant 1.9.3, change line 90 (file Homestead/scripts/homestead.rb) to read:config.vm.network "forwarded_port", guest: guest, host: host, host_ip: "127.0.0.1", auto_correct: true

Thanks, this helped me on the issue. I'm on win10 Pro, I just installed Vagrant yesterday.
This was my error:
image

I Just updated to [email protected] and saw this same issue popup.

I replaced my host_ip to localhost. seems to work, just do not know if it will behave as expected.

Any word if this is not an issue on [email protected]?

Thanks

FYI for Vagrant 2.2.4 on Windows 10, I had to do a find/replace 0.0.0.0 to 127.0.0.1 in C:\HashiCorp\Vagrant\embedded\mingw64\lib\ruby\2.4.0\resolv.rb before the plugin install would work.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings