简体   繁体   English

当我在Windows 7命令行上使用“Vagrant Up”时,为什么Vagrant不会进入我的虚拟框?

[英]Why won't Vagrant ssh into my virtual box when I use `Vagrant Up` on Windows 7 command line?

Whenever I try to Vagrant Up it will load the box and do most everything right, but because I'm trying to use Puppet to provision this CentOS 6.3 minimal I need SSH to work during Vagrant Up (if I want it as autonomous as possible). 每当我尝试Vagrant Up时,它会加载盒子并完成大部分工作,但是因为我正在尝试使用Puppet来配置这个CentOS 6.3最小化,我需要SSH在Vagrant Up期间工作(如果我希望它尽可能自主) 。

I get the following information from Vagrant's INFO log: 我从Vagrant的INFO日志中获得以下信息:

DEBUG virtualbox_4_2:   - [1, "ssh", 2222, 22]
 INFO ssh: Connecting to SSH: 127.0.0.1:2222
 INFO ssh: SSH not up: #<Timeout::Error: execution expired>
 INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "c2e7375d-159f-4014-9bda-ff9914423f4c", "--machinereadable"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: name="Vagrant-Apache-Nick_1360372174"

During Vagrant Up your Windows system tries to connect to SSH. Vagrant Up期间,Windows系统会尝试连接到SSH。 If you type on your command line: 如果您在命令行上键入:

set VAGRANT_LOG=INFO

You may see it fail and try a couple of times. 您可能会看到它失败并尝试了几次。 It looks like this: 它看起来像这样:

INFO ssh: Connecting to SSH: 127.0.0.1:2222

This is happening because the timeout is set to 10. This can be modified by placing the following in your Vagrantfile: 发生这种情况是因为超时设置为10.可以通过在Vagrantfile中放置以下内容来修改:

config.ssh.timeout = 300

You can use any number you like but I recommend something above 100. 您可以使用任何您喜欢的号码,但我推荐100以上的东西。

Sources: 资料来源:

  1. This guy had some useful troubleshooting information. 这家伙有一些有用的故障排除信息。
  2. Vagrant Docs for Vagrantfiles Vagrant文​​件的流浪文件
  3. Vagrant Docs for Vagrantfile SSH Timeout Vagrantfile SSH超时的Vagrant Docs
  4. Vagrant Docs for Debugging 用于调试的Vagrant Docs
  5. Hours of Troubleshooting (Keep Smilin') 故障排除时间(Keep Smilin')

I know I'm WAY late to this post, but I did have nearly the exact same problem for a full day before I simply removed Hyper-V from Windows and it magically solved my issue. 我知道我迟到了这篇文章,但在我从Windows中删除Hyper-V之前,我确实遇到了几乎完全相同的问题,它神奇地解决了我的问题。

I guess when I was testing with Docker for Windows (not to be confused with docker-machine) it goofed my Hyper-V somehow. 我想当我使用Docker for Windows进行测试时(不要与docker-machine混淆),它以某种方式对我的Hyper-V进行了调整。 Not 100% sure why this tweaked fixed this issue, but it worked like a charm after Docker for Windows seemed to fubar my VirtualBox (Docker for Windows and Local by FlyWheel / VirtualBox conflict with each other). 不是100%肯定为什么这个调整解决了这个问题,但是在Docker for Windows似乎使我的VirtualBox(由FlyWheel / VirtualBox相互冲突的Windows和本地Docker)之后,它就像一个魅力。

在此输入图像描述

Hopefully this helps someone out! 希望这可以帮助别人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM