terra-farm / terraform-provider-virtualbox

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

Provided example is giving - Nonexistent host networking interface, name 'en0' (VERR_INTERNAL_ERROR) #25

Closed mjbright closed 6 years ago

mjbright commented 6 years ago

Terraform v0.11.5

Using provider.virtualbox built with go1.9.2 built from current source sha: 0e9684559f533ccd9bb62dba077ca0237e880b03

Using 5.2.8-121009~Ubuntu~xenial.

Running TF_LOG=1 terraform apply gives:

2018-04-03T19:13:39.280+0200 [DEBUG] plugin.terraform-provider-virtualbox: pid-6636-vbm.go:45: executing: VBoxManage startvm node-01 --type headless
2018-04-03T19:13:39.474+0200 [DEBUG] plugin.terraform-provider-virtualbox: pid-6636-resource_vm.go:333: [ERROR] Start VM: exit status 1

Running VBoxManage startvm node-01 --type headless

gives:

Waiting for VM "node-01" to power on...
VBoxManage: error: Nonexistent host networking interface, name 'en0' (VERR_INTERNAL_ERROR)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole
mjbright commented 6 years ago

I tried booting up the same box using vagrant and the network interface was eth0.

I tried modifying the network interface to eth0 in the example.tf and after cleanup I re-applied but got the same error message

VBoxManage: error: Nonexistent host networking interface, name 'eth0' (VERR_INTERNAL_ERROR)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

What determines the device name ... the virtual NIC driver I suppose, so why am I not using the correct driver?

This is what I'm seeing in the log: network_adapter.0.device: "" => "IntelPro1000MTServer"

Should I be forcing another device type, or device name?

mjbright commented 6 years ago

I booted up the vagrant box again to see what dmesg reports, looks to be the same NIC:

[ 1.965248] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:bd:94:b9 [ 1.967055] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection

mjbright commented 6 years ago

Oops, OK I got it.

I need to set host_interface to the device of my host machine as this is bridged mode.