Ubuntu 16.04 Vagrant up error: screen freeze or system hang when running vagrant up


While running Vagrant up in your project folder if your system hang or screen freeze try several solution given below. You can reproduce the same error after starting your virtual machine from terminal and start the same virtual machine using UI.

Solution 1: Switch to latest version and delete existing files of Virtual Box and Vagrant

Step 1: Check which version of Virtual Box and Vagrant you have

Type the following commands in terminal

$ vboxmanage --version
$ vagrant -v

If you are already on latest, we will still recommend re-installation using below steps.

Step 2: Remove existing file of Virtual Box and Install New

a. Type below command to remove all virtual box file

$ sudo apt-get purge virtualbox*
$ sudo apt-get purge unity-scope-virtualbox

b. Add virtual box repository, type in terminal following command

$ sudo nano /etc/apt/sources.list

this will open sources.list file in end  of file paste below

deb https://download.virtualbox.org/virtualbox/debian xenial contrib

c. Type following in terminal, this will return ok.

$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- 
| sudo apt-key add -

d. run sudo update

$ sudo apt-get update

e. Install virtual box

$ sudo apt-get install virtualbox-5.2
$ sudo /sbin/vboxconfig
$ sudo apt-get update
$ sudo apt-get upgrade

Step 3: Remove existing file of Vagrant and Install New

a. Delete index files, replace your username in below command

$ cd /home/YourUserName/.vagrant.d/data/machine-index/
$ rm index*

b. Download Vagrant 2.0.1 https://www.vagrantup.com/downloads.html

c. Type below command to install

$ sudo dpkg -i vagrant_2.0.1_x86_64.deb