Reputation: 703
I have issues with Vagrant and I wish they disappear. Please help me. When I installed Vagrant everything worked OK. The problem started when I rebooted Windows 10.
CFG:
config.vm.define "machine" do |machine|
machine.vm.box = "master"
machine.vm.hostname = "machine"
machine.vm.box_check_update = false
machine.vm.network :forwarded_port, guest: 22, host: 2222, disabled: true
machine.vm.network :forwarded_port, guest: 22, host: 2171
LOG2:
==> machine: Booting VM...
==> machine: Waiting for machine to boot. This may take a few minutes...
machine: SSH address: 127.0.0.1:22
machine: SSH username: vagrant
machine: SSH auth method: private key
==> machine: Forcing shutdown of VM...
==> machine: Destroying VM and associated drives...
/opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:1198:in `__connect_nonblock': Operation already in progress - connect(2) for 127.0.0.1:22 (Errno::EALREADY)
from /opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:1198:in `connect_nonblock'
from /opt/vagrant/embedded/lib/ruby/2.4.0/socket.rb:56:in `connect_internal'
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'
Upvotes: 1
Views: 501
Reputation: 435
That solution worked to me when I had the same problem on my Vagrant machines.
The reason is that Hyper-V takes over these ports, to prevent it from happening do the following:
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
Disable hyper-v (which will required a couple of restarts) netsh int ipv4 add excludedportrange protocol=tcp startport=2171 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=2171 numberofports=1
When you finish all the required restarts, reserve the port you want so hyper-v doesn't reserve it backOptional: You can reactivate your Hyper-V after you've done with the following command:
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
After you done all these steps accordingly the problem suppose to be fixed, to me this stuff really helped.
This link helped a lot understanding what happened.
Upvotes: 1