21

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
Glenjamin
  • 7,150
  • 6
  • 25
  • 26
knahdiya
  • 211
  • 1
  • 2
  • 4
  • 4
    hey, this is the exact duplicate of https://stackoverflow.com/questions/69722254/vagrant-up-failing-for-virtualbox-provider-on-ubuntu - please don't post twice the same question – Frederic Henri Oct 26 '21 at 18:55
  • I'm not using ubuntu so that solution doesn't work for me. Thanks for trying – knahdiya Oct 26 '21 at 19:55
  • Why would a downgrade not work on your system? How did you try to run vagrant? Has it worked in the past? Did you try to do it as an administrator as the error might indicate insufficient permission to change network settings? – Seth Oct 27 '21 at 16:56
  • This question is marked as closed, but it should really be marked as a duplicate of https://stackoverflow.com/questions/69722254/vagrant-up-failing-for-virtualbox-provider-on-ubuntu – Glenjamin Nov 04 '21 at 17:55

3 Answers3

49

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.

Mitch
  • 23,716
  • 9
  • 83
  • 122
Michael Ambrose
  • 992
  • 6
  • 11
  • Good workaround, thanks. I was using `192.168.22.101` as my box's `private_network` IP, and it was producing that error. It worked when I changed it to `192.168.62.101`. – Jethro Cao Nov 03 '21 at 18:56
  • 3
    @JethroCao This is actually 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 give a better error message when you try to use an IP outside the configured allowed range: https://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 – Michael Ambrose Nov 04 '21 at 16:26
  • @MichaelAmbrose this comment appears to be the correct answer. Would you mind re-posting it as an answer to the question so it can be up-voted and accepted? – Glenjamin Nov 04 '21 at 17:52
  • @Glenjamin good point, I just updated my original answer – Michael Ambrose Nov 04 '21 at 20:34
  • In my first case I had Homestead/Vagrant/Virtualbox setup. I had to change the IP in Homestead.yaml (which defaults to 192.168.10.10) to 192.168.63.10 instead of in /etc/vbox/networks.conf. – PHZ.fi-Pharazon Jan 19 '22 at 11:30
  • In the second case I had Vagrant/Virtualbox setup. I had to change the IP in Vagrantfile from 192.168.222.1 to 192.168.62.1. – PHZ.fi-Pharazon Jan 19 '22 at 11:32
  • 1
    I came across this answer whilst looking to get Docker running on a Mac, and thought it would be worth pointing out that this answer is not just for Vagrant--modifying the `networks.conf` file worked perfectly. – Mark Birbeck Mar 24 '22 at 23:59
  • update netmask range to less cidr range. use 255.255.255.0 instead of 255.255.0.0 – Arvin Jun 29 '22 at 10:32
6

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.

Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
jaqque
  • 61
  • 1
2

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
OpControl
  • 21
  • 2