Laravel Homestead vagrant 超时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41064388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel Homestead vagrant up times out
提问by Camilo
I'm following the official guide for running Laravel 5.1 on Homestead.
我正在遵循在 Homestead 上运行 Laravel 5.1 的官方指南。
But when I try vagrant up
it hangs up at homestead-7: SSH auth method: private key
and eventually times out with the message:
但是当我尝试时vagrant up
它挂断homestead-7: SSH auth method: private key
并最终超时并显示以下消息:
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 the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
My SSH keys were generated using ssh-keygen -t rsa -C "you@homestead"
.
我的 SSH 密钥是使用ssh-keygen -t rsa -C "you@homestead"
.
Can't access the machine through vagrant ssh
, it outputs ssh_exchange_identification: read: Connection reset by peer
.
不能通过 访问机器vagrant ssh
,它输出ssh_exchange_identification: read: Connection reset by peer
。
Tried vagrant destroy
and deleting the ~/.homestead
folder to start again from scratch but same result.
尝试vagrant destroy
删除~/.homestead
文件夹以从头开始,但结果相同。
Using Ubuntu 16.04 64-bit, Vagrant 1.8.4 and VirtualBox 5.0.18. Virtualization is enabled in my computer, other boxes boot up without problems.
使用 Ubuntu 16.04 64 位、Vagrant 1.8.4 和 VirtualBox 5.0.18。我的电脑启用了虚拟化,其他机器启动没有问题。
回答by HamptonNorth
Running Win 10 Pro v 1607, VirtualBox 5.0.30, Vagrant 1.9.1 and Homestead 1.0.1.
运行 Win 10 Pro v 1607、VirtualBox 5.0.30、Vagrant 1.9.1 和 Homestead 1.0.1。
I had same issues as described. Vagrant up command would run cleanly but hang at the SSH username: private key
message.
Reinstalled, checked .yaml file, recreated ssh keys - tried all the usual stuff without success.
我遇到了与描述相同的问题。Vagrant up 命令会干净地运行,但会挂在SSH username: private key
消息上。重新安装,检查 .yaml 文件,重新创建 ssh 密钥 - 尝试了所有常用的东西,但没有成功。
Finally working when I changed the network setting in my Virtual Box.
当我更改 Virtual Box 中的网络设置时,终于开始工作了。
- Brought up VirtualBox program with windows UI
- Clicked on Network - in the 'Adapter 1' tab, then opened up Advanced
- Clicked 'Cable Connected' checkbox
- At console $ prompt,
vagrant halt
- then
vagrant up
- 使用 Windows UI 启动 VirtualBox 程序
- 单击网络 - 在“适配器 1”选项卡中,然后打开高级
- 单击“电缆已连接”复选框
- 在控制台 $ 提示符下,
vagrant halt
- 然后
vagrant up
All then worked as expected. Unticked 'cable connected' and again vagrant up hanged. Reset 'cable connected' and vagrant up running correctly again.
然后一切都按预期工作。未勾选“电缆已连接”并再次无业游民挂起。重置“电缆连接”并再次正确运行流浪者。
The default settings for importing the base Laravel/Homestead box leaves the 'cable connected' setting unchecked/off
导入基础 Laravel/Homestead 框的默认设置未选中/关闭“电缆连接”设置
See vagrant issue 7648 for some background
有关一些背景,请参阅vagrant 问题 7648
If you don't want to keep ticking the cable connected box, the permanent fix is:
如果您不想继续勾选有线连接框,永久修复是:
Locating the Vagrantfile
file in the Homestead
folder (probably its file path is ~/Homestead/Vagrantfile
), and adding following to the Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
block fixes issue:
在Vagrantfile
文件Homestead
夹中找到文件(可能它的文件路径是~/Homestead/Vagrantfile
),并将以下内容添加到Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
块修复问题:
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
end
With this change to the Vagrantfile vagrant up
works on new imported laravel/homestead box
对 Vagrantfile 的这一更改vagrant up
适用于新导入的 laravel/homestead 框
回答by Илья Зеленько
If you are using Windows, you may need to enable hardware virtualization (VT-x). It can usually be enabled via your BIOS. If you are using Hyper-Von a UEFI system you may additionally need to disable Hyper-V in order to access VT-x.
如果您使用的是 Windows,则可能需要启用硬件虚拟化 (VT-x)。它通常可以通过您的 BIOS 启用。如果您在 UEFI 系统上使用Hyper-V,您可能还需要禁用 Hyper-V 才能访问 VT-x。
I had virtualization turned on, but in VirtualBox it showed that no, I turned off Hyper-V and it all worked.
我打开了虚拟化,但在 VirtualBox 中显示没有,我关闭了 Hyper-V 并且一切正常。
回答by Iannazzi
I sometimes hang on vagrant up
with the error SSH username: private key
我有时会坚持vagrant up
错误SSH username: private key
try
尝试
vagrant halt
vagrant up
vagrant halt
vagrant up
回答by Devin Norgarb
If it times out on ssh-key authentication it seems to be a host/guest communication error.
如果 ssh-key 身份验证超时,则似乎是主机/访客通信错误。
To confirm try ssh [email protected]
确认试试 ssh [email protected]
If it throws an error or times-out again make sure the virtual machine is shut down completely, by running vagrant halt and using the Virtualbox GUI to confirm this.
如果它再次抛出错误或超时,请确保虚拟机完全关闭,通过运行 vagranthalt 并使用 Virtualbox GUI 确认这一点。
Under network I sure my adapter was "Cable Connected" and for my host only adapter I set "allow all" for promiscuis mode.
在网络下,我确定我的适配器是“有线连接”,对于我的仅主机适配器,我为混杂模式设置了“全部允许”。
!Virtual box Network settings screen]2
I then ran vagrant up --provision
and there was no wait during the authentication between the two.
然后我跑了vagrant up --provision
,在两者之间的身份验证过程中没有等待。
After the vagrant provisioner script has run you may now vagrant ssh
in
在 vagrant provisioner 脚本运行后,您现在可以vagrant ssh
在
回答by Badr Errami
I was facing this problem and tried editing it in the VirtualBox Gui but my Homestead machine didn't appear in the list, here's the solution if it doesn't :
我遇到了这个问题并尝试在 VirtualBox Gui 中编辑它,但我的 Homestead 机器没有出现在列表中,如果没有出现,这是解决方案:
VBoxManage list runningvms
find your homestead machine in the list, it'll mostly be labelled "Homestead-x" (For me it was "Homestead-7") then run the following commands :
在列表中找到您的宅基地机器,它主要被标记为“Homestead-x”(对我来说是“Homestead-7”)然后运行以下命令:
VBoxManage startvm "homestead-7" --type emergencystop
VBoxManage modifyvm "homestead-7" --cableconnected1 on
Afterwards cd into your homestead folder and you'll notice the machine was aborted, a simple vagrant up
will start your machine successfully and without stop.
Also consider adding the bit of code provided by @HamptonNorth to your VagrantFile for a permanent fix.
之后 cd 进入您的 homestead 文件夹,您会注意到机器已中止,一个简单的方法vagrant up
将成功启动您的机器并且不会停止。还可以考虑将@HamptonNorth 提供的代码添加到您的 VagrantFile 中以进行永久修复。
回答by Kristaps Jarem?uks
In my case it worked by deleting ".vagrant" folderlocated next to Vagrantfile.
在我的情况下,它通过删除位于 Vagrantfile 旁边的“.vagrant”文件夹来工作。
Scenario were following:
场景如下:
- I was working with this box previously
- Reinstalled my PC. Before that I exported box package file so its ready for setup next time.
- Imported
package.box
after fresh Windows 10 installation vagrant up
, and then got stuck similar as described in question.
- 我以前用过这个盒子
- 重新安装了我的电脑。在此之前,我导出了 box 包文件,以便下次进行设置。
package.box
在全新安装 Windows 10 后导入vagrant up
,然后像问题中描述的那样卡住了。
Looks like there are some kind of conflict if there are existing ".vagrant" folder, probably ssh keys or something.
如果存在现有的“.vagrant”文件夹,可能是 ssh 密钥或其他东西,看起来会存在某种冲突。