hashicorp/packer-plugin-vmware

Failing to snapshot with VMware Workstation 17.5.2 for Linux

Closed this issue ยท 20 comments

Overview of the Issue

I'm attempting to use VMware Workstation to build OVAs and / or Vagrant Boxes in Github Actions. I'm installing the Linux version for VMware Workstation 17.5.2 and both packer vmware-vmx and packer vagrant fail when attempting to create snapshots

Reproduction Steps

  • Start Github Actions with ubuntu-latest runner.
  • Install VMware Workstation 17.5.2 from the VMware download portal.
  • run packer, either with the vagrant plugin or vmware-vmx plugin
  • fail when creating snapshots: "Cloning is not supported with VMWare Player version 5. Please use VMWare Player version 6, or greater."

Plugin and Packer version

  • plugin github.com/hashicorp/vmware v1.0.11
  • Packer v1.11.1
  • Vagrant 2.2.19
  • VMware Workstation 17.5.2 build-23775571

Simplified Packer Buildfile

packer {
  required_plugins {
    vmware = {
      version = "~> 1"
      source = "github.com/hashicorp/vmware"
    }
  }
}

variable "vmx_path" { default = "/home/runner/.vagrant.d/boxes/randomvagrantbox/version/vmware_desktop/box.vmx" }

source "vmware-vmx" "box" {
  source_path       = "${var.vmx_path}"
  output_directory  = "./vmware_desktop/"
  ssh_username      = "vagrant"
  ssh_password      = "vagrant"
  headless          = "true"
}

build {
  sources = ["source.vmware-vmx.box"]
}

Operating system and Environment details

github actions, ubuntu-latest

Log Fragments and crash.log files

https://gist.github.com/ssplatt/a8e19c569529de69a149db6da988d993

Build 'vmware-vmx.box' errored after 733 milliseconds 721 microseconds: Cloning is not supported with VMWare Player version 5. Please use VMWare Player version 6, or greater.

Thanks, that's exactly what I needed. I have an environment I can do a reproduction in and will look at addressing this for either v1.1.1 or v1.1.0 if possible.

This is what I suspected was happening, it's inherited the Player5Driver.

2024/07/17 15:22:51 packer-plugin-vmware_v1.0.11_x5.0_linux_amd64 plugin: VMware Workstation Information:
2024/07/17 15:22:51 packer-plugin-vmware_v1.0.11_x5.0_linux_amd64 plugin: VMware Workstation 17.5.2 build-23775571 Release
...
Testing against vmware driver *common.Player5Driver, Success: true

Yep, looks like it's slipping past and not actually verifying the correct driver and inheriting Player5Driver.

switch runtime.GOOS {
case "darwin":
drivers = []Driver{
NewFusion6Driver(dconfig, config),
NewFusion5Driver(dconfig, config),
}
case "linux":
fallthrough
case "windows":
drivers = []Driver{
NewWorkstation10Driver(config),
NewWorkstation9Driver(config),
NewPlayer6Driver(config),
NewPlayer5Driver(config),
}
default:
return nil, fmt.Errorf("can't find driver for OS: %s", runtime.GOOS)
}

One way that this can be addressed in a short order is the planned consolidation of the Player drivers since v5 is ancient and the cloning issue is no longer a concern - which is why there was a v5 and v6.

https://github.com/ssplatt/vagrant-box-centos-stream-9 is a project where I'm trying to use this vmx plugin or the vagrant plugin to build a vagrant box if you want to fork it

If you'd like to clone and make dev the branch from #231 to test this should resolve the issue as part of refactoring/consolidating the Player driver to remove legacy versions and limitations - though will need to address it picking up Player instead of Workstation either way.

any idea on a timeline? like, this week, this month, this year?

Aiming for within the next couple of weeks. There's a queue of updates currently.

cool thanks.

I got the plugin running in a Pipeline on Actions, it looks like the box isn't getting an IP I believe...

==> vmware-vmx.box: Starting virtual machine...
    vmware-vmx.box: The VM will be run headless, without a GUI. If you want to
    vmware-vmx.box: view the screen of the VM, connect via VNC with the password "dvpt8db2" to
    vmware-vmx.box: view the screen of the VM, connect via VNC with the password "dvpt8db2" to
    vmware-vmx.box: vnc://127.0.0.1:5991
    vmware-vmx.box: vnc://127.0.0.1:5991
2024/07/24 15:14:55 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:14:55 Executing: /usr/bin/vmrun -T player start vmware_desktop/packer-box-1721834072.vmx nogui
2024/07/24 15:14:56 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:14:56 stdout:
==> vmware-vmx.box: Connecting to VNC...
2024/07/24 15:14:56 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:14:56 stderr: Warning: program compiled against libxml 210 using older 209
==> vmware-vmx.box: Waiting 10s for boot...
==> vmware-vmx.box: Typing the boot command over VNC...
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 Located networking configuration file: /etc/vmware/networking
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 GuestIP discovered device matching nat: vmnet8
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 Lookup up IP information...
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 GuestAddress discovered MAC address: 00:0c:29:31:c6:a4
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 Trying DHCP leases path: /etc/vmware/vmnet8/dhcpd/dhcpd.leases
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 Unable to find an exact match for DHCP lease. Falling back loose matching for a hardware address 00:0c:29:31:c6:a4
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 IP lookup failed: none of the found device(s) [vmnet8] have a DHCP lease for MAC address 00:0c:29:31:c6:a4
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 [DEBUG] Unable to get address during connection step: IP lookup failed: none of the found device(s) [vmnet8] have a DHCP lease for MAC address 00:0c:29:31:c6:a4
2024/07/24 15:15:06 packer-plugin-vmware_v1.0.12-dev_x5.0_linux_amd64 plugin: 2024/07/24 15:15:06 [INFO] Waiting for SSH, up to timeout: 10m0s

then hits that same error for 10 minutes.

checking in, any update? thanks.

No update. Still working on the queue in my available time that are targeted for the next release. You can follow the status in the milestones.

This is next one my list now that v1.1.0 has released. Targeting this for the v1.1.1 patch release.

I've been able to recreate this and have traced this down in the driver. Target remains v1.1.1.

I assume you are running this headless since it's in a pipeline, but is it unlicensed for and under the new Personal Use license?

If so, this is likely the issue and I'm tracking a fix for this since it only appears in Workstation 17.5 on Linux.

2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 VMware app path: /usr/bin/vmware
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vmrun path: /usr/bin/vmrun
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vdisk-manager path: /usr/bin/vmware-vdiskmanager
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 Testing against vmware driver *common.Workstation10Driver, Success: false
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 skipping *common.Workstation10Driver because it failed with the following error no license found
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 VMware app path: /usr/bin/vmware
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vmrun path: /usr/bin/vmrun
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vdisk-manager path: /usr/bin/vmware-vdiskmanager
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 Testing against vmware driver *common.Workstation9Driver, Success: false
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 skipping *common.Workstation9Driver because it failed with the following error no license found
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 VMware app path: /usr/bin/vmplayer
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vmrun path: /usr/bin/vmrun
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vdisk-manager path: /usr/bin/vmware-vdiskmanager
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 qemu-img path:
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 Testing against vmware driver *common.Player6Driver, Success: false
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 skipping *common.Player6Driver because it failed with the following error error parsing version output:
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: VMware Workstation Information:
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: VMware Workstation 17.5.2 build-23775571 Release
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 VMware app path: /usr/bin/vmplayer
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vmrun path: /usr/bin/vmrun
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 vdisk-manager path: /usr/bin/vmware-vdiskmanager
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 qemu-img path:
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 Testing against vmware driver *common.Player5Driver, Success: true
2024/08/14 22:01:35 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/14 22:01:35 Verifying that ovftool exists...

Notice that it's skipping the Workstation drivers since there is no license and skipping to Player and updating the driver state and app path from /usr/bin/vmware to /usr/bin/player. Then it will try to use the /usr/bin/vmrun -T player list instead of /usr/bin/vmrun -T ws list and that is where it fails.

Anyway, I'll get a fix in, but it you need to work around this run:

sudo touch /etc/vmware/license-ws-foo

That should help.

Ryan

yes I'm attempting to take advantage of the personal license, headless, in the ci pipeline. I'll test that workaround and see if it helps.

the good news, i do see it detect Workstation 17 and use the correct ws

2024/08/15 20:34:12 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:34:12 Executing: /usr/bin/vmrun -T ws clone 

However, I'm still hitting an error where it can't determine the IP address:

2024/08/15 20:44:25 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:25 A network mapper configuration file does not exist in the default path: /etc/vmware/netmap.conf
2024/08/15 20:44:25 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:25 Checking alternate path for network mapper configuration file: /etc/vmware/networking
2024/08/15 20:44:25 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:25 Located the network mapper configuration file: /etc/vmware/networking
2024/08/15 20:44:25 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:25 GuestIP discovered device matching nat: vmnet8
2024/08/15 20:44:25 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:25 Lookup up IP information...
2024/08/15 20:44:25 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:25 IP lookup failed: unable to determine MAC address
2024/08/15 20:44:25 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:25 [DEBUG] Error getting SSH address: IP lookup failed: unable to determine MAC address
2024/08/15 20:44:30 packer-plugin-vmware_v1.1.0_x5.0_linux_amd64 plugin: 2024/08/15 20:44:30 [DEBUG] SSH wait cancelled. Exiting loop.
==> vmware-vmx.box: Timeout waiting for SSH.
==> vmware-vmx.box: Timeout waiting for SSH.

This would be a different issue.

If you perform this build locally, without the CI, does it get an IP address?

i was just able to get my hands on a linux host to test this and yes it does get an IP locally.

This seems to be a seperate issue from the license file that was blocking. I suggest opening a seperate issue for the "Timeout waiting for SSH".

Ryan Johnson
Distinguished Engineer, VMware by Broadcom

Licensing issue will be tracked under #242.