knahdiya
knahdiya

Reputation: 251

E_ACCESSDENIED when creating a host-only interface on virtualbox via vagrant

When attempting to run vagrant up after upgrading to VirtualBox 6.1.28, the following error message is received

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "ipconfig", "vboxnet0", "--ip", "192.168.33.1", "--netmask", "255.255.255.0"]

Stderr: VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp

Upvotes: 25

Views: 43115

Answers (3)

Michael Ambrose
Michael Ambrose

Reputation: 1060

Follow-up: This is due to a change that Virtual Box recently introduced where the available IP range for hostonly networks is limited unless you manually override it in a config file in VirtualBox.

Vagrant just merged a change that looks for this to be able to provide a better error message when you try to use an IP outside the configured allowed range: github.com/hashicorp/vagrant/pull/12564

The proper fix is to update /etc/vbox/networks.conf per https://www.virtualbox.org/manual/ch06.html#network_hostonly

Original: I'm having the same issue on Arch on VirtualBox 6.1.28. It does not seem to be related to Vagrant.

Weirdly enough I can change the IPv4 address of the adapter (either via VBoxManage or the GUI) but only between 192.168.56.1 and 192.168.63.254. anything outside this range fails.


It's easy to get tripped up on the fact that the lines you put in /etc/vbox/networks.conf have to start with * like so:

      * 0.0.0.0/0 ::/0

or:

      * 10.0.0.0/8 192.168.0.0/16
      * 2001::/64

In the documentation it's easy to mistake the literal * chars for bullet points.

A simple one-liner to disable this "feature" entirely:

echo "      * 0.0.0.0/0 ::/0" | sudo tee -a /etc/vbox/networks.conf

Upvotes: 52

jaqque
jaqque

Reputation: 126

I see this exact error on macOS Monterey (12.0.1), Vagrant (2.2.18), VirtualBox (6.1.28 r147628). I had to manually enable the kernel extensions

sudo kextload -b org.virtualbox.kext.VBoxDrv
sudo kextload -b org.virtualbox.kext.VBoxNetFlt
sudo kextload -b org.virtualbox.kext.VBoxNetAdp
sudo kextload -b org.virtualbox.kext.VBoxUSB

from here

Bringing up the machine in the GUI, stoping it, then running vagrant up worked, with setting gui to true.

Upvotes: 6

OpControl
OpControl

Reputation: 21

I ran into this issue on CentOS 7 with vagrant version 2.2.13 and VirtualBox version 6.1.28. I downgraded VirtualBox to 6.1.26 and that seemed to fix the issue:

$ sudo yum downgrade VirtualBox-6.1.x86_64

Upvotes: 2

Related Questions