答案1
booting VM
因此,我在使用时也遇到了同样的问题Ubuntu 16.04 LTS。
为了通过多次硬重置解决此问题,我已更新为Vagrant 2.0.1和VirtualBox 5.2。
检查你拥有的版本:
vagrant -v
(打开 GUI:帮助 --> 关于)virtualbox -v
流浪汉
- 删除文件夹中的旧文件
index
和index.lock
/home/USER/.vagrant.d/data/machine-index/
- 下载 Vagrant 2.0.1https://www.vagrantup.com/downloads.html
- 安装包
sudo dpkg -i vagrant_2.0.1_x86_64.deb
虚拟盒
删除当前的虚拟盒
- 运行
sudo apt-get purge virtualbox*
以删除所有文件 - 检查是否还有剩余
dpkg -l | grep virtualbox
- (我不得不)移除
sudo apt-get purge unity-scope-virtualbox
添加 Virtualbox 的存储库(使用易于安装)
sudo nano /etc/apt/sources.list
- 添加行
deb https://download.virtualbox.org/virtualbox/debian xenial contrib
- 添加密钥
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
sudo apt-get update
安装最新的virtualbox
- 跑步
sudo apt-get install virtualbox-5.2
- 运行
sudo /sbin/vboxconfig
以重建设置
我遇到的问题
您可能需要毁掉您的盒子并重新建造。
Vagrant 用户问题
The VirtualBox VM was created with a user that doesn't match the
current user running Vagrant. VirtualBox requires that the same user
be used to manage the VM that was created. Please re-run Vagrant with
that user. This is not a Vagrant issue.
删除 .vagrant 文件夹rm -rf .vagrant
即可解决这个问题。
虚拟机名称重复问题
The name of your virtual machine couldn't be set because VirtualBox
is reporting another VM with that name already exists. Most of the
time, this is because of an error with VirtualBox not cleaning up
properly. To fix this, verify that no VMs with that name do exist
(by opening the VirtualBox GUI). If they don't, then look at the
folder in the error message from VirtualBox below and remove it
if there isn't any information you need in there.
VBoxManage: error: Could not rename the directory
由于错误导致无法完成,我遇到了 Virtualbox 名称重复的问题vagrant up
。只需删除 Virtualbox VMs 文件夹中的文件夹并通过 GUI 即可。
机器索引问题
这就是我的冒险之旅的开始,也是我通过谷歌来到这里的原因。
The machine index which stores all required information about
running Vagrant environments has become corrupt. This is usually
caused by external tampering of the Vagrant data folder.
Vagrant cannot manage any Vagrant environments if the index is
corrupt. Please attempt to manually correct it. If you are unable
to manually correct it, then remove the data file at the path below.
This will leave all existing Vagrant environments "orphaned" and
they'll have to be destroyed manually.
答案2
经过一段时间的更新,将 Vagrant 更新到 2.0.1,将 VirtualBox 更新到 5.2,我的问题就解决了。
我使用的是 Vagrant 1.9.4 和 VirtualBox 5.0。
答案3
基本上,您需要升级 Virtualbox 和 Vagrant 版本。
Vagrant 很容易更新(我已更新至 2.0.1)
以下是我将 Virtualbox 更新至 5.1 的方法:
sudo apt remove virtualbox-X.X
sudo apt-get purge virtualbox-X.X virtualbox-qt virtualbox-dkms
现在,安装 Virtualbox(重要的是使用 apt 安装)
sudo apt-get install virtualbox-5.1
sudo /sbin/vboxconfig
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-hostsupdater
重新启动并再次构建您的虚拟机
PS: 永远不要使用sudo