ubuntuvagrantvirtualbox

Vagrant up failing for VirtualBox provider with E_ACCESSDENIED on host-only network


After VirtualBox update vagrant up failing with the following error on Ubuntu:

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", "vboxnet2", "--ip", "10.160.0.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

Used versions:


Solution

  • As of VirtualBox 6.1.28, host-only network adapters are restricted to IPs in the range 192.168.56.0/21 by default (192.168.56.1 -> 192.168.63.254).

    You can tell VirtualBox to allow additional IP ranges by configuring /etc/vbox/networks.conf. For example, to allow anything in the 10.x.x.x range you could use:

    * 10.0.0.0/8
    

    For more info, see the docs at https://www.virtualbox.org/manual/ch06.html#network_hostonly