Last Updated: February 21, 2022
·
42.36K
· clawfire

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

18 Responses
Add your response

Thanks, this helped me out a lot!

over 1 year ago ·

Boom. Exactly what I needed.

over 1 year ago ·

Tkx !!!

over 1 year ago ·

Thanks! Why does this work?

over 1 year ago ·

@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 .

over 1 year ago ·

Awesome!

over 1 year ago ·

I have to do this command after every reboot of mavericks? Is there any solution?

over 1 year ago ·

@ronn235 : I'm afraid not ๐Ÿ˜ƒ you just have to run it once, the error should stop occurred after that .

over 1 year ago ·

There should be a way to have this as a permanent fix...

over 1 year ago ·

@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

over 1 year ago ·

Thanks. Though worth noting - this only worked after opening Virtualbox.app and deleting/removing some bugged/errant/old VMs. (OS X 10.9)

over 1 year ago ·

I'm running this after every reboot as well unfortunately. Mavericks as well.

over 1 year ago ·

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!

over 1 year ago ·

For those of you that get "command not found", try:

sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist

over 1 year ago ·

Thanks! Had this problem right now. Solved! =)

over 1 year ago ·

Thank's!!

over 1 year ago ·

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.

over 1 year ago ·

Running Arch, works awesome

over 1 year ago ·