terra-farm / terraform-provider-virtualbox

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

executable file not found in %PATH% #101

Open nazmang opened 3 years ago

nazmang commented 3 years ago

hi,

got error below when using on Windows 10 and VirtualBox 6.1.18. Lines from Example used.

virtualbox_vm.node[0]: Still creating... [20s elapsed]

Error: [ERROR] Create virtualbox VM node-01: exec: "false": executable file not found in %PATH%

  on cluster.tf line 1, in resource "virtualbox_vm" "node":
   1: resource "virtualbox_vm" "node" {

Error: [ERROR] Create virtualbox VM node-02: exec: "false": executable file not found in %PATH%

  on cluster.tf line 1, in resource "virtualbox_vm" "node":
   1: resource "virtualbox_vm" "node" {

VirualBox directory added to PATH, so which 'executable file' it requires?

VoyTechnology commented 3 years ago

Windows is not currently supported, see #83. But this error to me sounds like somewhere in the code we are calling false command (https://linux.die.net/man/1/false), which possibly comes from

https://github.com/terra-farm/go-virtualbox/blob/698b4798c5b6842af6e9e3630cd94e2c5e6fdb43/vbmgt.go#L34-L41

So my first guess is see if there is VBoxControl.exe in VBOX_INSTALL_PATH path.

VoyTechnology commented 3 years ago

I tested on Windows and I got the same issue. However I saw some progress. My guess is a custom implementation of the code used in go-virtualbox to get the VBoxManage path is somehow bad. I am working on adding a Run command to the go-virtualbox package so that we can use the configured instance to get the data, rather than relying on the custom code.

rneto12 commented 2 years ago

I only got over this error after adding the path directly to Windows and restarting it.

image

BlackS52 commented 2 years ago

rneto12's advise works for me too. But need to reboot Windows to apply these changes.

IliaDimchev commented 1 year ago

Been going through the same issue for the last week, here's the resolution.

Apparently, when VirtualBox is installed in a different than the default folder, we get the PATH saved improperly in our system. It'll look like this: VBOX_MSI_INSTALL_PATH | <Path to VirtualBox>

The solution is to add new PATH to our system: VBOX_INSTALL_PATH | <Path to VirtualBox>

Restart the console application/IDE, in my case, VSCode, and just re-run terraform apply with yes brought up the virtual machine just fine. That's it :)