Vagrant 启动/重新加载错误 - 默认:警告:连接超时。正在重试…

Vagrant 启动/重新加载错误 - 默认:警告:连接超时。正在重试…

我已经使用功能齐全的 vagrant 三个月了,但在过去的三天里,每当我尝试运行 vagrant up 或 vagrant reload 时都会出现错误。

这是我运行时遇到的错误vagrant reload

default: Attempting graceful shutdown of VM...
default: Guest communication could not be established! This is usually because
default: SSH is not running, the authentication information was changed,
default: or some other networking issue. Vagrant will force halt, if
default: capable.
default: Forcing shutdown of VM...
default: Clearing any previously set forwarded ports...
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: 80 => 8080 (adapter 1)
default: 22 => 2222 (adapter 1)
default: Running 'pre-boot' VM customizations...
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: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. 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.

我正在使用 Elementary OS Luna,并按照一些答案的建议更新了 vagrant 和 virtualbox 的最新版本。但问题仍然存在。

我尝试了大多数流行的解决方案,包括启用 GUI 和。我也尝试了给出的解决方案这里但由于我的虚拟盒无法登录,因此无法实现。

然而,GUI 显示的是这样的:

 keys: press S to skip mounting or M for manual recovery

我逐一尝试了两个键,但问题仍然存在。

有人遇到过这种情况吗?能否提供解决方案?vagrant 在网络上还没有被广泛报道,我找不到发生这种情况的原因。

答案1

在尝试了各种不同问题的选项后,我仍然面临同样的问题。最后,我做了一个

vagrant destroy

其次是

vagrant up

我的系统又能正常工作了。

注意:如果你也有直接关闭电脑的习惯,你可能很快就会遇到这个问题!在你的 vagrant 终端 ( vagrant ssh) 中,始终执行:

sudo shutdown -h now

或者你也可以直接输入

vagrant halt

从 ssh 注销后。

附言:对于那些可能担心在 期间丢失数据/代码/任何东西的人来说vagrant destroy,您可以放心!我犹豫着是否使用该命令,但根据文档,它所做的只是:

此命令将停止 Vagrant 正在管理的运行机器,并销毁在机器创建过程中创建的所有资源。运行此命令后,您的计算机应处于干净状态,就像您从未创建过客户机一样。

这意味着您的代码将保持完整,并且下一个代码vagrant up将引导您进入与您离开时相同的状态,只是问题已经解决。:)

相关内容