VBoxManage: error: Failed to create the host-only adapter

167,242

Solution 1

I had the same problem today. The reason was that I had another VM running in VirtualBox.

Solution:

  1. Open VirtualBox and shut down every VM running
  2. Go to System Preferences > Security & Privacy Then hit the "Allow" button to let Oracle (VirtualBox) load.
  3. Restart VirtualBox
sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart

You should now be able to run vagrant up or vagrant reload and have your new host configured.

As mentioned in this answer, recent versions of macOS can block VirtualBox.

Solution:

Go to System Preferences > Security & Privacy Then hit the "Allow" button to let Oracle (VirtualBox) load.

(thanks to @pazhyn, @lsimonetti & @dave-beauchesne for clarifications)

Solution 2

For Mac OS X 10.9.3 and Vagrant 1.6.3 and VirtualBox 4.3.6 this problem was fixed with restarting the VirtualBox

sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart

Solution 3

TL;DR MacOS is probably blocking VirtualBox. Go to System Preferences > Security & Privacy Then hit the "Allow".

Solution: Go to System Preferences > Security & Privacy Then hit the "Allow" button to let Oracle (VirtualBox) load.

MacOS by default can block kexts from loading. You must click the "allow" button before executing the VirtualBoxStartup.sh script.

Then run: sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart like the answer above.

(This article provides more clarity to MacOS kernel extension loading)

Solution 4

This issue appears to be fixed by installing the latest version of Virtual Box.

Solution 5

Got the error in Mac after the update to Mojave. Probably you have an older version of virtual box.

Update to a recent version of virtualbox. (5.2 at the time of wrting this post)

Edit: adding @lsimonetti's comment.

In addition to that upgrade to Virtualbox 5.2, you need Vagrant >= 2.0.1

Share:
167,242

Related videos on Youtube

Adi
Author by

Adi

Turning insomniac nights into code since 4 years.

Updated on July 08, 2022

Comments

  • Adi
    Adi almost 2 years

    I am running vagrant 1.4 and virtual box 4.3 on fedora 17 machine. When I do "vagrant up", I get this error:

    Bringing machine 'default' up with 'virtualbox' provider...                                                                            
    
    
    [default] Clearing any previously set forwarded ports...                                                                                                                
    [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: VBoxNetAdpCtl: ioctl failed for /dev/vboxnetctl: Inappropriate ioctl for devic
    VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
    VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 66 of file VBoxManageHostonly.cpp
    
    • Jeff Sisson
      Jeff Sisson over 10 years
      you're running vagrant from fedora or that's your vagrant box os?
    • Yuan He
      Yuan He about 10 years
      I have the same issue and running vagrant on OS X, is that the problem of virtual box?
    • totophe
      totophe over 7 years
      @adi could you validate the right answer? Tks
  • Steve Bennett
    Steve Bennett about 10 years
    Confirming this works on my Mac. Shutting down other VMs isn't sufficient, but restarting VB works.
  • Erich
    Erich almost 10 years
    Also worked for me, VirtualBox UI showed no VMs up, but restarting resolved the problem. Perhaps vagrant halt didn't finish successfully the last time.
  • Ashwin Balamohan
    Ashwin Balamohan almost 10 years
    Worked perfectly! Thanks
  • jamesplease
    jamesplease over 9 years
    This answer assumes, I guess, that VirtualBox is in your StartupItems. If it isn't, see @pazhyn's answer below, which seems to be more general & worked for me.
  • amateur barista
    amateur barista over 9 years
    Does not work, virtualbox by default does not install at this location. I know mine is a default install and is not located in StartupItems. Please see @pazhyn answer below. Thanks!
  • amateur barista
    amateur barista over 9 years
    Works for me, VirtualBox 4.3.18, OS X 10.9.3. Thanks!
  • totophe
    totophe over 9 years
    @amateurbarista I've a default installation of VirtualBox and this work, as confirmed before by others, so your assertion is not correct. Although, I've also added the more common pattern, as this solution assumes VB is started with the system.
  • Dr.jacky
    Dr.jacky about 9 years
    @totophe What about windows?!
  • totophe
    totophe about 9 years
    @Mr.Hyde On Windows, you should just restart the virtual machines from VirtualBox and maybe restart VirtualBox itself.
  • DevAnimal
    DevAnimal over 8 years
    My case is Vagrant 1.7.4+Virtualbox 5.0+Windows 10 build 10240. Version 5.01 fix the issue.
  • jaguililla
    jaguililla over 8 years
    vboxreload does not exist. Neither vbox
  • Tihomir Meščić
    Tihomir Meščić almost 8 years
    Thanks for this. I had the same issue.
  • user1501382
    user1501382 over 7 years
    Thanks for this. I was using Virtual Box on windows and had exactly same issue. Your hint of checking preferences of network helped me solve this issue.
  • Rubinum
    Rubinum about 7 years
    service not found :( although virtual box is installed.
  • George D.
    George D. over 6 years
    would running parallels also be an issue causing this error?
  • totophe
    totophe about 6 years
    @GeorgeD. Not to my knowledge
  • Nick DuBois
    Nick DuBois about 6 years
    My local env just stopped responding. Could not get vagrant up. remove and installed vbox fixed whatever was the issue. Thanks
  • Srdjan Marjanovic
    Srdjan Marjanovic over 5 years
    Worked for me! Thanks
  • lsimonetti
    lsimonetti over 5 years
    In addition to that upgrade to Virtualbox 5.2, you need Vagrant >= 2.0.1 github.com/hashicorp/vagrant/blob/v2.1.5/…
  • Bahman.A
    Bahman.A over 5 years
    For any one having the same question on: Mac OS 10.13 + vagrant 2.2.0 + VirtualBox 5.2.20 this worked perfectly for me. Thank you so much!
  • trainoasis
    trainoasis over 4 years
    Had to do this and then click "Allow" in System preferences as mentioned by some other answers. Without this, the "Allow" did not appear even.
  • daneczech
    daneczech over 4 years
    MacOS by default can block kexts from loading. You must click the "allow" button before executing the VirtualBoxStartup.sh script. That was the issue for me ! Thanks!
  • Redas Jarušaitis
    Redas Jarušaitis about 4 years
    Worked for me. OS X with VirtualBox 6.0 and Vagrant 2.2.7
  • Dave Hodgkinson
    Dave Hodgkinson about 4 years
    Yes. Destorying the previous VM didn't do it for me.
  • wowkalucky
    wowkalucky almost 4 years
    Confirmed on: - Catalina 10.15.5 (19F101), - Vagrant 2.2.9, Virtualbox v6.0.22
  • muya_
    muya_ over 3 years
    On macOS BigSur (11.0.1) I had to update Virtualbox to the latest version before getting the prompt on System Preferences > Security & Privacy > General to "Allow". A system restart was also required after allowing.
  • Golinmarq
    Golinmarq about 3 years
    Where do I set the allow?
  • Mirko
    Mirko about 3 years
    Big Sur, system pref -> security & privacy -> general -> unlock to make changes -> advanced -> approve and reboot
  • Adam
    Adam almost 3 years
    The main answer is correct, HOWEVER .... this post does say to reinstall VirtualBox which is what helped Apple recognize and re-approve the security preferences for me.
  • Eliseu Monar dos Santos
    Eliseu Monar dos Santos over 2 years
    Yep, just restarting my Mac fixed it, thanks! (from 11.5.1 to 11.5.2)
  • Julesezaar
    Julesezaar over 2 years
    The first vagrant up normally provisions itself... And running the provision again can mess everything up. Provisioning is often not written to run twice (not idempotent), so it will execute things again. That is always very dangerous unless you have written everything so well that it can run multiple times
  • monas
    monas over 2 years
    That Allow access thing won't be shown after the update, only after install I guess. But the command does the job on Big Sur 11.5 and 11.6. One note - after that command I also had to do the restart.
  • Pathros
    Pathros over 2 years
    Thanks. More about how to solve it here.
  • BZC
    BZC over 2 years
    Thanks. It solved the problem on Monterey.
  • Apollo Grace
    Apollo Grace over 2 years
    This did not work for me - apparently the various shutdowns didn't work It says things like "Unloading VBoxUSB.kext", but then later it says "Error: VBoxUSB.kext is already loaded".
  • Samuel Lindblom
    Samuel Lindblom about 2 years
    I never got the "Approve" button in Security & Privacy settings, despite following all advice. An extra restart solved it. Restart after each fix that you try, to save some headache.