Why is Vagrant trying to SSH to Windows guest?

2019-03-18 13:50发布

My host is running Windows 7 Pro (64 bit). The Guest OS in this case is Windows Server 2008 R2. The 'vagrant up' command is running into an issue where I keep getting:

****default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: password
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...****

till it eventually times out and says:

Timed out while waiting for the machine to boot. This means that Vagrant was unable to communicate with the guest machine within the configured ("config.vm.boot_timeout" value) time period. If you look above, you should be able to see the error(s) that Vagrant had when attempting to connect to the machine. These errors are usually good hints as to what may be wrong. If you're using a custom box, make sure that networking is properly working and you're able to connect to the machine. It is a common problem that networking isn't setup properly in these boxes. Verify that authentication configurations are also setup properly, as well. If the box appears to be booting properly, you may want to increase the timeout ("config.vm.boot_timeout") value.

The VM actually comes up fine, is accessible and usable.

  • Why is it trying to even SSH to the Windows machine?

My Vagrantfile contents are:


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

  # Max time to wait for the guest to shutdown
  config.windows.halt_timeout = 60

  # Admin user name and password
  config.winrm.username = "Administrator"
  config.winrm.password = "Password"

  # Configure base box parameters
  config.vm.box = "BaseBox"
  config.vm.box_url = "./Base.box"
  config.vm.guest = :windows
  config.vm.provider "virtualbox" do |v|
    v.gui = true
  end

  # Port forward WinRM and RDP (changed values to NOT conflict with host)
  config.vm.network :forwarded_port, guest: 3389, host: 3391
  config.vm.network :forwarded_port, guest: 5985, host: 5987, id: "winrm", auto_correct: true

end

2条回答
Emotional °昔
2楼-- · 2019-03-18 14:33

You need to use

   config.vm.communicator = "winrm"

In your vagrant file. Take a look at this feature preview

查看更多
forever°为你锁心
3楼-- · 2019-03-18 14:47

I experienced the issue in Windows 7. At last we found out that this problem is due to the Linux OS that we are using with Vagrant version is not compatible. So, we took the latest version (i.e. v1.6.3) of Vagrant and updated our OS to point to agent.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-i386-v20131103.box"

Vagrant version 4.3.8 was not working with the below OS. agent.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box".

I hope this helps to resolve the issue.

查看更多
登录 后发表回答