hashicorp / vagrant

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

Network Configuration for Hyper-V Broken in 2.2.17 - VM does not report IP Address #12456

Closed caseygbigelow closed 3 years ago

caseygbigelow commented 3 years ago

Trying to vagrant up or vagrant provision with Hyper-V provider on 2.2.17 is broken. We can confirm VM is up and has IP address:

PS C:\WINDOWS\system32> (Hyper-V\Get-VMNetworkAdapter -VM $(Hyper-V\Get-VM -Name vagrant_default_1620649202590_87486)).IPAddresses
172.16.22.73
fe80::215:5dff:fe16:b23f

...but we observe Vagrant times out "waiting for the machine to report its IP address":

==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
    default: Timeout: 60 seconds
Hyper-V failed to determine your machine's IP address within the
configured timeout. Please verify the machine properly booted and
the network works. To do this, open the Hyper-V manager, find your
virtual machine, and connect to it.

The most common cause for this error is that the running virtual
machine doesn't have the latest Hyper-V integration drivers. Please
research for your operating system how to install these in order
for the VM to properly communicate its IP address to Hyper-V.

Vagrant version

2.2.17

Host operating system

Windows 10 Enterprise

Guest operating system

CentOS

Vagrantfile

Vagrant.configure("2") do |config|

  config.vm.box = "centos/7"
  config.vm.box_version = "1905.1"
  config.vm.provider "hyperv" do |hv|
    hv.ip_address_timeout = 60
  end
end

Debug output

Encountered while remote troubleshooting a team member so don't have the full debug handy; can provide if absolutely needed.

Expected behavior

Vagrant is able to find the VM's IP address.

Actual behavior

Vagrant times out waiting for the VM's IP address.

Steps to reproduce

  1. vagrant up

References

Error occurs in get_network_config PowerShell script; we used to iterate over a list named networks, now we just have one network device, netdev, but the linked line was not changed from network to netdev when the iteration logic was removed.

Workaround exists: revise your local Gems such that the linked line says netdev instead of network.

Apologies if this issue is covered elsewhere, could not find it. Can open a PR myself but might be some delay, figured I'd raise the issue in case somebody else wants to jump on.

github-actions[bot] commented 3 years ago

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.