Vagrant: Guest machine default name too long with VirtualBox 5.2.8 (VERR_CFGM_NOT_ENOUGH_SPACE)

The error

When you try to start a vm with vagrant up, you get the error:

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

Command: ["startvm", "aaaaaaaa-bcccc-e07e-8888-43220fe45e6", "--type", "headless"]

Stderr: VBoxManage: error: The specified string / bytes buffer was to small. Specify a larger one and retry. (VERR_CFGM_NOT_ENOUGH_SPACE)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

Cause After Virtualbox 5.8.2 virtual machine names has a maximum size.

Solution 1

This could be caused by the virtualbox kernel modules loaded are not matching the virtualbox client/UI version installed:

sudo /sbin/vboxconfig

You can also try to execute vboxreload

Solution 2

You can try to do a clean install of virtualbox with:

sudo dpkg -l | grep virtualbox
sudo dpkg --purge <package name>

Where are the packages listed by the previous command. Then you can install the new version of virtualbox.

Solution 4

You could try to remove the package virtualbox-dkms and then reinstall virtualbox-dkms:

sudo apt-get autoremove virtualbox-dkms
sudo apt-get install build-essential linux-headers-`uname -r` dkms virtualbox-dkms

Solution 3

Change your Vagrantfile on the virtualbox provider block, add the following line:

vb.customize ["modifyvm", :id, "--audio", "none"]