22

Every time I run vagrant up, ubuntu 16.04 freezes and I have to restart it.

I can't event run vagrant up --debug.

I am using widgetbox-php53 box.

4
18

So, I had the same problem freezing at booting VM using Ubuntu 16.04 LTS.

And to solve this in some steps with a lot of hard resets - I've updated to Vagrant 2.0.1 and VirtualBox 5.2.

Check what versions you have:

  • vagrant -v (opened the GUI: Help --> About)
  • virtualbox -v

Vagrant

  1. Remove old index and index.lock files in folder /home/USER/.vagrant.d/data/machine-index/
  2. Download Vagrant 2.0.1 https://www.vagrantup.com/downloads.html
  3. install package sudo dpkg -i vagrant_2.0.1_x86_64.deb

Virtualbox

Remove the current virtualbox

  1. run sudo apt-get purge virtualbox* to remove all files
  2. Check if anything is left dpkg -l | grep virtualbox
  3. (I had to) remove sudo apt-get purge unity-scope-virtualbox

Add repository for Virtualbox (use apt to install)

  • sudo nano /etc/apt/sources.list
  • Add the line deb https://download.virtualbox.org/virtualbox/debian xenial contrib
  • Add key wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
  • sudo apt-get update

Install latest virtualbox

  1. run sudo apt-get install virtualbox-5.2
  2. run sudo /sbin/vboxconfig to rebuild the settings

Issues I had

You probably need to destroy your box and build again.

Vagrant user issue

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.

Removed the .vagrant folder rm -rf .vagrant to solve that.

Duplicated VM names issue

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.

I had issues with duplicated Virtualbox names as VBoxManage: error: Could not rename the directory error prevented vagrant up from finishing. Just removed the folders in my Virtualbox VMs folder and through the GUI.

Machine index issue

This is what started my adventure and got me here from Googling.

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
  • 2
    This is by far the best and most explanatory answer. Thank you so much.
    – arximughal
    Jan 22 '18 at 21:06
  • These steps worked perfectly for me! I actually didn't even have the issues which were were reported at the end of this answer. Jan 31 '18 at 14:28
16

After a while updating Vagrant to 2.0.1 and VirtualBox to 5.2, it solved the problem for me.

I was using Vagrant 1.9.4 and VirtualBox 5.0.

4
  • Also fixed it for me. Had to destroy and re-up my boxes though...
    – Robin
    Jan 12 '18 at 10:32
  • +1, though I found that upgrading my Vagrant didn't help, but upgrading VirtualBox to 5.2.4 helped. I also had to run sudo apt-get remove on any virtualbox- programs and also run sudo /sbin/vboxconfig after upgrading VirtualBox.
    – Ethan
    Jan 12 '18 at 22:16
  • Also, it's important to install with apt by manually adding the repo source instead of downloading the .deb file Jan 15 '18 at 17:23
  • While not really a Vagrant issue (it seems that it is a VirtualBox issue), here is a thread on GitHub discussing this problem and the fix: github.com/hashicorp/vagrant/issues/9407 Mar 22 '18 at 14:00
4

Basically, you need to upgrade the Virtualbox and Vagrant version.

Vagrant is easy to update (I updated to 2.0.1)

Here is how I updated the Virtualbox(more or less) to 5.1:

sudo apt remove virtualbox-X.X
sudo apt-get purge virtualbox-X.X virtualbox-qt virtualbox-dkms

Now, install the Virtualbox(it's important to install with 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

Restart and build your VM again

PS: Never build vagrant with sudo

Not the answer you're looking for? Browse other questions tagged or ask your own question.