El Capitan的流浪/ Vaprobash问题

时间:2015-10-20 15:06:40

标签: vagrant virtual-machine virtualbox

自升级到El Cap以来,我一直与Vagrant / Vaprobash存在问题。这是在两个不同的mac上发生的,并且都使用最新的Vagrant和VirtualBox版本进行了升级。

虚拟机确实开始使用vagrant up(至少,如果您查看VirtualBox管理员中的框,它正在运行,即使您无法连接到它),但在此期间启动它不断超时:

    Bringing machine 'Vaprobash' up with 'virtualbox' provider...
==> Vaprobash: Checking if box 'ubuntu/trusty64' is up to date...
==> Vaprobash: Clearing any previously set forwarded ports...
==> Vaprobash: Clearing any previously set network interfaces...
==> Vaprobash: Preparing network interfaces based on configuration...
    Vaprobash: Adapter 1: nat
    Vaprobash: Adapter 2: hostonly
==> Vaprobash: Forwarding ports...
    Vaprobash: 22 => 2222 (adapter 1)
==> Vaprobash: Running 'pre-boot' VM customizations...
==> Vaprobash: Booting VM...
==> Vaprobash: Waiting for machine to boot. This may take a few minutes...
    Vaprobash: SSH address: 127.0.0.1:2222
    Vaprobash: SSH username: vagrant
    Vaprobash: SSH auth method: private key
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: Warning: Connection timeout. Retrying...
    Vaprobash: 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.

当盒子最终"运行"时,我无法连接到它。如果我使用VirtualBox打开终端,似乎连接超时是VM等待登录屏幕输入的提示。但是,此登录应由Vagrant处理。

有关如何解决此问题的任何想法?

2 个答案:

答案 0 :(得分:1)

经过多次撕裂头发和磨牙后,重新安装Vagrant,VirtualBox并多次删除/安装我的所有盒子图像,我终于能够通过完全删除所有流浪数据(rm -rf ~/.vagrant.d/)来完成这项工作,卸载vagrant应用程序(rm -rf /usr/bin/vagrant),然后安装vagrant app fresh。

然后我执行了vagrant up并重新生成了所有键,最终似乎可以解决问题。我手动删除并重新生成了密钥,并将id_rsa复制到insecure_private_key .vagrant.d文件中而没有运气 - 并且在没有先删除所有数据的情况下重新安装流浪者将无法解决问题。

希望这有助于其他人。

答案 1 :(得分:0)

你的流浪档案有vb.gui = true吗?如果没有,那么添加如下:

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

如果可以,则可能是您的ssh密钥问题。 您可以尝试以下步骤:

here下载私钥,然后尝试登录流浪盒。

ssh -i privatekey vagrant@ip

here下载私钥并存储在某处,并在vagrant文​​件中添加以下行:

config.ssh.private_key_path="full_path_of_ssh_privatekey"

然后尝试使用命令登录:

vagrant ssh vmname

或 它可能是你的流浪公钥不存放在vagrant vm中。因此,您可以创建shell脚本test.sh并在test.sh文件

中添加以下行
mkdir /home/vagrant/.ssh
wget --no-check-certificate -O authorized_keys 'https://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub'
mv authorized_keys /home/vagrant/.ssh
chown -R vagrant /home/vagrant/.ssh
chmod -R go-rwsx /home/vagrant/.ssh

并在Vagrantfile中使用shell配置程序,如:

config.vm.provision :shell, :path => "test.sh"

然后规定vm要么

vagrant reload vmname --provision 

或者您可以使用命令

重新创建vm
vagrant destroy vmname
vagrant up vmname