Vagrant & Virtual box in Windows 10: errors and fixes

Work in porogress..

Running vagrant and Oracle Virtualbox on the new Windows 10 isn’t a smouth experience. This is how you can fix issues related to page loading time etc..

Almasmaris wrote:  I don’t really know how i fixed this but i’m fixed it after doing this:
Uninstall/and Download latest Vagrant (1.7.4) and VirtualBox (5.0.6).

  1. Run with compatibility: Go to the C:\Program Files\Oracle\VirtualBox folder, right click on VirtualBox.exe, go to compatibility, check the “Run in compatibility mode” checkbox and choose Windows 7. Click OK to close the window. Repeat step 2. for VBoxManage.exe and VBoxHeadless.exe
  2. update ‘laravel/homestead’ box if not up to date.
  3. RESTART
  4. run homestead in virtualbox GUI, it worked
  5. testing in cmd, it worked

if the vagrant already running but cannot connect to the site:
1. In Virtualbox preferences -> network -> host-only networks create new Host-Only adapter and add 192.168.10.1 as IP address, So,there are 2 Host-Only adapter with IP 192.168.56.1 and IP 192.168.10.1.
2. Select homestead box in Virtualbox and go to settings -> network -> adapter 2 and select Host-only network (the one created in step above, 192.168.10.1)
3. So, homestead using adapter 1 (NAT) and adapter 2 (host-only)

Here are also some tips to debug slow vagrant box.

 

Folder sharing

Running Vagrant on windows has many limitations:

  • Using SMB needs the command to be run on elevated privileges which opens a security hole in terms of getting infected by viruses! I had a ransom-ware hidden on one of the projects I was working on and had windows defender installed.. Once I run the CLI as admin I opened the door to this virus and ended up formatting my whole machine to remove it!
  • Installed AVG but have to stop it each time when I start the machine

Killing the process

Cannot start the machine as a process is using it

tasklist /fi "Imagename eq vboxsvc.exe"

tasklist /fi "Imagename eq ruby.exe"

taskkill /PID 13192 /f  

 

Finally a fix for the VirtualBox Guest Additions warning.

https://github.com/dotless-de/vagrant-vbguest

 

Memory issues

If you face memory issues when running some php commands (example of composer update) then you need to create some swap files:

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 && sudo /sbin/mkswap /var/swap.1 && sudo /sbin/swapon /var/swap.1

Failed to open a session for the virtual machine

Do a vagrant halt then kill the processes named “Vbox Interface” or “Vbox manage” and try again. If not, then just check if an update version of the VIrtualBox is available and install it: this fixed the issue for me.