terra-farm / terraform-provider-virtualbox

VirtualBox provider for Terraform
https://terra-farm.github.io/provider-virtualbox/
MIT License
327 stars 133 forks source link

[ERROR] Clone *.vdi and *.vmdk to VM folder: exit status 1 #33

Closed bkmeneguello closed 5 years ago

bkmeneguello commented 6 years ago

Host Linux Mint 19 Terraform v0.11.8 terraform-provider-virtualbox: v.0.1.2 Virtualbox 5.2.18 r124319

resource "virtualbox_vm" "node" {

  name = "${format("node-%02d", count.index+1)}"

  image = "./virtualbox.box"
  url = "https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20180903.0.0/providers/virtualbox.box"
  cpus = 2
  memory = "2GB"

  network_adapter {
    type = "nat"
  }
}
2018/09/06 11:35:22 [INFO] Terraform version: 0.11.8  7a5c1d221ac209bbac66947c369815cd9ca70ed5
2018/09/06 11:35:22 [INFO] Go runtime version: go1.10.1
2018/09/06 11:35:22 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply", "-input=false", "tfplan"}
2018/09/06 11:35:22 [DEBUG] Attempting to open CLI config file: /home/bruno/.terraformrc
2018/09/06 11:35:22 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/09/06 11:35:22 [INFO] CLI command args: []string{"apply", "-input=false", "tfplan"}
2018/09/06 11:35:22 [INFO] command: initializing local backend from plan (not set)
2018/09/06 11:35:22 [DEBUG] checking for provider in "."
2018/09/06 11:35:22 [DEBUG] checking for provider in "/usr/local/bin"
2018/09/06 11:35:22 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64"
2018/09/06 11:35:22 [DEBUG] checking for provider in "/home/bruno/.terraform.d/plugins"
2018/09/06 11:35:22 [DEBUG] checking for provider in "/home/bruno/.terraform.d/plugins/linux_amd64"
2018/09/06 11:35:22 [WARN] found legacy provider "terraform-provider-virtualbox"
2018/09/06 11:35:22 [DEBUG] found valid plugin: "virtualbox", "0.0.0", "/home/bruno/.terraform.d/plugins/linux_amd64/terraform-provider-virtualbox"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "."
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "/usr/local/bin"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in ".terraform/plugins/linux_amd64"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "/home/bruno/.terraform.d/plugins"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "/home/bruno/.terraform.d/plugins/linux_amd64"
2018/09/06 11:35:22 [INFO] command: backend initialized: *local.Local
2018/09/06 11:35:22 [DEBUG] checking for provider in "."
2018/09/06 11:35:22 [DEBUG] checking for provider in "/usr/local/bin"
2018/09/06 11:35:22 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64"
2018/09/06 11:35:22 [DEBUG] checking for provider in "/home/bruno/.terraform.d/plugins"
2018/09/06 11:35:22 [DEBUG] checking for provider in "/home/bruno/.terraform.d/plugins/linux_amd64"
2018/09/06 11:35:22 [WARN] found legacy provider "terraform-provider-virtualbox"
2018/09/06 11:35:22 [DEBUG] found valid plugin: "virtualbox", "0.0.0", "/home/bruno/.terraform.d/plugins/linux_amd64/terraform-provider-virtualbox"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "."
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "/usr/local/bin"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in ".terraform/plugins/linux_amd64"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "/home/bruno/.terraform.d/plugins"
2018/09/06 11:35:22 [DEBUG] checking for provisioner in "/home/bruno/.terraform.d/plugins/linux_amd64"
2018/09/06 11:35:22 [INFO] backend/local: starting Apply operation
2018/09/06 11:35:22 [INFO] terraform: building graph: GraphTypeApply
emoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "image":*terraform.ResourceAttrDiff{Old:"", New:"./virtualbox.box", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "url":*terraform.ResourceAttrDiff{Old:"", New:"https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20180903.0.0/providers/virtualbox.box", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "network_adapter.0.ipv4_address_available":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}
2018/09/06 11:35:22 [DEBUG] Resource state not found for "virtualbox_vm.node": virtualbox_vm.node
2018/09/06 11:35:22 [DEBUG] resource virtualbox_vm.node using provider provider.virtualbox
2018/09/06 11:35:22 [DEBUG] ReferenceTransformer: "virtualbox_vm.node" references: []
2018/09/06 11:35:22 [DEBUG] ReferenceTransformer: "provider.virtualbox" references: []
2018/09/06 11:35:22 [DEBUG] Starting graph walk: walkApply
2018-09-06T11:35:22.664-0300 [DEBUG] plugin: starting plugin: path=/home/bruno/.terraform.d/plugins/linux_amd64/terraform-provider-virtualbox args=[/home/bruno/.terraform.d/plugins/linux_amd64/terraform-provider-virtualbox]
2018-09-06T11:35:22.665-0300 [DEBUG] plugin: waiting for RPC address: path=/home/bruno/.terraform.d/plugins/linux_amd64/terraform-provider-virtualbox
2018-09-06T11:35:22.672-0300 [DEBUG] plugin.terraform-provider-virtualbox: plugin address: timestamp=2018-09-06T11:35:22.672-0300 address=/tmp/plugin658649940 network=unix
virtualbox_vm.node: Creating...
  cpus:                                     "" => "2"
  image:                                    "" => "./virtualbox.box"
  memory:                                   "" => "2GB"
  name:                                     "" => "node-01"
  network_adapter.#:                        "" => "1"
  network_adapter.0.device:                 "" => "IntelPro1000MTServer"
  network_adapter.0.ipv4_address:           "" => "<computed>"
  network_adapter.0.ipv4_address_available: "" => "<computed>"
  network_adapter.0.mac_address:            "" => "<computed>"
  network_adapter.0.status:                 "" => "<computed>"
  network_adapter.0.type:                   "" => "nat"
  status:                                   "" => "running"
  url:                                      "" => "https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20180903.0.0/providers/virtualbox.box"
2018-09-06T11:35:23.751-0300 [DEBUG] plugin.terraform-provider-virtualbox: pid-25036-vbm.go:60: executing: VBoxManage list vms
2018-09-06T11:35:23.819-0300 [DEBUG] plugin.terraform-provider-virtualbox: pid-25036-vbm.go:45: executing: VBoxManage createvm --name node-01 --register --basefolder /home/bruno/.terraform/virtualbox/machine
2018-09-06T11:35:23.917-0300 [DEBUG] plugin.terraform-provider-virtualbox: pid-25036-vbm.go:75: executing: VBoxManage showvminfo node-01 --machinereadable
2018-09-06T11:35:24.005-0300 [DEBUG] plugin.terraform-provider-virtualbox: pid-25036-vbm.go:45: executing: VBoxManage clonehd /home/bruno/.terraform/virtualbox/gold/virtualbox/ubuntu-bionic-18.04-cloudimg-configdrive.vmdk /home/bruno/.terraform/virtualbox/machine/node-01/ubuntu-bionic-18.04-cloudimg-configdrive.vmdk
2018-09-06T11:35:24.078-0300 [DEBUG] plugin.terraform-provider-virtualbox: pid-25036-vbm.go:45: executing: VBoxManage clonehd /home/bruno/.terraform/virtualbox/gold/virtualbox/ubuntu-bionic-18.04-cloudimg.vmdk /home/bruno/.terraform/virtualbox/machine/node-01/ubuntu-bionic-18.04-cloudimg.vmdk
2018-09-06T11:35:24.149-0300 [DEBUG] plugin.terraform-provider-virtualbox: pid-25036-resource_vm.go:247: [ERROR] Clone *.vdi and *.vmdk to VM folder: exit status 1
2018/09/06 11:35:24 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* virtualbox_vm.node: exit status 1
2018/09/06 11:35:24 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* virtualbox_vm.node: exit status 1
2018/09/06 11:35:24 [TRACE] [walkApply] Exiting eval tree: virtualbox_vm.node
2018/09/06 11:35:24 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2018/09/06 11:35:24 [TRACE] dag/walk: upstream errored, not walking "provider.virtualbox (close)"
2018/09/06 11:35:24 [TRACE] dag/walk: upstream errored, not walking "root"

Error: Error applying plan:

1 error(s) occurred:

* virtualbox_vm.node: 1 error(s) occurred:

* virtualbox_vm.node: exit status 1

Terraform does not automatically rollback in the face of errors.
2018/09/06 11:35:24 [DEBUG] plugin: waiting for all plugin processes to complete...
Instead, your Terraform state file has been partially updated with
2018-09-06T11:35:24.158-0300 [DEBUG] plugin.terraform-provider-virtualbox: pid-25036-rpc_server.go:48: [ERR] plugin: plugin server: accept unix /tmp/plugin658649940: use of closed network connection
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
bkmeneguello commented 6 years ago

It works with trusty64 from example (the same script)

qmfrederik commented 6 years ago

I would guess this is because the boxes contain two hard disks, not one. The https://vagrantcloud.com/geerlingguy/boxes/ubuntu1804/versions/1.0.4/providers/virtualbox.box box seems to work better.

VoyTechnology commented 5 years ago

@bkmeneguello Are you still having this problem or can I close?

bkmeneguello commented 5 years ago

I'm not using it anymore.

Kraktorist commented 2 years ago

Just bumped into the same error. I found the remains of the previously deleted machine with the same name in the VirtualBox config ~/.config/VirtualBox/VirtualBox.xml. After removal those entries from the config the issue is gone.

JoaoPedro-Correia commented 3 weeks ago

I would guess this is because the boxes contain two hard disks, not one. The https://vagrantcloud.com/geerlingguy/boxes/ubuntu1804/versions/1.0.4/providers/virtualbox.box box seems to work better.

Thanks. Helped me a lot!