Vagrant卡住连接超时重试

本文翻译自:Vagrant stuck connection timeout retrying

My vagrant was working perfectly fine last night. 昨晚我的流浪汉工作得非常好。 I've just turned the PC on, hit vagrant up , and this is what I get: 我刚打开电脑,打开vagrant up ,这就是我得到的:

==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...

Has anyone had this before? 以前有人这么做过吗? vagrant isn't widely covered on the web yet and I can't find a reason why this is occurring. 流浪者在网上还没有被广泛覆盖,我找不到发生这种情况的原因。


#1楼

参考:https://stackoom.com/question/1Wir7/Vagrant卡住连接超时重试


#2楼

I solved this problem, and will answer in case anyone else has a similar issue. 我解决了这个问题,如果其他人有类似的问题,我会回答。

What I did was: I enabled the GUI of Virtual box to see that it was waiting for input on startup to select whether I wanted to boot directly to ubuntu or safemode etc. 我做的是:我启用了虚拟框的GUI,看到它在启动时等待输入,以选择是否要直接启动到ubuntu或safemode等。

To turn on the GUI you have to put this in your vagrant config Vagrantfile : 要打开GUI,你必须把它放在你的vagrant配置Vagrantfile

config.vm.provider :virtualbox do |vb|
  vb.gui = true
end

#3楼

If you don't want to enable the GUI and then have to disable it later, you could also install the extension pack from Oracle: 如果您不想启用GUI,然后必须在以后禁用它,您还可以从Oracle安装扩展包:

http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html#extpack http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html#extpack

Then put this in your Vagrantfile to enable VRDP: 然后将其放入您的Vagrantfile中以启用VRDP:

vb.customize ["modifyvm", :id, "--vrde", "on"]

Now you can use RDP to connect to your box on demand without SSH needing to be running or the GUI open all the time. 现在,您可以使用RDP按需连接到您的盒子,而无需SSH运行或GUI一直打开。


#4楼

When you are stuck with your vagrant machine the way described above there is no need to boot in gui mode (and is impossible without an X server). 当您按照上述方式使用流浪汉机器时,无需以gui模式启动(如果没有X服务器,则无法启动)。

While your VM is booting, in a separate terminal window, just find out the id of the running machine. 在VM启动时,在单独的终端窗口中,只需查找正在运行的计算机的ID。

vboxmanage list runningvms

This will result in something like this: 这将导致类似这样的事情:

"projects_1234567890" {5cxxxx-cxxx-4xxx-8xxx-5xxxxxxxxxx}

Quite often, the VM is simply waiting for you to select an option in the bootloader. 通常,VM只是在等待您在引导加载程序中选择一个选项。 You can send the appropriate keycode (in the case, Enter ) to the vm with controlvm : 您可以使用controlvm将适当的密钥代码(在这种情况下, 输入 )发送到vm:

vboxmanage controlvm projects_1234567890 keyboardputscancode 1c

That's it. 而已。 Your virtual machine will continue the boot process. 您的虚拟机将继续启动过程。


#5楼

I experienced the same issue on a Windows 8.1 machine. 我在Windows 8.1机器上遇到了同样的问题。 The connection timeout and enabling the gui was not usefull at all, the screen was black. 连接超时和启用gui根本没用,屏幕是黑色的。 The fix in my case was disabling "Hyper V" 在我的情况下修复是禁用“Hyper V”

Quote from Vagrant documentation https://docs.vagrantup.com/v2/hyperv/index.html 引用Vagrant文​​档https://docs.vagrantup.com/v2/hyperv/index.html

Warning: Enabling Hyper-V will cause VirtualBox, VMware, and any other virtualization technology to no longer work. 警告:启用Hyper-V将导致VirtualBox,VMware和任何其他虚拟化技术无法运行。 See this blog post https://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx for an easy way to create a boot entry to boot Windows without Hyper-V enabled, if there will be times you'll need other hypervisors. 请参阅此博客文章https://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx,以便在没有启用Hyper-V的情况下创建启动Windows的启动条目的简单方法,如果有时您需要其他虚拟机管理程序。


#6楼

If you are working on Windows 8 or 10, this is what worked for me: 如果您使用的是Windows 8或10,那么这对我有用:

  1. Change BIOS settings to allow virtualization of 64bit. 更改BIOS设置以允许64位虚拟化。
  2. Here is how: 方法如下:
    • Restart PC using Advanced Startup (Go to Advanced Startup -'restart now'-'troubleshoot' -'advanced option'- 'UEFI Firmware Setting' - 'Restart') 使用高级启动重启PC(转到高级启动 - 现在'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    • Inside BIOS window - Go to 'Advanced' menu/tab - Enable 'Intel Virtual Technology' 在BIOS窗口中 - 转到“高级”菜单/选项卡 - 启用“英特尔虚拟技术”
    • Save & Exit. 保存并退出。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值