El Capitan 上的 Vagrant / Vaprobash 问题
Vagrant / Vaprobash problems on El Capitan
自升级到 El Cap 后,我在使用 Vagrant / Vaprobash 时一直遇到问题。这发生在两台不同的 mac 上,并且都已升级到最新的 Vagrant 和 VirtualBox 版本。
VM 确实开始使用 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.
当盒子终于 "runs" 时,我无法连接到它。如果我使用 VirtualBox 打开终端,连接超时似乎是 VM 正在等待登录屏幕输入的提示。但是,这个登录应该由 Vagrant 处理。
有什么解决办法吗?
你的 vagrant 文件有 vb.gui = true
吗?如果没有,则添加:
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
如果没问题,则可能是您的 ssh 密钥有问题。
您可以尝试以下步骤:
从here下载私钥并尝试登录vagrant box。
ssh -i privatekey vagrant@ip
或
从 here 下载私钥并存储在某处并在 vagrant 文件中添加以下行:
config.ssh.private_key_path="full_path_of_ssh_privatekey"
然后尝试使用命令登录:
vagrant ssh vmname
或
可能是你的 vagrant public 密钥没有存储在 vagrant 虚拟机中。因此您可以创建 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
或者您可以使用命令
重新创建虚拟机
vagrant destroy vmname
vagrant up vmname
经过多次撕扯头发和磨牙,重新安装 Vagrant、VirtualBox 并多次删除/安装我的所有盒子图像,我终于能够通过完全删除所有流浪数据来完成这项工作(rm -rf ~/.vagrant.d/
),卸载 vagrant 应用程序 (rm -rf /usr/bin/vagrant
),然后重新安装 vagrant 应用程序。
然后我执行了 vagrant up
并重新生成了所有密钥,这似乎终于成功了。我已经手动删除并重新生成了密钥,并且在 .vagrant.d
中的 insecure_private_key
文件上复制了我自己的 id_rsa
但没有运气——并且在没有先删除所有数据的情况下重新安装 vagrant 将无法解决问题。
希望这对其他人有帮助。
自升级到 El Cap 后,我在使用 Vagrant / Vaprobash 时一直遇到问题。这发生在两台不同的 mac 上,并且都已升级到最新的 Vagrant 和 VirtualBox 版本。
VM 确实开始使用 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.
当盒子终于 "runs" 时,我无法连接到它。如果我使用 VirtualBox 打开终端,连接超时似乎是 VM 正在等待登录屏幕输入的提示。但是,这个登录应该由 Vagrant 处理。
有什么解决办法吗?
你的 vagrant 文件有 vb.gui = true
吗?如果没有,则添加:
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
如果没问题,则可能是您的 ssh 密钥有问题。 您可以尝试以下步骤:
从here下载私钥并尝试登录vagrant box。
ssh -i privatekey vagrant@ip
或
从 here 下载私钥并存储在某处并在 vagrant 文件中添加以下行:
config.ssh.private_key_path="full_path_of_ssh_privatekey"
然后尝试使用命令登录:
vagrant ssh vmname
或
可能是你的 vagrant public 密钥没有存储在 vagrant 虚拟机中。因此您可以创建 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
或者您可以使用命令
重新创建虚拟机vagrant destroy vmname
vagrant up vmname
经过多次撕扯头发和磨牙,重新安装 Vagrant、VirtualBox 并多次删除/安装我的所有盒子图像,我终于能够通过完全删除所有流浪数据来完成这项工作(rm -rf ~/.vagrant.d/
),卸载 vagrant 应用程序 (rm -rf /usr/bin/vagrant
),然后重新安装 vagrant 应用程序。
然后我执行了 vagrant up
并重新生成了所有密钥,这似乎终于成功了。我已经手动删除并重新生成了密钥,并且在 .vagrant.d
中的 insecure_private_key
文件上复制了我自己的 id_rsa
但没有运气——并且在没有先删除所有数据的情况下重新安装 vagrant 将无法解决问题。
希望这对其他人有帮助。