Packer + WSL1 + VMWare Workstation build fails, can't find vmware executable

Has anyone else successfully built images with a similar configuration?

For (IT) reasons, I have access to WSL, but can’t install packer on the Win10 host. I’m trying to get a build working with this environment:

Win10 Pro hosting Ubuntu 20.04LTS within WSL1. VMWare Workstation is licensed on the Win10 host.

The build I’m running works without issue on an Ubuntu 20.04LTS host OS with VMWare Workstation installed in trial mode (trial license has not expired yet).

Running a build gives me the following error:

$ packer -v
1.7.10
$ packer build -debug .
Debug mode enabled. Builds will not be parallelized.
EIT-Packer-iso.vmware-iso.eit-image: output will be in this color.

Build 'EIT-Packer-iso.vmware-iso.eit-image' errored after 17 milliseconds 862 microseconds: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:
* exec: "vmware": executable file not found in $PATH
* exec: "vmware": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH


==> Wait completed after 17 milliseconds 965 microseconds
                                                                                                                                         ==> Some builds didn't complete successfully and had errors:
--> EIT-Packer-iso.vmware-iso.eit-image: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:
* exec: "vmware": executable file not found in $PATH
* exec: "vmware": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH


==> Builds finished but no artifacts were created.

Here’s my path variable:

$ echo $PATH | tr ":" "\n"
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc
/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath
/mnt/c/WINDOWS/system32
/mnt/c/WINDOWS
/mnt/c/WINDOWS/System32/Wbem
/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
/mnt/c/WINDOWS/System32/OpenSSH/
/mnt/c/Program Files (x86)/Sennheiser/SoftphoneSDK/
/mnt/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn/
/mnt/c/Program Files/1E/Client/Extensibility/NomadBranch
/mnt/c/Users/auser/AppData/Local/Microsoft/WindowsApps
/mnt/c/Users/auser/AppData/Local/Programs/Microsoft VS Code/bin
/snap/bin
/mnt/c/Program Files (x86)/VMware/VMware Workstation

And the program directory where VMware workstation should be installed:

$ ls /mnt/c/Program\ Files\ \(x86\)/VMware/VMware\ Workstation/
7za.exe                     ico                               tprdpw32.dll                   vmrest.exe
DIFXAPI.dll                 iconv.dll                         vim-types.dll                  vmrun.exe
EULA.jp.rtf                 icudt44l.dat                      vix.dll                        vmss2core.exe
EULA.rtf                    intl.dll                          vixDiskMountApi.dll            vmware-authd.exe
EULA.zh_CN.rtf              isoimages_manifest.txt            vixDiskMountServer.exe         vmware-hostd.exe
OVFTool                     libcds.dll                        vixwrapper-product-config.txt  vmware-kvm.exe
Resources                   libcurl.dll                       vm-support.vbs                 vmware-remotemks.exe
TPClnRDP.dll                libeay32.dll                      vmPerfmon.dll                  vmware-shell-ext-thunker.exe
TPClnVM.dll                 libxml2.dll                       vmPerfmon.h                    vmware-tray-helper.dll
TPClnt.dll                  linux.iso                         vmPerfmon.ini                  vmware-tray.exe
TPClntdeu.dll               linuxPreGlibc25.iso               vmUpdateLauncher.exe           vmware-unity-helper.exe
TPClntjpn.dll               messages                          vmacore.dll                    vmware-vdiskmanager.exe
TPClntloc.dll               mkisofs.exe                       vmappcfg.dll                   vmware.exe
VMnetDHCP.exe               netadapter.inf                    vmappsdk.dll                   vmwarebase.dll
VirtualPrinter-Linux.iso    netbridge.inf                     vmapputil.dll                  vmwarecui.dll
VirtualPrinter-Windows.iso  netuserif.inf                     vmauthd.dll                    vmwarestring.dll
adjperm.dll                 netware.iso                       vmclientcore.dll               vmwarewui.dll
basichttp.dll               nfc-types.dll                     vmdbCOM.dll                    vnetinst.dll
diskLibWrapper.dll          open_source_licenses.txt          vmdkShellExt.dll               vnetlib.dll
dispatcher.xml              openssl.exe                       vmeventmsg.dll                 vnetlib.exe
drvInst64.exe               ovftool_open_source_licenses.txt  vmnat.exe                      vnetlib64.dll
elevated.dll                pcre.dll                          vmnet.sys                      vnetlib64.exe
env                         readme.txt                        vmnetAdapter.sys               vnetsniffer.exe
environments.xml            sigc-2.0.dll                      vmnetBridge.dll                vnetstats.exe
expat.dll                   solaris.iso                       vmnetBridge.sys                vprintproxy.exe
glib-2.0.dll                ssleay32.dll                      vmnetUserif.sys                winPre2k.iso
glibmm-2.4.dll              ssoclient.dll                     vmnetadapter.cat               winPreVista.iso
gmodule-2.0.dll             swagger.zip                       vmnetbridge.cat                windows.iso
gobject-2.0.dll             sysimgbase.dll                    vmnetcfg.exe                   x64
gthread-2.0.dll             tagExtractor.xml                  vmnetuserif.cat                zip.exe
gvmomi.dll                  tools-upgraders                   vmomi.dll                      zlib1.dll
hostd                       tppcoipw32.dll                    vmplayer.exe

One last tidbit
I tried a couple different ways to provide WSL other ways to get to the necessary executables.

  • I created a Windows shortcut named vmware to the vmware.exe program in the same directory the exe is located. This did not work.
  • I attempted to create an alias for the commands in my profile, but the exec command isn’t run under your profile conditions, so that (understandably) failed.
  • I then attempted to create symlinks to the Windows executables with the names that packer was expecting (vmware, vmrun, vmware-vdiskmanager) in /usr/local/bin, and I got further, but eventually ended up with this error:
$ packer build -debug .
Debug mode enabled. Builds will not be parallelized.
EIT-Packer-iso.vmware-iso.eit-image: output will be in this color.

Build 'EIT-Packer-iso.vmware-iso.eit-image' errored after 13 milliseconds 582 microseconds: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:
* Workstation does not appear to be licensed. Please license it.
* Workstation does not appear to be licensed. Please license it.
* exec: "vmplayer": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH


==> Wait completed after 13 milliseconds 725 microseconds

==> Some builds didn't complete successfully and had errors:
--> EIT-Packer-iso.vmware-iso.eit-image: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:
* Workstation does not appear to be licensed. Please license it.
* Workstation does not appear to be licensed. Please license it.
* exec: "vmplayer": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH


==> Builds finished but no artifacts were created.

So the process maybe got further along, but it seems like I’m missing something big here, like an environment variable to enable WSL support.

Any help would be greatly appreciated!

1 Like

After a little more research, it looks like what I am doing is unsupported / unimplemented. I went digging in the code and found:

func workstationCheckLicense() error {
	matches, err := filepath.Glob("/etc/vmware/license-ws-*")
	if err != nil {
		return fmt.Errorf("Error looking for VMware license: %s", err)
	}

	if len(matches) == 0 {
		return errors.New("Workstation does not appear to be licensed. Please license it.")
	}

	return nil
}

For what it’s worth, the Windows environment license check just returns nil. Take that corpo goons!

So, it’s attempting to do the *nix environment check for VMWare workstation as there isn’t anything specific to WSL here. I thought I’d try to be sneaky and just created an empty file that matched the search pattern, but ran into additional errors - the job ran but couldn’t start vmware so it just ended without creating any artifacts.

Again, if anyone has had success building VMs on WSL with VMWare Workstation on the host, I’m curious what hoops you jumped through to accomplish it.

If anyone has made it this far, thanks for your time.

1 Like