2014-04-25 117 views
24

我有一个Ubuntu 13.10,我安装了Vagrant 1.5.4和VirtualBox 4.3.10r93012。我在第一次正确编写虚拟机脚本时编写命令vagrant up时发生问题。但同样做vagrant halt和写入命令vagrant up后,会出现一个问题:超时等待机器启动时超时

vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> 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: 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. 

有没有什么解决办法吗?谢谢。

+0

Stack Overflow是编程和开发问题的网站。这个问题似乎与题目无关,因为它不涉及编程或开发。请参阅帮助中心的[我可以询问哪些主题](http://stackoverflow.com/help/on-topic)。也许[超级用户](http://superuser.com/)或[Unix&Linux堆栈交换](http://unix.stackexchange.com/)会是一个更好的地方。另请参阅[我在哪里发布关于Dev Ops的问题?](http://meta.stackexchange.com/q/134306) – jww

回答

31

我使用config.vm.boot_timeout增加了时间。但对我来说,这不是原因,尽管错误告诉了超时。

我使用vim打开了Vagrantfile,并添加了以下几行代码,为虚拟机启用了GUI。

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

重新运行vagrant up后,我看到了GUI中的真正原因。有一个错误对话框,它一直在等待。这是连接超时的原因。

要解决这个问题,我必须在系统BIOS中进行一些配置。我必须打开intel VT-x设置。请检查AMD-V设置。这些设置有助于硬件虚拟化。

+0

感谢@Akalanka的评论。我通过打开intel VT-x BIOS的设置来解决问题。 – xserrat

+2

我已启用GUI,但在GUI中我可以看到虚拟机的登录屏幕,并且我可以用用户名和密码登录为流浪汉。 ssh超时。 ==>默认值:等待机器启动。这可能需要几分钟的时间... 默认:SSH地址:127.0.0.1:2222 默认:SSH用户名:流浪 默认:SSH验证方法:私钥 – Sharath

0

编辑config.vm并根据您的需要增加config.vm.boot_timeout的值。

4

我用“流浪摧毁”并解决了这个问题。

该命令停止正在运行的机器Vagrant正在管理和销毁机器创建过程中创建的所有资源。运行此命令后,您的计算机应保持清洁状态,就好像您从未创建客户机一样。

4

您需要能够使用GUI。在Vagrant文件中删除此行的评论:

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

后,您需要关闭您的计算机并再次启动:

vagrant halt 
vagrant up 
+0

任何想法为什么这将是必要的? – activatedgeek

8

我对窗口10同样的问题,我的解决办法是启用英特尔虚拟化

恐怕我不能给你具体的说明,只要BIOS菜单选项因电脑而异,具体取决于制造商。但是,通常您应该按照以下步骤操作:

1-打开机器电源并打开BIOS。

2-打开处理器子菜单。处理器设置菜单可能隐藏在芯片组,高级CPU配置或北桥中。

根据处理器的品牌,启用Intel虚拟化技术(也称为Intel VT)或AMD-V。

4-保存更改并重新启动。

+2

谢谢,我认为如果BIOS支持这种配置,这是解决问题的最佳选择。 @Akalanka说,如果它不支持,一个可能的解决方案是通过流浪配置。 – xserrat

35

选择您的Ubuntu服务器,单击设置,转到网络选项卡,并确保您的电缆连接选项被选中。

enter image description here

+0

这个问题解决了牙齿和指甲后,这个解决方案为我工作。非常感谢! – KalC

+0

感谢万人!这一整天我都被这个问题困住了! :) –

-1

重新启动计算机,并保持打F10键。这会将您带入系统BIOS。在那里你可以检查你的英特尔虚拟化是否被禁用。如果是这样,将其更改为启用,保存并继续重新启动您的电脑。

-1

一些事情你可以试试:

  1. 检查流浪版本(vagrant -v)你正在运行,它应该是最新的。还运行vagrant box update
  2. 增加config.vm.boot_timeout Vagrantfile中的值。
  3. config.vm.provider :virtualbox do |vb|之后加上vb.gui = true行使Vagrantfile打开带有GUI的虚拟机。尝试重新加载,看看它发生什么确切的错误,然后尝试修复它。 也点击设置,转到网络选项卡,并确保选择了电缆连接选项。

  4. 一旦GUI启用尝试重装一次登录界面时,你可以用用户名流浪汉登录名和密码相同的用户名。你需要打开/etc/default/grub。将以下内容添加到文件底部并保存文件:GRUB_RECORDFAIL_TIMEOUT=2。运行sudo update-grub。关闭VM并运行vagrant up

0

我也越来越错误消息Timed out while waiting for the machine to boot.通过游民文件启用GUI后,我能看到流浪的TP被要求登录&密码。提供vagrant/vagrant工作,但机器仍然没有起来。

最后,Vagrant destroy工作。经过这个流浪者上调配置的机器&现在我可以做ssh了。