我有一个ubuntu虚拟机。一切正常,除了在启动时,消息后大约需要5分钟或更长时间
Waiting for machine to boot. This may take a few minutes...
在完成启动之前:
➜ my_box vagrant reload
/Users/pinouchon/.vagrant.d/boxes/my_box/virtualbox/include/_Vagrantfile:5: warning: already initialized constant VAGRANTFILE_API_VERSION
[default] Attempting graceful shutdown of VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
# More port forwards
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
# waits about 5 minutes at this point, then:
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.
Guest Additions Version: 4.3.0
VirtualBox Version: 4.2
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
此框曾经快得多(启动时间约为30秒)。所以我认为这是一个网络配置导致超时或类似的东西。
但没有成功。 (我尝试了修正Resolve it
和workaround 2.
)。
我还尝试删除/etc/hosts
个文件中的任何127.0.0.1条目。没有成功。
任何提示?
OS / Versions:
Host: OSX 10.8.5
Guest: Ubuntu 12.05
Virtualbox: 4.2
答案 0 :(得分:13)
您正在使用的虚拟机客户机添加4.3.x,但您的主机正在运行4.2.x
由于存在这种差异,Virtualbox无法执行属于创建过程的某些命令。
获取运行guest虚拟机添加4.2.x的新盒子,或者将虚拟盒升级到4.3.x可能会解决此问题。
更新
尝试在流浪文件中设置以下内容
config.vm.boot_timeout = 300
也尝试打开debuging
vagrant up --debug
更新2
有些vm只是不能很好地使用不兼容的guest虚拟机版本。例如,来自同一家公司的centos和debian盒子。这些人将会有所帮助,而debian会很好。
http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box
http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box
答案 1 :(得分:7)
如果流浪者无法建立SSH连接,也会发生这种情况。
在这种情况下似乎没有报告任何错误。
使GUI显示:
# Show GUI or not.
config.vm.provider "virtualbox" do |v|
v.gui = true
end
您可能会看到“dev login:”或其他提示,就像一切都很好。
然后你可能还记得你昨晚改变了客人的SSH密钥集......
解决方案:告诉流浪者私钥在主机上的位置。
# Use a new keyset
config.ssh.private_key_path = "~/.ssh/id_rsa"
公钥也需要在访客身上。
仅当您已将匹配的公钥放在guest虚拟机上的authorized_keys文件中时,此方法才有效。
这取决于操作系统,但在常见的Precise64盒子上,从终端看起来像这样:
使用openssh-client的Linux主机
ssh-copy-id -i .ssh/id_rsa.pub user@hostname.example.com
Mac主机
cat ~/.ssh/id_rsa.pub | ssh user@hostname.example.com "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
mac还有一个ssh-copy-id端口。 https://github.com/beautifulcode/ssh-copy-id-for-OSX
此SO帖子有一个简单的内联shell配置程序,可在配置计算机时自动更换authorized_keys。 Vagrant insecure by default?
答案 2 :(得分:2)
我偶尔会遇到这种情况:虚拟机需要很长时间才能启动,随后网络出现问题(我在其上运行的网站无法访问)。
对我来说,这可以通过以下方式解决:
vagrant ssh
进入VM sudo /etc/init.d/networking restart
答案 3 :(得分:1)
不确定你是否已经解决了这个问题,但是我遇到了同样的错误并且修复了它我在重启之前删除了对vagrant发出的dhcp租约。
@您当地可以使用
关闭VMVBoxManage controlvm <vmname> poweroff
然后在VirtualBox上你必须删除dhcp
sudo rm -Rf /var/lib/dhcp/*
您可以找到其他信息来指导您
答案 4 :(得分:1)
@ spuder建议vagrant up --debug
为我解决了这个问题。似乎VirtualBox GUI运行得更顺畅,并且在此过程中更快地弹出一个窗口。我按照其他人的建议改变了这一点:
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
并设置了config.vm.boot_timeout = 600
。
这与Udacity课程Full Stack Foundations的setup有关。
答案 5 :(得分:0)
修正了问题。我做了什么:
注意:
其他说明:
config.vm.boot_timeout = 300
没有帮助 修改:还可以尝试在来宾计算机上运行remove /etc/udev/rules.d/70-persistent-net.rules
。
答案 6 :(得分:0)
尝试生成insecure_private_key
我通过移除位于insecure_private_key
~/.vagrant.d
解决了这个问题
可能原因是insecure_private_key
文件已旧
答案 7 :(得分:0)
我解决了这个问题:
wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
chown -R vagrant:vagrant .ssh
有些人也可以这样做:
Warning: Authentication failure. Retrying...
答案 8 :(得分:0)
尝试取消注释该行:
config.vm.network“private_network”,ip:“192.168.33.11”
在VagrantFile中
答案 9 :(得分:0)
为了使其他偶然发现此症状的人受益,我(最近)看到了这一点,并最终发现在我的案例中,原因是底层包装盒的BIOS中没有打开AMD-V,并且因此来宾没有启动。即使知道这一点,我也无法在日志中找到它,而是通过尝试以完全UI模式引导基础VirtualBox来发现它的。
答案 10 :(得分:-1)
在Virtualbox Manager中,选择正确的VM,然后右键单击设置→网络。启用适配器1→连接电缆。最后,执行
$vagrant reload