macOS - vagrant up failed, /dev/vboxnetctl: no such file or directory

VirtualboxVagrant

Virtualbox Problem Overview


Can be useful, I found this error. The common solution is reinstall virtualbox but there are a better way.

Solution

sudo /Library/StartupItems/VirtualBox/VirtualBox restart

or

sudo /Library/StartupItems/VirtualBox/VirtualBox start

VirtualBox 4.3+

On recents versions, the file (/Library/StartupItems/VirtualBox/VirtualBox) don't exists, so you need to use the command below:

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

Error

Print: http://d.pr/i/1Bvi

>There was on 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

Vagrant Git issue about the error: https://github.com/mitchellh/vagrant/issues/1671#issuecomment-22304107

Virtualbox Solutions


Solution 1 - Virtualbox

I'm running macOS High Sierra 10.13.1 and VirtualBox 5.2.2.

This worked for me:
  1. Grant permission to VirtualBox under System Preferences > Security & Privacy > General (this request is new to macOS High Sierra)
  2. Open Terminal and run: sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart

Solution 2 - Virtualbox

If your system recently updated the kernel, you many need to rerun the vbox setup again. If this is the case, you will see the following messages when you run virtualbox start command:

$ sudo /path/to/virtualbox start
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (2.6.32-358.23.2.el6.x86_64) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /etc/init.d/vboxdrv setup

         You will not be able to start VMs until this problem is fixed.

Solution 3 - Virtualbox

I had some problems with vbox running on Ubuntu 17.10 when starting a virtual machine with host-only adapted/bridge network. Looking for an answer I found numerous commands that are useful when having that kind of problems. Here they are:

VIRTUAL HOST PROBLEMS

> failed to open /dev/vboxnetctl

vboxnet0 - this is the bad guy who is causing all the trouble.

> VBoxNetAdpCtl: Error while adding new interface: failed to open > /dev/vboxnetctl: No such file or directory.

These commands are not used in particular order. They are just generally useful and problem-solving.

  1. sudo modprobe vboxdrv

  2. sudo modprobe vboxnetadp - (host only interface)

  3. sudo modprobe vboxnetflt - (make vboxnet0 accecible)

IF YOU HAVE PROBLEMS WITH SECURE BOOT RUNNING the FIRST COMMAND I RECOMMEND DISABLING SECURE BOOT IN BIOS (or reboot).

> modprobe: FATAL: Module vboxnetftl not found in directory > /lib/modules/4.13.0-21-generic

(bridge networking)

  1. sudo apt-get install virtualbox-dkms (extension) -> go to command 1 after this

  2. sudo vboxmanage hostonlyif create

These sometimes might work:

I. service --status-all

II service service_name restart

Solution 4 - Virtualbox

This worked for me (macOS Monterey). This reloads all VirtualBox's kernel extensions.

sudo kmutil load -b org.virtualbox.kext.VBoxUSB
sudo kmutil load -b org.virtualbox.kext.VBoxNetFlt
sudo kmutil load -b org.virtualbox.kext.VBoxNetAdp
sudo kmutil load -b org.virtualbox.kext.VBoxDrv

Solution 5 - Virtualbox

Tried above all remedies, few commands although executed, did not work. Nothing is present in my Mac (el captain) of sort /Library/StartupItems/Vir*, and below command failed:

sudo /Library/StartupItems/VirtualBox/VirtualBox restart

Reinstalling latest VirtualBox and then running below command helped me having VM running

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

Solution 6 - Virtualbox

I had a similar problem starting a virtual box on High Sierra.

> macOS High Sierra 10.13 introduces a new feature that requires user approval before loading newly-installed third-party kernel extensions (KEXTs). When a request is made to load a KEXT that the user has not yet approved, the load request is denied. Apps or installers that treat a KEXT load failure as a hard error will need to be changed to handle this new case.

To resolve, you must manually approve the KEXT in System Preferences > Security & Privacy.

Here is the Technical Note from Apple:

https://developer.apple.com/library/content/technotes/tn2459/_index.html

Solution 7 - Virtualbox

I was stuck on this for a while. I kept seeing 'command not found' when trying to run the sudo: /Library.. command.

However, this did work for me:

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

Solution 8 - Virtualbox

RUN

$ sudo modprobe vboxdrv
$ sudo modprobe vboxnetadp
$ sudo vboxreload

Solution 9 - Virtualbox

Thank forks, it worked for me.

  1. Grant permission to VirtualBox under System Preferences > Security & Privacy > General
  2. Throw away /Applications/VirtualBox into the trash
  3. Re-install VirtualBox from your .dmg file

Solution 10 - Virtualbox

When I get the error...

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 following works for me and returns no errors, I am then able to bring vagrant up successfully

sudo /Library/StartupItems/VirtualBox/VirtualBox restart

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLucas SerafimView Question on Stackoverflow
Solution 1 - VirtualboxLinusView Answer on Stackoverflow
Solution 2 - VirtualboxjohnpaulhayesView Answer on Stackoverflow
Solution 3 - VirtualboxPiotr JankiewiczView Answer on Stackoverflow
Solution 4 - VirtualboxX99View Answer on Stackoverflow
Solution 5 - VirtualboxMohammad Shahid SiddiquiView Answer on Stackoverflow
Solution 6 - VirtualboxJohn RView Answer on Stackoverflow
Solution 7 - VirtualboxMicheleView Answer on Stackoverflow
Solution 8 - VirtualboxantikytheratonView Answer on Stackoverflow
Solution 9 - VirtualboxkujiyView Answer on Stackoverflow
Solution 10 - VirtualboxJason PascoeView Answer on Stackoverflow