Platform: OpenIndiana Hipster
Vagrant : 2.2.19dev
When a Vagrantfile adds an internal network, vagrant up gives the following 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: Oracle VM VirtualBox Command Line Management Interface Version 6.1.22 (C) 2005-2021 Oracle Corporation All rights reserved. Usage: VBoxManage hostonlyif ipconfig <name> [--dhcp | --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] | --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]] Syntax error: Unknown sub-command 'create'
I would like to ask for a better error message !
If you search for the above error, you’ll find that it is very common and many platforms suffer from it.
It seems to be a generic “something is wrong with the internal network” error.
In my case on OpenIndiana I managed to solve it as follows:
Use the command:
VBoxManage list hostonlyifs
This prints on default OpenIndiana install a vboxnet0 adapter with default address 192.168.56.1/24 , the default host network predefined.
Now if the Vagrantfile tries to assign an ip such as 192.168.99.1 then apparently it tries to use VBoxManage hostonlyif create which doesn’t work.
If in VirtualBox - prior to running ‘vagrant up’ - I reconfigure the Host Network (from the menu) and change 192.168.56.0/24 to 192.168.99.0/24 then the network exists.
If I then run “vagrant up” it does not attempt to VBoxManage hostonlyif create because apparently it finds the 192.168.99.0/24 network and uses it.
And all is fine then, it correctly uses the (pre-existing) hostonlyif network.
So basically I predefine the internal networks in VirtualBox and then Vagrantfile internal_network can use it.
Would it be difficult to make Vagrant for VirtualBox just print an error like “Unable to find the internal network” instead of the mysterious “VBoxManage hostonlyif create” failed ?