Resolve a hostonlyif create error with vagrant
On my freshly installed vagrant + virtualBox macbook, I got this error on my first vagrant up
:
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'Cupcake'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 68 of file VBoxManageHostonly.cpp
The solution is pretty ease :
OSX
sudo /Library/StartupItems/VirtualBox/VirtualBox restart
Linux
sudo modprobe vboxnetadp
Written by Thibault Milan
Related protips
18 Responses
Thanks, this helped me out a lot!
Boom. Exactly what I needed.
Tkx !!!
Thanks! Why does this work?
@mintindeed : Mainly the problem for some reasons virtualbox stop letting vagrant manipulate the network interface. Restarting the virtual box process in osx and just the network manager in linux let vagrant use the command again .
Awesome!
I have to do this command after every reboot of mavericks? Is there any solution?
@ronn235 : I'm afraid not ๐ you just have to run it once, the error should stop occurred after that .
There should be a way to have this as a permanent fix...
@mendrinos : As I said to @ronn235, it still working for me without having to use the command again. I think it's just in case there's a little mess up in the installation / upgrading process regarding network interfaces and not supposed to happened
Thanks. Though worth noting - this only worked after opening Virtualbox.app and deleting/removing some bugged/errant/old VMs. (OS X 10.9)
I'm running this after every reboot as well unfortunately. Mavericks as well.
Try this instead:
sudo chmod +x /Library/StartupItems/VirtualBox/StartupParameters.plist
I noticed that the plist didn't have execute permissions, which explains why it isn't run on startup.
Haven't tried it yet, but I'm guessing it works.
I restart my mac once a blue moon.
Good luck!
For those of you that get "command not found", try:
sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist
Thanks! Had this problem right now. Solved! =)
Thank's!!
OS X 10.9.3 (13D65)
Darwin Kernel Version 13.2.0
Vagrant 1.6.3
sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
Will do.
Running Arch, works awesome