I have a brand new server and I just installed VirtualBox and Vagrant. If I try to set up a private network, I get the following error:
vagrant@zg-2:~/vms/zg2t1$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/focal64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/focal64' version '20220311.0.0' is up to date...
==> default: Setting the name of the VM: zg2t1_default_1647172062563_66694
==> default: Clearing any previously set network interfaces...
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: VBoxNetAdpCtl: ioctl failed for /dev/vboxnetctl: Cannot allocate memory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 95 of file VBoxManageHostonly.cpp
I'm using the following versions:
Ubuntu 20.04.4 LTS
virtualbox 6.1.32-dfsg-1~ubuntu1.20.04.1
vagrant 2.2.19
My Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.hostname = "zg2t1.softxs.ch"
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--name", "zg2t1"]
v.customize ["modifyvm", :id, "--memory", "3072"]
v.customize ["modifyvm", :id, "--cpus", "1"]
# Basebox ubuntu/xenial64 comes serial port configured, switch it off
# See https://github.com/joelhandwell/ubuntu_vagrant_boxes/issues/1
v.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
config.vm.network :private_network, ip: "172.16.2.2", netmask: "255.240.0.0"
config.vm.network :forwarded_port, guest: 22, host: 20202
end
Note that if I remove the line config.vm.network :private_network
, the VM starts normally. But I need the private network.
I have the following virtualbox modules loaded:
vboxnetadp 28672 0
vboxnetflt 28672 0
vboxdrv 499712 2 vboxnetadp,vboxnetflt
It is suspicious to me, that no vboxnet0 is in the output of ifconfig.
What is the problem?