我有一个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秒开机).所以我认为这是一个网络配置导致超时或类似的东西.
它尝试了这里提出的修复:https: //github.com/mitchellh/vagrant/wiki/%60vagrant-up%60-hangs-at-%22Waiting-for-VM-to-boot.-This-can-take- A-数分钟车22%
但没有成功.(我尝试了修复Resolve it
和workaround 2.
).
我还尝试删除/etc/hosts
文件中的任何127.0.0.1条目.没有成功.
任何提示?
操作系统/版本:
Host: OSX 10.8.5 Guest: Ubuntu 12.05 Virtualbox: 4.2
spuder.. 13
您正在使用的虚拟机客户机添加4.3.x,但您的主机运行4.2.x.
由于这种差异,Virtualbox无法执行作为创建过程一部分的某些命令.
获取运行guest虚拟机添加4.2.x的新盒子或将虚拟盒升级到4.3.x可能会解决此问题.
更新
尝试在您的vagrant文件中设置以下内容
config.vm.boot_timeout = 300
也尝试打开debuging
vagrant up --debug
更新2
有些vm只是不能很好地兼容客户添加的不兼容版本.例如,来自同一家公司的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
您正在使用的虚拟机客户机添加4.3.x,但您的主机运行4.2.x.
由于这种差异,Virtualbox无法执行作为创建过程一部分的某些命令.
获取运行guest虚拟机添加4.2.x的新盒子或将虚拟盒升级到4.3.x可能会解决此问题.
更新
尝试在您的vagrant文件中设置以下内容
config.vm.boot_timeout = 300
也尝试打开debuging
vagrant up --debug
更新2
有些vm只是不能很好地兼容客户添加的不兼容版本.例如,来自同一家公司的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
如果vagrant无法建立SSH连接,也会发生这种情况.
它似乎没有报告任何错误,为什么它挂起在这种情况下.
用GUI来显示:
# Show GUI or not. config.vm.provider "virtualbox" do |v| v.gui = true end
您可能会看到"dev login:"或其他提示,就像一切都很好.
然后你可能还记得你昨晚改变了客人的SSH密钥集......
解决方案:告诉vagrant私钥在主机上的位置.
# Use a new keyset config.ssh.private_key_path = "~/.ssh/id_rsa"
公钥也需要在客人身上.
这仅在您已将匹配的公钥放在guest虚拟机上的authorized_keys文件中时才有效.
这取决于操作系统,但在常见的Precise64盒子上,从终端看起来像这样:
Linux主机与openssh-client
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.流浪汉默认不安全?