Multi-VM vagrantfile fails on second machine

0

I'm attempting to manage a suite of VMs with a vagrantfile, and while it's successfully provisioning the first one, it fails on the second, with the following error (username removed):

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

Command: ["import", "\\\\?\\C:\\Users\\{user}\\.vagrant.d\\boxes\\geerlingguy-VAGRANTSLASH-ubuntu1604\\1.2.5\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "packer-ubuntu-16.04-amd64_1551457217364_16812", "--vsys", "0", "--unit", "10", "--disk", "./packer-ubuntu-16.04-amd64-disk001.vmdk"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting \\?\C:\Users\{user}\.vagrant.d\boxes\geerlingguy-VAGRANTSLASH-ubuntu1604\1.2.5\virtualbox\box.ovf...
OK.
0%...
Progress state: E_INVALIDARG
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invalid (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 957 of file VBoxManageAppliance.cpp

Is there an issue with trying to spin up multiple boxes from the same base box? I've googled around the issue for a while but not found anything on my specific error message.

My vagrantfile is:

Vagrant.configure("2") do |config|

  hosts = {
    "webserver" => "52201",
    "webserver-service" => "52202",
    "dbserver" => "52203",
    "lb" => "52204"
  }

  hosts.each do |hostname, port|
    config.vm.define hostname do |node|
      node.vm.box = "geerlingguy/ubuntu1604"
      node.vm.hostname = hostname
      node.vm.network "private_network", type: "dhcp"
      node.vm.network "forwarded_port", guest: 22, host: port, id: "ssh"
      node.vm.provider "virtualbox"
      node.vm.provision "shell", inline: "apt-get install -y acl"
    end
  end
end

I'm using vagrant via WSL, but that's not been an issue in single-VM configurations so I can't see why that would be the problem.

virtualbox
vagrant
asked on Super User Mar 1, 2019 by Beornwulf

1 Answer

1

This was fixed by using

    node.vm.provider "virtualbox" do |vb|
        vb.name = hostname
        vb.linked_clone = true
    end

specifically, I believe the linked_clone configuration was the key, although I couldn't say why exactly.

answered on Super User Mar 4, 2019 by Beornwulf

User contributions licensed under CC BY-SA 3.0