I am a big fan of Vagrant. I first discovered Vagrant when I was looking for ways of creating a development environment that I could transfer between various computers (I had a desktop and laptop I regularly worked on). I even toyed with the idea of installing a Linux distro on a fast USB 3 stick to carry around. It was then, while in my search for the perfect development environment that I discovered Vagrant. However, I haven’t got Vagrant on Windows 10 working until now.
Vagrant was working fine the last time I used it, mainly for WordPress theme development. I haven’t touched it for about 6 months now but after typing vagrant up and waiting I was soon greeted with this:
VBoxManage.exe: error: Failed to create the host-only adapter VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available) VBoxManage.exe: error: Context: "int __cdecl handleCreate(struct HandlerArg *,int,int *)" at line 66 of file VBoxManageHostonly.cpp
Not really what you want to see when you are just starting to get back into something. Naturally, I did what every respectable software developer does when they get an error they haven’t seen before 🙂. It turns out the cause seems to be Windows 10 and a problem with VirtualBox.
First, I upgraded both VirtualBox and Vagrant, so I am now running VirtualBox 5.0.10 r104061 and Vagrant 1.7.4. I did a Vagrant up and got the same error.
I found the following ticket on VirtualBox’s website and downloaded the workaround app VBox-Win10-fix-14040.exe. This has to be run as Administrator and left running while your VM is being set up.
Doing this gave me a slightly different error:
Command: ["hostonlyif", "ipconfig", "VirtualBox Host-Only Ethernet Adapter #7", "--ip", "192.168.56.1", "--netmask", "255.255.255.0"] Stderr: VBoxManage.exe: error: The host network interface with the given name could not be found VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component Host, interface IHost, callee IUnknown VBoxManage.exe: error: Context: "FindHostNetworkInterfaceByName(name.raw(), hif.asOutParam())" at line 218 of file VBoxManageHostonly.cpp VBoxManage.exe: error: Could not find interface 'VirtualBox Host-Only Ethernet Adapter #7'
Thinking it could be a permission issue I then set vagrant to run as an administrator in the compatibility settings for the executable and ran the vagrant up in an admin console, in addition to having the above workaround exe running and that did the trick.
If you are interested I use a slightly modified version of vagrantpress with nodejs added. You can find it on my GitHub page.
Update: This has been fixed in the latest VirtualBox test build which can be downloaded from here. I am currently using VirtualBox 18.104.22.168704 but any build later than that should work. You also don’t need to run as an administrator unless you are running something like vagrant hostupdater that needs admin access to write to the host file.