Ubuntu 16.04 在 vagrant up 上冻结

Ubuntu 16.04 在 vagrant up 上冻结

每次运行时vagrant up,ubuntu 16.04 都会冻结,我必须重新启动它。

我甚至不能跑vagrant up --debug

我在用widgetbox-php53盒子。

答案1

booting VM因此,我在使用时也遇到了同样的问题Ubuntu 16.04 LTS

为了通过多次硬重置解决此问题,我已更新为Vagrant 2.0.1VirtualBox 5.2

检查你拥有的版本:

  • vagrant -v(打开 GUI:帮助 --> 关于)
  • virtualbox -v

流浪汉

  1. 删除文件夹中的旧文件indexindex.lock/home/USER/.vagrant.d/data/machine-index/
  2. 下载 Vagrant 2.0.1https://www.vagrantup.com/downloads.html
  3. 安装包sudo dpkg -i vagrant_2.0.1_x86_64.deb

虚拟盒

删除当前的虚拟盒

  1. 运行sudo apt-get purge virtualbox*以删除所有文件
  2. 检查是否还有剩余dpkg -l | grep virtualbox
  3. (我不得不)移除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

  1. 跑步sudo apt-get install virtualbox-5.2
  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

相关内容