hashicorp / packer-plugin-vmware

Packer plugin for VMware Builder

Home Page:https://www.packer.io/docs/builders/vmware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`vmware-iso`: builder not creating `vmware.log` file

HarshadDGhorpade-eaton opened this issue · comments

May I know what's the location of vmware.log file while using vmware-iso builder ?

I saw this file generated for vmware workstation 17 pro but not for 16, is that the case or am I looking at wrong place at all ?

{
    "builders": [
        {
            "boot_command": [
                " <wait>",
                " <wait>",
                " <wait>",
                " <wait>",
                " <wait>",
                "<esc><wait>",
                "<f6><wait>",
                "<esc><wait>",
                "<bs><bs><bs><bs><wait>",
                " autoinstall<wait5>",
                " ds=nocloud-net<wait5>",
                " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{ user `http_directory` }}/{{ user `preseed_file_name` }}<wait>",
                "<enter><wait5>"
            ],
            "boot_wait": "5s",
            "cpus": "{{ user `cpus` }}",
            "disk_size": "{{user `disk_size`}}",
            "guest_os_type": "ubuntu-64",
            "headless": true,
            "http_directory": "{{user `http_directory`}}",
            "iso_checksum": "{{user `iso_checksum`}}",
            "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
            "memory": "{{ user `memory` }}",
            "output_directory": "{{ user `build_directory` }}/packer-{{user `template`}}-vmware",
            "shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
            "ssh_password": "vagrant",
            "ssh_port": 22,
            "ssh_timeout": "10000s",
            "ssh_username": "vagrant",
            "tools_upload_flavor": "linux",
            "type": "vmware-iso",
            "vm_name": "{{ user `template` }}",
            "vmx_data": {
                "cpuid.coresPerSocket": "1",
                "ethernet0.pciSlotNumber": "32"
            },
            "vmx_remove_ethernet_interfaces": true
        }
    ],
    "variables": {
        "box_basename": "ubuntu-20.04",
        "build_directory": "../../builds",
        "build_timestamp": "{{isotime \"20060102150405\"}}",
        "cpus": "2",
        "disk_size": "65536",
        "guest_additions_url": "",
        "http_directory": "dev_environment/ubuntu-desktop-preseed",
        "http_proxy": "{{env `http_proxy`}}",
        "https_proxy": "{{env `https_proxy`}}",
        "iso_checksum": "sha256:b8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b",
        "iso_name": "ubuntu-20.04.6-live-server-amd64.iso",
        "memory": "1024",
        "mirror": "https://releases.ubuntu.com",
        "mirror_directory": "focal",
        "name": "ubuntu-20.04",
        "no_proxy": "{{env `no_proxy`}}",
        "preseed_path": "preseed.cfg",
        "qemu_display": "none",
        "template": "ubuntu-20.04-amd64",
        "version": "TIMESTAMP"
    }
}

Error :

$ packer build -on-error=ask ubuntu_vmware.json
vmware-iso: output will be in this color.

==> vmware-iso: Retrieving ISO
==> vmware-iso: Trying ../ubuntu-20.04.6-desktop-amd64.iso
==> vmware-iso: Trying ../ubuntu-20.04.6-desktop-amd64.iso?checksum=md5%3Aeeabb7996e94b2f0a6eaf73f8943d19f
==> vmware-iso: ../ubuntu-20.04.6-desktop-amd64.iso?checksum=md5%3Aeeabb7996e94b2f0a6eaf73f8943d19f => /home/user/ubuntu-20.04.6-desktop-amd64.iso
==> vmware-iso: Configuring output and export directories...
==> vmware-iso: Creating required virtual machine disks
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Starting virtual machine...
    vmware-iso: The VM will be run headless, without a GUI. If you want to
    vmware-iso: view the screen of the VM, connect via VNC with the password "yqPTl0YR" to
    vmware-iso: vnc://127.0.0.1:5974
==> vmware-iso: Error starting VM: VMware error: Error: The operation was canceled
==> vmware-iso: Error starting VM: VMware error: Error: The operation was canceled
==> vmware-iso: Step "StepRun" failed
==> vmware-iso: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)?

output directory contains some supported files but not the log file :

$ ls .
disk-s001.vmdk  disk-s003.vmdk  disk-s005.vmdk  disk-s007.vmdk  disk-s009.vmdk  disk.vmdk                   packer-vmware-example.vmx
disk-s002.vmdk  disk-s004.vmdk  disk-s006.vmdk  disk-s008.vmdk  disk-s010.vmdk  packer-vmware-example.vmsd  packer-vmware-example.vmxf

logs I saw on ws 17 was quite helpful as error message is not self explanatory in this case.

Host OS : Ubuntu 20.04(remote physical machine)
VMware workstation 16 pro/VMware workstation 15 pro

I hit the same issue. Versions are

Ubuntu 22.04.3
Packer 1.9.4
VmPlayer 17.0.2

While debugging this issue, I have found this line: https://github.com/hashicorp/packer-plugin-vmware/blob/main/builder/vmware/common/driver_player5.go#L121

Then run vmrun command manually.

> vmrun -T player start flatcar-stable-3510.2.7-kube-v1.26.7.vmx nogui
Error: Unknown error

and vmrun didn't create any log file.

My understanding is that it is not a problem in this repo. It is an issue in vmrun.

This appears to be an issue with the version of VMware Workstation (16) in use.