我正在运行vagrant up
我正面临着一个问题,就是在开始Vagrant stuck connection timeout retrying时似乎是这个问题。我已经尝试了所有的解决方案,我也做了vagrant destroy
,但是只要vagrant suspend
,那么vagrant up
命令就不起作用,我必须退出并且执行vagrant reload
以使VM正常运行。这非常令人讨厌和令人沮丧。
我现在正在使用vagrant homestead 0.4.4版本,并且这个问题的一部分在VM启动后一切正常。
我目前的系统是OSX El Captain。
如果您需要更多详细信息,请与我们联系。
我的Vagrantfile
:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
homesteadYamlPath = "Homestead.yaml"
homesteadJsonPath = "Homestead.json"
afterScriptPath = "after.sh"
aliasesPath = "aliases"
require File.expand_path(confDir + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
错误时命令up output
:
~/Projects/credentialsApi (feature/10)$vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: A newer version of the box 'laravel/homestead' is available! You currently
==> default: have version '0.4.4'. The latest is version '0.5.0'. Run
==> default: `vagrant box update` to update.
==> default: Resuming suspended VM...
==> 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: Warning: Remote connection disconnect. 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...
default: Warning: Remote connection disconnect. 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...
default: Warning: Remote connection disconnect. 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...
default: Warning: Remote connection disconnect. 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...
default: Warning: Remote connection disconnect. 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...
default: Warning: Remote connection disconnect. 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...
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.
~/Projects/credentialsApi (feature/10)$
vagrant ssh-config
命令输出:
~/Projects/credentialsApi (development)$vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2204
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "/Users/pabloleone/Projects/credentialsApi/.vagrant/machines/default/virtualbox/private_key"
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
答案 0 :(得分:0)
首先,尝试使用vagrant
变量运行VAGRANT_LOG=debug
来调试问题。
如果这不会有帮助,当它显示超时消息时,在另一个终端运行:vagrant status
以查看VM是否正常运行。或者直接从GUI运行VirtualBox并检查机器状态。
如果它正在运行,请通过以下命令检查SSH凭据是否正确:
vagrant ssh-config
以便:
127.0.0.1:2222
),IdentityFile
)。还尝试通过以下方式手动登录VM:
vagrant ssh
或this command(通过ssh-config命令将default
更改为正确的主机):
vagrant ssh-config > vagrant-ssh && ssh -F vagrant-ssh default
由于它在vagrant reload
之后适用于您(因此可能启用了BIOS中的虚拟化支持),因此可能由于某些问题而无法在恢复时默认启动SSH服务器。然后,您应该通过vagrant reload && vagrant ssh
修复SSH日志来检查SSH日志,并通过以下方式检查日志:
sudo tail /var/log/secure
如果是这种情况,要检查SSH服务是否运行,请添加以下行:
config.vm.provision :shell, run: "always", path: "scripts/check_ssh_service.sh"
类似问题:Apache doesn't start after Vagrant reload
最后检查以下列表,了解SSH超时问题的可能解决方案:
- 确保您的防火墙或防病毒软件没有阻止该程序(我怀疑这种情况会经常发生)
- 给你的流浪汉机器一些时间来实现超时。如果你没有一台非常快的PC / Mac,VM将需要一段时间才能启动 SSH就绪状态,因此会发生超时。
- 因此,在断定有错误之前,首先尝试让流浪汉完全超时。
- 如果vagrant完全超时,则将vagrant文件中的超时限制增加到几分钟,然后重试。
- 如果仍然无效,请尝试通过VirtualBox界面清理启动流浪汉机器并启用GUI 机器预先。如果GUI没有显示任何发生的事情(即。 只是黑屏,没有文字),而它正在启动,然后你的流浪汉 机器有问题。
- 通过VB界面销毁整台机器并重新安装。
- 删除用户文件夹中Vagrant Images文件夹中的ubuntu图像文件,然后重新下载并安装。
- 您是否拥有支持64位硬件虚拟化的英特尔处理器?谷歌一下。如果您这样做,请确保没有设置 您的Bios禁用此功能。
- 如果您运行的是Windows 7或8,则禁用hyper-v功能.Google如何禁用。
- 确保您正在运行支持SSH的客户端。使用Git bash。下载:http://git-scm.com/downloads
- 安装32位版本的ubuntu,如trusty32或precise32。只需更改vagrant文件中的版本,然后重新安装vagrant 目录。
- 确保您使用的是最新的vagrant和virtualbox版本。
- 最后的度假村:格式化您的计算机,重新安装Windows并购买intel core isomething处理器。
来源:GitHub帖子@dezinerdudes
答案 1 :(得分:0)
我终于解决了这个问题。这是由于版本。我刚刚升级了流浪者和VM。