josenk / terraform-provider-esxi

Terraform-provider-esxi plugin
GNU General Public License v3.0
540 stars 154 forks source link

Wrong vmkfstools path on ESXi 5.1 - /bin instead of /sbin #128

Closed archon52 closed 3 years ago

archon52 commented 3 years ago

Describe the bug I'm trying to provision an esxi_virtual_disk on an ESXi 5.1 host. When attempting to apply the config I receive the below error with debug logging enabled

2020-10-14T23:30:05.294-0400 [DEBUG] plugin.terraform-provider-esxi_v1.8.0: pid-19176-esxi_remote_cmds.go:78: [runRemoteSshCommand] cmd://bin/vmkfstools -c 20G -d thin "/vmfs/volumes/FreeNAS SSD Storage/k3s-node.i.hlab.io/data.vmdk"/
2020-10-14T23:30:05.294-0400 [DEBUG] plugin.terraform-provider-esxi_v1.8.0:  stdout:/sh: /bin/vmkfstools: not found/

To Reproduce Steps to reproduce the behavior:

  1. terraform apply creating at least one virtual disk to an ESXi 5.1 host

Expected behavior The virtual disk should be created without any errors

Terraform files This is reproducible with any esxi_virtual_disk configuration

Desktop (please complete the following information):

Additional context It looks like on ESXi 5.1 the vmkfstools binary is located in /sbin where in 6.0 and I assume later the binary is located in /bin. I confirmed this by sshing into my 5.1 host and found vmkfstools is located in /sbin.

After digging around some more on my 5.1 and 6.0 hosts I found that using /usr/sbin/vmkfstools for the path would work for both 5.1 and 6.0 hosts as /usr/sbin is a symlink to /sbin on 5.1 and on 6.0 it is a symlink to /bin

josenk commented 3 years ago

ESXi 5.1 is out of support since 2016 (4 years ago).

There is an easy work-around. On your esxi 5.1 host, you could create the link.

archon52 commented 3 years ago

I didn't realize it was so far out of support. I ended up creating a symlink and was able to provision the disk without any issues. If anyone else comes across this, just SSH into the host and run

ln -s /sbin/vmkfstools /bin