Code Monkey home page Code Monkey logo

packer-plugin-vmware's Introduction

Packer Plugin for VMware

The Packer Plugin for VMware is a multi-component plugin that can be used with Packer to create virtual machine images for use with VMware vSphere Hypervisor and desktop virtualization products such as VMware Fusion, VMware Workstation, and VMware Player,

The plugin includes two builders which are able to create images, depending on your desired strategy:

  • vmware-iso - This builder creates a virtual machine, installs an operating system from an ISO, provisions software within the operating system, and then exports the virtual machine as an image. This is best for those who want to start by creating a base image.

  • vmware-vmx - This builder imports an existing virtual machine (from a.vmx file), runs provisioners on the virtual machine, and then exports the virtual machine as an image. This is best for those who want to start from an existing virtual machine as the source. You can feed the artifact of this builder back into Packer to iterate on a machine image.

Differences from the Packer Plugin for VMware vSphere

While both this plugin and the packer-plugin-vsphere are designed to create virtual machine images, there are some key differences:

  • Platforms: This plugin facilitates the creation of virtual machine images by integrating with VMware vSphere Hypervisor and desktop virtualization products such as VMware Fusion, VMware Workstation, and VMware Player; without using the VMware vSphere API. On the other hand, packer-plugin-vsphere is specifically developed to utilize the VMware vSphere API, facilitating the creation of virtual machine images by integrating with VMware vCenter Server and the VMware vSphere Hypervisor.

  • Focus: This plugin is purpose-built with a focus on VMware vSphere Hypervisor and desktop virtualization products such as VMware Fusion, VMware Workstation, and VMware Player. In contrast, packer-plugin-vsphere, includes builders and post-processors with a focus on VMware vSphere, offering capabilities such as creating virtual machine images, cloning and modifying base virtual machine images, and exporting artifacts in specified locations and formats.

Please refer to the documentation for each plugin to understand the specific capabilities and configuration options.

Requirements

Desktop Hypervisor:

  • VMware Fusion Pro (macOS)
  • VMware Workstation Pro (Linux and Windows)
  • VMware Workstation Player (Linux)

Bare Metal Hypervisor:

  • VMware vSphere Hypervisor

The plugin supports versions in accordance with the VMware Product Lifecycle Matrix from General Availability to End of General Support. Learn more: VMware Product Lifecycle Matrix

Go:

  • Go 1.18

    Required if building the plugin.

Usage

For a few examples on how to use this plugin with Packer refer to the example template directory.

Installation

Using Pre-built Releases

Automatic Installation

Packer v1.7.0 and later supports the packer init command which enables the automatic installation of Packer plugins. For more information, see the Packer documentation.

To install this plugin, copy and paste this code (HCL2) into your Packer configuration and run packer init.

packer {
  required_version = ">= 1.7.0"
  required_plugins {
    vmware = {
      version = ">= 1.0.0"
      source  = "github.com/hashicorp/vmware"
    }
  }
}

Manual Installation

Packer v1.8.0 and later supports the packer plugins command which enables the management of external plugins required by a configuration.

For example, to download and install the latest available version of this plugin, run the following:

packer plugins install github.com/hashicorp/vmware

For environments where the Packer host can not communicate with GitHub (e.g., a dark-site), you can download pre-built binary releases of the plugin from GitHub. Once you have downloaded the latest release archive for your target operating system and architecture, decompress to retrieve the plugin binary file for your platform.

To transfer and install the downloaded plugin, please follow the Packer documentation on installing a plugin.

Using the Source

If you prefer to build the plugin from sources, clone the GitHub repository locally and run the command go build from the repository root directory. Upon successful compilation, a packer-plugin-vmware plugin binary file can be found in the root directory.

To install the compiled plugin, please follow the Packer documentation on installing a plugin.

Configuration

For more information on how to configure the plugin, please see the plugin documentation.

Contributing

  • If you think you've found a bug in the code or you have a question regarding the usage of this software, please reach out to us by opening an issue in this GitHub repository.

  • Contributions to this project are welcome: if you want to add a feature or a fix a bug, please do so by opening a pull request in this GitHub repository. In case of feature contribution, we kindly ask you to open an issue to discuss it beforehand.

packer-plugin-vmware's People

Contributors

alrs avatar arizvisa avatar azr avatar cbednarski avatar danham avatar dependabot[bot] avatar dougm avatar dragon788 avatar higebu avatar jasonberanek avatar jescalan avatar klaamane avatar ktruong7 avatar lbajolet-hashicorp avatar liv2 avatar mahcsig avatar markpeek avatar mitchellh avatar mwhooker avatar nywilken avatar qur avatar rasa avatar rickard-von-essen avatar sethvargo avatar smerrill avatar sneal avatar swampdragons avatar sylviamoss avatar taliesins avatar tenthirtyam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-plugin-vmware's Issues

unknown configuration key: tools_upload_flavor ESXI/ Vcenter 6.7

This issue was originally opened by @wladglad as hashicorp/packer#10996. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

Problem with auto VMware Tools ISO to upload into the VM
Error: * unknown configuration key: '"tools_upload_flavor"'

Only works uploading directly ISO with command

"iso_paths": [
"[] /vmimages/tools-isoimages/windows.iso"

]

Packer version

packer -v
1.7.2

Simplified Packer Buildfile

{
  "builders": [
    {
      "cluster": "Test",
      "communicator": "winrm",
      "convert_to_template": "false",
      "cpus": "2",
      "datastore": "Kingston",
      "disk_controller_type": "lsilogic-sas",
      "floppy_files": [
        "setup\\Autounattend.xml",
        "setup\\script\\Config_WinRM.ps1",
        "setup\\script\\Cleaning.ps1"
      ],
      "guest_os_type": "windows9_64Guest",
      "host": "192.168.10.152",
      "insecure_connection": "true",
      **"tools_upload_flavor": "windows",**
      "iso_paths": [
        "[Kingston] IsoSSD/Windows10pro.iso",

      ],
      "network_adapters": [
        {
          "network": "VM Network",
          "network_card": "vmxnet3"
        }
      ],
      "password": "P@ssword1",
      "ram": "8192",
      "storage": [
        {
          "disk_size": "40000",
          "disk_thin_provisioned": true
        }
      ],
      "type": "vsphere-iso",
      "username": "[email protected]",
      "vcenter_server": "vcenter",
      "vm_name": "packerimage",
      "winrm_password": "P@ssword1",
      "winrm_username": "admin",
      "winrm_use_ssl": "false",
      "winrm_insecure": "true",
      "shutdown_timeout": "1h",
      "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
      ]
    }
  ],
  "provisioners": [
    {
      "type": "powershell",
       "scripts": [
        "setup/script/Cleaning.ps1"
      ]
    } 
  ]
}

Operating system and Environment details

OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19042 N/A Build 19042
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free

Log Fragments and crash.log files

D:\DEvops\packer> packer build -force .\Windows\VM-Create.json
Error: Failed to prepare build: "vsphere-iso"

1 error occurred:
* unknown configuration key: '"tools_upload_flavor"'

==> Wait completed after 0 seconds

==> Builds finished but no artifacts were created.

`vmware-iso`: `cd_files` not working properly

This issue was originally opened by @t0rr3sp3dr0 as hashicorp/packer#10935. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

The latest version of Packer doesn't seem to attach the cd_files generated ISO to the VM upon start.

It only works when adding the following setting:

  vmx_data = {
    "sata1.present": "TRUE",
  }

Reproduction Steps

  1. run packer build
  2. check that the VM doesn't have the generated ISO attached

Packer version

Packer v1.7.2

Simplified Packer Buildfile

source "vmware-iso" "big-sur" {
  # VMware-ISO Builder Configuration Reference
  cdrom_adapter_type = "sata"
  guest_os_type = "darwin20-64"
  version = 18

  # Extra Disk Configuration
  disk_adapter_type = "nvme"
  disk_type_id = 0

  # ISO Configuration
  iso_checksum = "file:./Install macOS Big Sur.cdr.sum"
  iso_url = "./Install macOS Big Sur.cdr"

  # CD configuration
  cd_files = [
    "./init.sh",
  ]

  # Shutdown configuration
  shutdown_command = "sudo shutdown -h now"

  # Communicator configuration
  communicator = "ssh"
  ssh_username = "user"
  ssh_password = "pass"
}

build {
  name = "vmware-iso"

  sources = [
    "sources.vmware-iso.big-sur",
  ]
}

Operating system and Environment details

macOS Big Sur Version 11.2.3 (20D91)
VMware Fusion Player Version 12.1.1 (17801503)

Log Fragments and crash.log files

2021/04/20 00:01:31 [INFO] Packer version: 1.7.2 [go1.16.3 darwin amd64]
2021/04/20 00:01:31 [TRACE] discovering plugins in /usr/local/bin
2021/04/20 00:01:31 [TRACE] discovering plugins in /Users/pedro/.packer.d/plugins
2021/04/20 00:01:31 [TRACE] discovering plugins in .
2021/04/20 00:01:31 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/04/20 00:01:31 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/pedro/.packerconfig
2021/04/20 00:01:31 [WARN] Config file doesn't exist: /Users/pedro/.packerconfig
2021/04/20 00:01:31 [INFO] Setting cache directory: /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/tmp.FHZeHndKa0/packer_cache
2021/04/20 00:01:31 [TRACE] Starting internal plugin packer-builder-vmware-iso
2021/04/20 00:01:31 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-vmware-iso"}
2021/04/20 00:01:31 Waiting for RPC address for: /usr/local/bin/packer
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: [INFO] Packer version: 1.7.2 [go1.16.3 darwin amd64]
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/pedro/.packerconfig
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: [WARN] Config file doesn't exist: /Users/pedro/.packerconfig
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: [INFO] Setting cache directory: /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/tmp.FHZeHndKa0/packer_cache
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: args: []string{"packer-builder-vmware-iso"}
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Plugin address: unix /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/packer-plugin743236302
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Waiting for connection...
2021/04/20 00:01:31 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/packer-plugin743236302
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Serving a plugin connection...
2021/04/20 00:01:31 Build debug mode: false
2021/04/20 00:01:31 Force build: false
2021/04/20 00:01:31 On error: 
2021/04/20 00:01:31 Waiting on builds to complete...
2021/04/20 00:01:31 Starting build run: vmware-iso.vmware-iso.box
2021/04/20 00:01:31 Running builder: 
2021/04/20 00:01:31 [INFO] (telemetry) Starting builder 
vmware-iso.vmware-iso.box: output will be in this color.

2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Detected VMware version: 12
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Testing against vmware driver *common.Fusion6Driver, Success: true
==> vmware-iso.vmware-iso.box: Retrieving ISO
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Acquiring lock for: ./Install%20macOS%20Big%20Sur.cdr?checksum=sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 (/var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/tmp.FHZeHndKa0/packer_cache/81fec7813499d6750363f9c7d57fbded7d9e232c.iso.lock)
==> vmware-iso.vmware-iso.box: Trying ./Install macOS Big Sur.cdr
==> vmware-iso.vmware-iso.box: Trying ./Install%20macOS%20Big%20Sur.cdr?checksum=sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Leaving retrieve loop for ISO
==> vmware-iso.vmware-iso.box: ./Install%20macOS%20Big%20Sur.cdr?checksum=sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 => /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/tmp.FHZeHndKa0/Install macOS Big Sur.cdr
==> vmware-iso.vmware-iso.box: Configuring output and export directories...
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: No floppy files specified. Floppy disk will not be made.
==> vmware-iso.vmware-iso.box: Creating CD disk...
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: CD path: /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/packer587008816.iso
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Wrote 0 bytes to init.sh
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Executing: /usr/bin/hdiutil [makehybrid -o /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/packer587008816.iso -hfs -joliet -iso -default-volume-name packer /var/folders/mc/smgjlfwx7x7dqzllygvlkly00000gn/T/packer_to_cdrom357419727]
    vmware-iso.vmware-iso.box: Creating hybrid image...
    vmware-iso.vmware-iso.box: Done copying paths from CD_dirs
==> vmware-iso.vmware-iso.box: Creating required virtual machine disks
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: [INFO] Creating disk with Path: output-box/disk.vmdk and Size: 40000M
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager -c -s 40000M -a nvme -t 0 output-box/disk.vmdk
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: stdout: Creating disk 'output-box/disk.vmdk'
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Virtual disk creation successful.
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: stderr:
==> vmware-iso.vmware-iso.box: Building and writing VMX file
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Writing VMX to: output-box/packer-box.vmx
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Configuring VMX...
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Writing VMX to: output-box/packer-box.vmx
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Suppressing messages in VMX
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: HostIP discovered device matching nat: vmnet8
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Host IP for the VMware machine: 172.16.96.1
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Looking for available port between 5900 and 6000
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Found available port: 5967 on IP: 127.0.0.1
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Found available VNC port: 127.0.0.1:5967
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Writing VMX to: output-box/packer-box.vmx
==> vmware-iso.vmware-iso.box: Starting virtual machine...
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmrun -T fusion start output-box/packer-box.vmx gui
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: stdout:
2021/04/20 00:01:31 packer-builder-vmware-iso plugin: stderr:

Add property to set the vhv.enable vmx property

Community Note

Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

It would be nice to have an explicit property to enable nested virtualization (aka VHV (Virtual Hardware-Assisted Virtualization)) by editing the vhv.enable vmx property.

Currently, I'm using vmx_data as:

"vmx_data": {
  "vhv.enable": "TRUE"
},

Use Case(s)

A explicit property makes packer more accessible.

Potential configuration

{
  "vhv_enable": true,
}

Potential References

See https://williamlam.com/2012/08/how-to-enable-nested-esxi-other.html

This host does not support "Intel EPT" hardware assisted MMU virtualization.

This issue was originally opened by @mohanr as hashicorp/packer#9242. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

I have VirtualBox and a guest Ubuntu OS. Inside that I use packer and VMWare Workstation to build a CentOS VM.
I think this could be a problem because there is already a virtualized environment. I may have identified this and the vmware.log shows the problem..

Is this even possible to do ? I do set "monitor.allowLegacyCPU": "true".
If this is not possible due to some nested virtualization requirement I can use the Windows subsystem for Linux but again that could pose the same problem.
Is packer's legacy CPU switch the right one or not ?

Packer version

From packer version

Simplified Packer Buildfile

{
  "variables": {
    "vm_name": "centos-7.1-vmware",
    "iso_url": "{{env `ISO_URL`}}",
    "iso_sha256": "27bd866242ee058b7a5754e83d8ee8403e216b93d130d800852a96f41c34d86a",
    "vm_host": "{{ user `vm_host` }}",
    "vm_user": "{{ user `vm_user` }}",
    "vm_pass": "{{ env `vm_pass` }}",
    "vm_dc":   "{{ user `vm_dc` }}",
    "vm_cluster": "{{user `vm_cluster`}}",
    "vm_datastore": "{{user `vm_datastore`}}",
    "vm_folder": "{{user `vm_folder`}}",
    "vm_network": "{{user `vm_network`}}"
  },
  "builders": [
    {
      "headless": false,
      "type": "vmware-iso",
      "boot_command": [
        "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
      ],
      "boot_wait": "10s",
      "disk_size": 8192,
      "guest_os_type": "centos-64",
      "http_directory": "http",
      "iso_url": "{{user `iso_url`}}",
      "iso_checksum_type": "sha256",
      "iso_checksum": "{{user `iso_sha256`}}",
      "ssh_username": "vagrant",
      "ssh_private_key_file": "vagrant_rsa_key",
      "ssh_port": 22,
      "ssh_wait_timeout": "10000s",
      "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'",
      "tools_upload_flavor": "",
      "tools_upload_path": "/tmp/vmware_tools_{{.Flavor}}.iso",
      "vmx_data": {
        "memsize": "1024",
        "numvcpus": "1",
        "cpuid.coresPerSocket": "1",
        "monitor.allowLegacyCPU": "true"
      }
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
      "override": {
        "vmware-iso": {
          "scripts": [
            "scripts/base.sh",
            "scripts/vmware.sh",
            "scripts/hgfs.sh",
            "scripts/cleanup.sh",
            "scripts/zerodisk.sh"
          ]
        }
      }
    }
  ],
  "post-processors": [
    {
      "type": "vagrant",
      "override": {
        "vmware": {
          "output": "centos-7.1-x64-vmware.box"
        }
      }
    }
  ]
}

Operating system and Environment details

Host OS is Windows 10 Pro and VirtualBox and a guest Ubuntu OS

Log Fragments and crash.log files

vmware.log

2020-05-16T10:15:54.382+05:30| vmx| I125: ToolsISO: Updated cached value for imageName to 'linux.iso'.
2020-05-16T10:15:54.382+05:30| vmx| I125: ToolsISO: Selected Tools ISO 'linux.iso' for 'centos-64' guest.
2020-05-16T10:15:54.390+05:30| vmx| I125: Vix: [mainDispatch.c:4215]: VMAutomation_ReportPowerOpFinished: statevar=1, newAppState=1873, success=1 additionalError=0
2020-05-16T10:15:54.405+05:30| vmx| I125: Module 'CPUIDEarly' power on failed.
2020-05-16T10:15:54.405+05:30| vmx| I125: VMX_PowerOn: ModuleTable_PowerOn = 0
2020-05-16T10:15:54.407+05:30| vmx| I125: Vix: [mainDispatch.c:4215]: VMAutomation_ReportPowerOpFinished: statevar=1, newAppState=1873, success=1 additionalError=0
2020-05-16T10:15:54.414+05:30| vmx| I125:
2020-05-16T10:15:54.414+05:30| vmx| I125+ Power on failure messages: This host does not support Intel VT-x.
2020-05-16T10:15:54.414+05:30| vmx| I125+ This host does not support "Intel EPT" hardware assisted MMU virtualization.
2020-05-16T10:15:54.414+05:30| vmx| I125+ Module 'CPUIDEarly' power on failed.
2020-05-16T10:15:54.414+05:30| vmx| I125+ Failed to start the virtual machine.
2020-05-16T10:15:54.414+05:30| vmx| I125+
2020-05-16T10:15:54.415+05:30| vmx| I125: Vix: [mainDispatch.c:4215]: VMAutomation_ReportPowerOpFinished: statevar=0, newAppState=1870, success=1 additionalError=0
2020-05-16T10:15:54.415+05:30| vmx| I125: Transitioned vmx/execState/val to poweredOff
2020-05-16T10:15:54.421+05:30| vmx| I125: Vix: [mainDispatch.c:4215]: VMAutomation_ReportPowerOpFinished: statevar=0, newAppState=1870, success=0 additionalError=0
2020-05-16T10:15:54.421+05:30| vmx| I125: Vix: [mainDispatch.c:4253]: Error VIX_E_FAIL in VMAutomation_ReportPowerOpFinished(): Unknown error

maxSnapshots

This issue was originally opened by @Man-Yee in hashicorp/packer#11139 and has been migrated to this repository. The original issue description is below.


I would like to disable snapshot in vmware.

I know that I can set this advanced configuration (snapshot.maxSnapshots) to "0" to achieve this.

I also know that if I modify the .ovf file with the following line, it will achieve the wanted result:

<VirtualHardwareSection ovf:transport="com.vmware.guestInfo"> <Info>Virtual hardware requirements</Info> . . . <vmw:ExtraConfig ovf:required="false" vmw:key="snapshot.maxSnapshots" vmw:value="0"/> </VirtualHardwareSection>

I would like to automate this. According to documentation, I can possibly use extraConfig in configure_parameters.

I tried many variations in my .hcl file , but without success:

configuration_parameters = { extraConfig = { key = "snapshot.maxSnapshots" value = "0" } }

It complains about
Inappropriate value for attribute "configuration_parameters": element "extraConfig": string required.

Then I tried this:

configuration_parameters = { "extraConfig" = "snapshot.maxSnapshots=0" }

Although the build pass, deploying the .ova file does not yield the wanted result.

What is the correct format to use extraConfig? Is snapshot.maxSnapshots supported?

Create initial snapshot after cleanup

Description

Create an initial snapshot of the newly created VM after the clean-up step.

Use Case(s)

  • if you need to return frequently to a clean state of the VM (right after the initial setup) e.g. to clear files / malware / misconfigurations, the initial snapshot to return to can be shipped right with the VM so the user doesn't have to create it on its own and potentially forget it.

Potential configuration

  1. add a create snapshot step after the StepCleanVMX for the respective builder
&vmwcommon.StepCreateSnapshot{
	SnapshotName: &b.config.SnapshotName,
},
  1. add SnapshotName string mapstructure:"snapshot_name" required:"false"`` to the builders config to be able to specify the snapshots name in the config
  2. add a builder/vmware/common/step_create_snapshot.go which creates a snapshot if the name is provided in the config
type StepCreateSnapshot struct {
	SnapshotName *string
}
  1. add a CreateSnapshot method inside the drivers which calls vmrun.exe or equivalent tool on linux / macos to create a snapshot
  2. add Tests

Packer understands relative ISO paths, VMware doesn't

Overview of the Issue

A previously working Packer config suddenly failed to boot VMWare (using Fusion 12) machines properly - the ISO was set, but never "Connected", and the VM shows "No Operating System found".

Some comparison with a manually-created VM shows that the path for the ISO was absolute.

The only change I've made in the Packer config, was to define the iso_target_path property (I'd previously used an external step to download the ISOs for repeated use). It seems that when this path is relative, Packer understands it fine, but VMWare does not.

The work-around for now is to supply the path as absolute, but ideally Packer would handle this.

Reproduction Steps

Have a packer config with iso_target_path specified as a relative path.

Plugin and Packer version

1.712

Operating system and Environment details

macOS 11.4 on Intel.

VMWare Fusion Professional 12.1.2

cleanup_remote_cache flag unrecognized

Overview of the Issue

The cleanup_remote_cache flag is unrecognized. This flag was presumably added approx. two years ago.

Reproduction Steps

Create a JSON configuration for packer that uses this flag with a vmware-iso builder.

Plugin and Packer version

Packer v.1.8.0

Simplified Packer Buildfile

{
  "builders": [{
    "type": "vsphere-iso",
    "cleanup_remote_cache": true,
....
  }],
  "provisioners": [{
    "type": "shell",
    "inline": [
      "sudo rm /etc/machine-id",
      "sudo touch /etc/machine-id",
      "echo 'Packer template build complete'"
    ]
  }]
}

Operating system and Environment details

amd64, Ubuntu 18.04.6

Log Fragments and crash.log files

Error: Failed to prepare build: "vsphere-iso"

1 error occurred:
        * unknown configuration key: '"cleanup_remote_cache"'

Can't use cd_files variable to send preseed with debian

This issue was originally opened by @ZeikoFr in hashicorp/packer#11525 and has been migrated to this repository. The original issue description is below.


Hi,

Not 100% sure if it's a packer issue or a lack of knowledge of my part, if it is my apologies.

Overview of the Issue

Using cd_files to create an iso containing a preseed file to auto install debian whiteout needing http server.

Packer properly create the iso and the second cd drive needed but when debian installer launch the preseed iso is on /dev/sr1 and it is not accessible because it's not mounted.
/cdrom is used by debian installer
Afaik you cannot mount anything else during automated setup until you get to the preseed part.

Reproduction Steps

Create a packer template with cd_files for debian
Installer will run until it can't found the preseed file because it does not auto mount /dev/sr1

Packer version

1.7.8

Simplified Packer Template

source "vmware-iso" "Debian-11.1-Template" {
  boot_command     = ["e<down><down><down><end>priority=critical auto=true file=/dev/sr1/preseed.cfg preseed-md5=5c7bd38f2916a9c8caf7a57899a688a3<leftCtrlOn>x<leftCtrlOff>"]
  iso_checksum     = "${var.iso_checksum}"
  iso_url          = "${var.iso_url}"
  cd_files = ["./http/debian/preseed.cfg"]
  cd_label = "cidata"
  }

Operating system and Environment details

I tried on vmware workstation and vmware vSphere from manjaro and ubuntu using the same version of packer

Got the exact same problem on both

Log Fragments and crash.log files

vmware-iso.Debian-11-Template: output will be in this color.

==> vmware-iso.Debian-11-Template: Trying https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.1.0-amd64-netinst.iso
==> vmware-iso.Debian-11-Template: Trying https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.1.0-amd64-netinst.iso?checksum=sha256%3A8488abc1361590ee7a3c9b00ec059b29dfb1da40f8ba4adf293c7a30fa943eb2
2022/01/25 20:19:26 packer-builder-vmware-iso plugin: Leaving retrieve loop for ISO
2022/01/25 20:19:26 packer-builder-vmware-iso plugin: No floppy files specified. Floppy disk will not be made.
2022/01/25 20:19:26 packer-builder-vmware-iso plugin: CD label is set to cidata
2022/01/25 20:19:26 packer-builder-vmware-iso plugin: CD path: /tmp/packer2545184248.iso
==> vmware-iso.Debian-11-Template: https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.1.0-amd64-netinst.iso?checksum=sha256%3A8488abc1361590ee7a3c9b00ec059b29dfb1da40f8ba4adf293c7a30fa943eb2 => /home/zeiko/.cache/packer/bed3360a8849258231657d615579999ba9f47fc6.iso
2022/01/25 20:19:26 packer-builder-vmware-iso plugin: Wrote 7430 bytes to preseed.cfg
2022/01/25 20:19:26 packer-builder-vmware-iso plugin: Executing: /usr/bin/mkisofs [-joliet -volid cidata -o /tmp/packer2545184248.iso /tmp/packer_to_cdrom898500605]
==> vmware-iso.Debian-11-Template: Configuring output and export directories...
==> vmware-iso.Debian-11-Template: Creating CD disk...
    vmware-iso.Debian-11-Template: Warning: creating filesystem with (nonstandard) Joliet extensions
    vmware-iso.Debian-11-Template: but without (standard) Rock Ridge extensions.
    vmware-iso.Debian-11-Template: It is highly recommended to add Rock Ridge
    vmware-iso.Debian-11-Template: Setting input-charset to 'UTF-8' from locale.
    vmware-iso.Debian-11-Template: Total translation table size: 0
    vmware-iso.Debian-11-Template: Total rockridge attributes bytes: 0
    vmware-iso.Debian-11-Template: Total directory bytes: 0
    vmware-iso.Debian-11-Template: Path table size(bytes): 10
    vmware-iso.Debian-11-Template: Max brk space used 0
    vmware-iso.Debian-11-Template: 184 extents written (0 MB)
    vmware-iso.Debian-11-Template: Done copying paths from CD_dirs

Add support for UEFI firmware and secure boot

As the next generation of Windows OS will be requiring UEFI and likely TPM, it'd likely be a good idea and sync some of the PRs that were added to the vsphere-iso builder such as for "firmware", "nested", "force_bios_setup", etc.

Community Note

Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

The next generation of Windows OS will require nested virtualization and efi-secure. These were introduced in the vsphere builders/plugins but was neglected to also be added to the vmware builders/plugins. This should be as simple as adding the relevant vmx configurations to step_create_vmx.go.

I'll add more details as I encounter them as I'm still waiting on licenses for testing this shit out.

As an example of what to add to step_create_vmx.go

firmware = "{{ .firmware }}"
vhv.enable = "{{ .nested }}"

Use Case(s)

Windows 11 System Requirements

Potential configuration

"firmware": "efi-secure"
"nested": true
"force_bios_setup": false

Potential References

Can we get a new tag of this repo?

I built packer using the main branch of this and it resolves the ISO exported to OVF issue that I'm experiencing. I was going to submit a PR against the main packer repo to update this dependency, but there's no tag here to reference.

Packer vmware-iso builder incorrectly setting cpus value

This issue was originally opened by @kenleexyz in hashicorp/packer#11231 and has been migrated to this repository. The original issue description is below.


Overview of the Issue

vmware-iso builder appears to be incorrectly dividing the cpus option value by the cores / cpuid.coresPerSocket option value.

Reproduction Steps

  1. Create a template which uses the vmware-iso builder.
  2. Set cpus option to 1.
  3. Set cores option to 2.
  4. Inititate Packer build.
  5. In VMware Workstation, open the VM settings pane for the Packer VM and observe under 'Processors' that the number of processors / CPU sockets is Invalid: 0.5 (expect 1).

Same behaviour observed when cpus set to 2, cores set to 2. VMware shows number of processors as 1 (expect 2).

Same behaviour when using cpuid.coresPerSocket option under vmx_data.

image

Packer version

Packer v1.7.4

Simplified Packer Buildfile

source "vmware-iso" "ubuntu-amd64" {
  // Hardware resources
  cpus                    = 1
  cores                   = 2
  disk_size               = 32768
  disk_adapter_type       = "scsi"
  memory                  = 2048
  network                 = "NAT"

  // Communicator settings
  communicator            = "ssh"
  ssh_handshake_attempts  = 50
  ssh_password            = "vagrant"
  ssh_port                = 22
  ssh_timeout             = "10m"
  ssh_username            = "vagrant"

  // Guest OS settings
  guest_os_type           = "ubuntu-64"
  shutdown_command        = "echo 'vagrant' | sudo -S shutdown -P now"
  tools_upload_flavor     = "linux"
}

build {
  source "source.vmware-iso.ubuntu-amd64" {
    name                = "ubuntu-20-04"
    boot_command        = [" <wait>"," <wait>"," <wait>"," <wait>"," <wait>","<esc><wait>","<f6><wait>","<esc><wait>","<bs><bs><bs><bs><wait>"," autoinstall<wait5>"," ds=nocloud-net<wait5>",";s=http://<wait5>{{.HTTPIP}}<wait5>:{{.HTTPPort}}/<wait5>"," ---<wait5>","<enter><wait5>"]
    boot_wait           = "5s"
    iso_url             = "https://releases.ubuntu.com/20.04.2/ubuntu-20.04.2-live-server-amd64.iso"
    iso_checksum        = "sha256:d1f2bf834bbe9bb43faf16f9be992a6f3935e65be0edece1dee2aa6eb1767423"
    http_directory      = "resources/http"
  }

  post-processor "vagrant" {
    output              = "my.box"
  }
}

Operating system and Environment details

Windows 10 20H2 (Build 19042.1165)
VMware Workstation Pro 16.1.2 (Build 17966106)

MacOS Big Sur / VMWare Fusion / DHCPD Leases / Mac Address Wrong?

I couldn't find a better place to ask the question or bring up the issue ...

On cloned vmx of windows 10, the ethernet adapter gets a "generated" mac address from packer and it gets a "generated" if you manually create a full clone.

In both cases the VM gets an IP from the MacOS DHCPD instance and you can see the lease in the /var/db/dhcpd_leases file BUT the mac address is just wrong.

Examples:

  • cloned via vmware fusion UI
    • host reports 00:0c:29:50:da:5e / 192.168.12.29
    • vmware reports 0:c:29:5:e5:6e (short form) / 192.168.12.29

After my 30+ testing this, it suddenly started working, and I'm not sure why. Anyone have a theory or know why this behavior exists. It doesn't appear to be packer specific, but given packer is one of the primary programmatic ways to interact with fusion, I suspect people here would have see it or would know how to troubleshoot.

Packer not able to assign static IP with Custom Host Only network on a Centos Machine with vmware type vmware-iso

Operating system and Environment details

VMware Workstation 16 Pro (16.1.2 build-17966106)
Windows Version 20014 (OS Build 19041.1165)

Packer version

From packer version 1.7.4

Overview of the Issue

I am trying to build a CentOS 7 machine using kickstart file using my custom router on my VMware workstation with Static IP address. When I want to create custom static IP with in the range of my router, it throws error. Manually creating the machine in VMware workstation with static IP works with out any issue also with DHCP/NAT.

Any help is appreciated.

Errors:

dracut-initqueue[571]: mount: /dev/sr0 is write-protected, mounting read-only
dracut-initqueue[571]: RTNETLINK answers: File exists

....

Warning: dracut-initqueue timeout - starting timeout scripts

Reproduction Steps

Steps to reproduce this issue

Simplified Kickstart file

install
cdrom

graphical

lang en_US.UTF-8

keyboard --vckeymap=us --xlayouts='us' 

network --bootproto=static --device=ens33 --activate  --onboot=yes --ip=192.168.11.89 --netmask=255.255.255.0 --gateway=192.168.11.3 --nameserver=8.8.8.8 --noipv6  #--hostname=centos7packer

network --hostname=centos7packer

rootpw --iscrypted $6$rhel6usgcb$aS6oPGXcPKp3OtFArSrhRwu6sN8q2.yEGY7AIwDOQd23YCtiz9c5mXbid1BzX9bmXTEZi.hCzTEXFosVBI5ng0
services --enabled=iptables,rsyslog,sshd,NetworkManager

firewall --disabled

authconfig --enableshadow --passalgo=sha512

selinux --disabled

timezone --utc 	America/New_York

bootloader --location=mbr --append="no_timer_check console=tty0 console=ttyS0,115200 biosdevname=0" --password=$6$rhel6usgcb$kOzIfC4zLbuo3ECp1er99NRYikN419wxYMmons8Vm/37Qtg0T8aB9dKxHwqapz8wWAFuVkuI/UJqQBU92bA5C0
autopart --type=lvm

clearpart --linux --initlabel

# Packages selection
%packages --ignoremissing
Require @Base
@Base
@core
sed
perl
less
dmidecode
bzip2
iproute
iputils
sysfsutils
rsync
nano
mdadm
setserial
man-pages.noarch
findutils
tar
net-tools
tmpwatch
lsof
python
screen
lvm2
curl
ypbind
yp-tools
smartmontools
openssh-clients
acpid
irqbalance
which
bind-utils
ntsysv
ntp
man
#mysql
postfix
chkconfig
gzip
%end 
# End of %packages section
#%include /tmp/network.ks

%pre 
echo "Starting Kickstart Pre-Installation..."
%end

%post 
cat > /etc/cron.d/ntpdate < /dev/null 2>&1
EOF

yum -y install open-vm-tools
chkconfig ntpd on
chkconfig sshd on
chkconfig ypbind on
chkconfig iptables off
chkconfig ip6tables off
chkconfig yum-updatesd off
chkconfig haldaemon off
chkconfig mcstrans off
chkconfig sysstat off
hostnamectl set-hostname ecs1.shoneslab.local
hostnamectl --pretty set-hostname ecs1.shoneslab.local
cp /etc/hostname /mnt/sysimage/etc/hostname
cp /etc/machine-info /mnt/sysimage/etc/machine-info
sed -i 's/.*PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config

cat > /etc/motd <> /etc/motd

echo >> /etc/motd

%end

reboot --eject

Simplified Packer Buildfile




source "vmware-iso" "centos7" {
  boot_command     = ["<tab><bs><bs><bs><bs><bs>text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"]
  boot_wait        = "10s"
  cpus             = "2"
  disk_size        = "25600"
  guest_os_type    = "centos-64"
  headless         = false
  http_directory   = "http"
  iso_checksum     = "07b94e6b1a0b0260b94c83d6bb76b26bf7a310dc78d7a9c7432809fb9bc6194a"
  iso_url          = "C:/Softwares/CentOS/CentOS-7-x86_64-Minimal-2009.iso"
  memory           = "4096"
  output_directory = "C:/VM/centos7-packer"
  shutdown_command = "shutdown -P now"
  ssh_password     = "server"
  ssh_port         = 22
  ssh_timeout      = "30m"
  ssh_username     = "root"
  vm_name          = "centos7-packer"
  vmx_data = {
    "ethernet0.connectionType" = "custom"
    "ethernet0.addressType" = "generated"
    "ethernet0.vnet" = "VMnet0"
    "ethernet0.displayName" = "VMnet0"
    "ethernet0.virtualDev" = "e1000"
    "ethernet0.present" = "TRUE"
    "ethernet0.pciSlotNumber" = "33"
  }
}

build {
  sources = ["source.vmware-iso.centos7"]
}

Vmware-iso cannot correctly mount CD-ROM (DEBIAN)

This issue was originally opened by @KyuOthmane as hashicorp/packer#11095. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

I'm trying to build a debian 9 image using (vmware-iso builder) but stuck on mouting CD-ROM
the iso image is selected but not recognized by vmware.
https://ibb.co/qYMPcRM

Reproduction Steps

Build a Debian using vmware-iso builder

Packer version

From 1.7.2

Simplified Packer Buildfile

{
  "builders":[
  {
      "name": "vmware",
      "type": "vmware-iso",
      "remote_type": "esx5",
      "remote_host": "my_host",
      "remote_username": "username,
      "remote_password": "password",
      "remote_datastore": "my_datastore",
      "ssh_host": "host_ssh",
      "ssh_username": "ssh_username",
      "ssh_password": "ssh_password",
      "vnc_over_websocket": true,
      "insecure_connection": true,
      "keep_registered": true,
      "disk_adapter_type": "ide",
      "cdrom_adapter_type": "ide",
      "iso_url": "https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-xfce-CD-1.iso",
      "iso_checksum": "57d542383401985920d5cd65cc66f24e946e846b32ae3359cfbe9274bd489dea",
      "iso_target_path": "packer_cache/08cec4ad4b6a9096e8cde4b31b224bfc7984333b.iso",
      "boot_wait": "5s",
      "memory": "4096",
      "disk_size": "12000",
      "skip_export": true,
      "ovftool_options": [
      "--noSSLVerify"
      ],
      "tools_upload_flavor": "linux",
      "guest_os_type": "debian9-64",
      "headless": true,
      "shutdown_command": "shutdown -P now",
      "http_directory": "http",
      "http_port_min" : 8001,
      "http_port_max": 8001,
      "cleanup_remote_cache": false,
      "boot_command": [
      "<esc><wait>",
      "debconf/frontend=noninteractive <wait>",
      "keyboard-configuration/xkb-keymap=fr <wait>",
      "grub-installer/bootdev=/dev/sda <enter>"
      ],
      "display_name": "packer_install",
      "vm_name": "packer_install",
      "vmdk_name": "packer_vmdk",
      "vmx_data": {
        "memory": "3072",
        "cpus": "3",
        "ethernet0.networkName": "VM Network 1"
      }
    }]
}

Operating system and Environment details

Debian 9

Log Fragments and crash.log files

2021/06/15 16:29:03 [INFO] Packer version: 1.7.2 [go1.16.3 linux amd64]
2021/06/15 16:29:03 [TRACE] discovering plugins in /usr/bin
2021/06/15 16:29:03 [TRACE] discovering plugins in /home/USER/.packer.d/plugins
2021/06/15 16:29:03 [TRACE] discovering plugins in .
2021/06/15 16:29:03 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/06/15 16:29:03 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/USER/.packerconfig
2021/06/15 16:29:03 [WARN] Config file doesn't exist: /home/USER/.packerconfig
2021/06/15 16:29:03 [INFO] Setting cache directory: /home/USER/devops_tools/packer/debian_v9/packer_cache
2021/06/15 16:29:03 [TRACE] Starting internal plugin packer-builder-vmware-iso
2021/06/15 16:29:03 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-builder-vmware-iso"}
2021/06/15 16:29:03 Waiting for RPC address for: /usr/bin/packer
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [INFO] Packer version: 1.7.2 [go1.16.3 linux amd64]
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/USER/.packerconfig
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [WARN] Config file doesn't exist: /home/USER/.packerconfig
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [INFO] Setting cache directory: /home/USER/devops_tools/packer/debian_v9/packer_cache
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: args: []string{"packer-builder-vmware-iso"}
2021/06/15 16:29:04 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin374531288
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Plugin address: unix /tmp/packer-plugin374531288
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Waiting for connection...
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Serving a plugin connection...
2021/06/15 16:29:04 Preparing build: vmware
2021/06/15 16:29:04 Build debug mode: false
2021/06/15 16:29:04 Force build: true
2021/06/15 16:29:04 On error:
2021/06/15 16:29:04 Waiting on builds to complete...
vmware: output will be in this color.
2021/06/15 16:29:04 Starting build run: vmware

2021/06/15 16:29:04 Running builder: vmware-iso
2021/06/15 16:29:04 [INFO] (telemetry) Starting builder vmware-iso
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [DEBUG] handshaking with SSH
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Keyboard interactive challenge:
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: -- User:
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: -- Instructions:
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: -- Question 1: Password:
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Keyboard interactive challenge:
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: -- User:
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: -- Instructions:
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [DEBUG] handshake complete!
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [INFO] no local agent socket, will not connect agent
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: esxcli --formatter csv system version get
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Connected to VMware ESXi 7.0.1 Releasebuild-16850804
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: esxcli --formatter csv system settings advanced list -o /Net/GuestIPHack
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Testing against vmware driver *common.ESX5Driver, Success: true
==> vmware: Retrieving ISO
==> vmware: Trying https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-xfce-CD-1.iso
2021/06/15 16:29:04 packer-builder-vmware-iso plugin: Acquiring lock for: https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-xfce-CD-1.i                                                                     so?checksum=sha256%3A57d542383401985920d5cd65cc66f24e946e846b32ae3359cfbe9274bd489dea (packer_cache/08cec4ad4b6a9096e8cde4b31b224bfc7984333b.iso.lock)
==> vmware: Trying https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-xfce-CD-1.iso?checksum=sha256%3A57d542383401985920d5cd65cc66f24e94                                                                     6e846b32ae3359cfbe9274bd489dea
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: Leaving retrieve loop for ISO
==> vmware: https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-xfce-CD-1.iso?checksum=sha256%3A57d542383401985920d5cd65cc66f24e946e846b3                                                                     2ae3359cfbe9274bd489dea => packer_cache/08cec4ad4b6a9096e8cde4b31b224bfc7984333b.iso
==> vmware: Configuring output and export directories...
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: test -e "/vmfs/volumes/RAID5_LOCAL/packer_install"
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: [ERROR] Remote command exited with '1': test -e "/vmfs/volumes/RAID5_LOCAL/packer_install"
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: mkdir -p "/vmfs/volumes/RAID5_LOCAL/packer_install"
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: No floppy files specified. Floppy disk will not be made.
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: No CD files specified. CD disk will not be made.
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: running: 57d542383401985920d5cd65cc66f24e946e846b32ae3359cfbe9274bd489dea  /vmfs/volumes/RAID5_LOCAL/packer_cache/                                                                     08cec4ad4b6a9096e8cde4b31b224bfc7984333b.iso | [sha256sum -c]
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:06 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: sha256sum -c
==> vmware: Remote cache was verified skipping remote upload...
==> vmware: Creating required virtual machine disks
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [INFO] Creating disk with Path: packer_install/packer_vmdk.vmdk and Size: 12000M
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: vmkfstools -c 12000M -d zeroedthick -a ide "/vmfs/volumes/RAID5_LOCAL/packer_inst                                                                     all/packer_vmdk.vmdk"
==> vmware: Building and writing VMX file
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Writing VMX to: /tmp/vmw-iso116615255/packer_install.vmx
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Configuring VMX...
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Setting VMX: 'ethernet0.networkName' = 'VM Network 1'
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Setting VMX: 'memory' = '3072'
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Setting VMX: 'cpus' = '3'
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Writing VMX to: /tmp/vmw-iso116615255/packer_install.vmx
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Suppressing messages in VMX
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Host IP for the VMware machine: IP_RUNNER
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Found available port: 8001 on IP: 0.0.0.0
==> vmware: Starting HTTP server on port 8001
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: Skipping VNC configuration step...
==> vmware: Registering remote VM...
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] Starting remote scp process:  scp -vt /vmfs/volumes/RAID5_LOCAL/packer_install
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] Started SCP session, beginning transfers...
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] Copying input data into temporary file so we can read the length
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] scp: Uploading packer_install.vmx: perms=C0644 size=2815
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] SCP session complete, closing stdin pipe.
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] Waiting for SSH session to complete.
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] scp stderr (length 36): Sink: C0644 2815 packer_install.vmx
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:10 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: vim-cmd solo/registervm "/vmfs/volumes/RAID5_LOCAL/packer_install/packer_install.                                                                     vmx"
==> vmware: Starting virtual machine...
    vmware: If the run isn't succeeding as you expect, please enable the GUI
    vmware: to inspect the progress of the build.
    vmware: The VM will be run headless, without a GUI, as configured.
2021/06/15 16:29:11 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
    vmware: If the run isn't succeeding as you expect, please enable the GUI
    vmware: to inspect the progress of the build.
2021/06/15 16:29:11 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: vim-cmd vmsvc/power.on 116
2021/06/15 16:29:12 packer-builder-vmware-iso plugin: [DEBUG] Opening new ssh session
2021/06/15 16:29:12 packer-builder-vmware-iso plugin: [DEBUG] starting remote command: vim-cmd vmsvc/power.getstate 116
==> vmware: Connecting to VNC over websocket...
2021/06/15 16:29:12 packer-builder-vmware-iso plugin: [DEBUG] websocket url: wss://IP_REMOTE:443/ticket/9fba87963526a982
==> vmware: Waiting 5s for boot...
==> vmware: Typing the boot command over VNC...
2021/06/15 16:29:17 packer-builder-vmware-iso plugin: Special code '<esc>' found, replacing with: 0xFF1B
2021/06/15 16:29:17 packer-builder-vmware-iso plugin: [INFO] Waiting 1s
2021/06/15 16:29:18 packer-builder-vmware-iso plugin: Sending char 'i', code 0x69, shift false
2021/06/15 16:29:18 packer-builder-vmware-iso plugin: Sending char 'n', code 0x6E, shift false
2021/06/15 16:29:19 packer-builder-vmware-iso plugin: Sending char 's', code 0x73, shift false
2021/06/15 16:29:19 packer-builder-vmware-iso plugin: Sending char 't', code 0x74, shift false
2021/06/15 16:29:19 packer-builder-vmware-iso plugin: Sending char 'a', code 0x61, shift false
2021/06/15 16:29:19 packer-builder-vmware-iso plugin: Sending char 'l', code 0x6C, shift false
2021/06/15 16:29:19 packer-builder-vmware-iso plugin: Sending char 'l', code 0x6C, shift false
2021/06/15 16:29:20 packer-builder-vmware-iso plugin: Sending char ' ', code 0x20, shift false
2021/06/15 16:29:20 packer-builder-vmware-iso plugin: [INFO] Waiting 1s
2021/06/15 16:29:21 packer-builder-vmware-iso plugin: Sending char 'p', code 0x70, shift false
2021/06/15 16:29:21 packer-builder-vmware-iso plugin: Sending char 'r', code 0x72, shift false
2021/06/15 16:29:21 packer-builder-vmware-iso plugin: Sending char 'e', code 0x65, shift false
2021/06/15 16:29:21 packer-builder-vmware-iso plugin: Sending char 's', code 0x73, shift false
2021/06/15 16:29:22 packer-builder-vmware-iso plugin: Sending char 'e', code 0x65, shift false
2021/06/15 16:29:22 packer-builder-vmware-iso plugin: Sending char 'e', code 0x65, shift false
2021/06/15 16:29:22 packer-builder-vmware-iso plugin: Sending char 'd', code 0x64, shift false
2021/06/15 16:29:22 packer-builder-vmware-iso plugin: Sending char '/', code 0x2F, shift false
2021/06/15 16:29:22 packer-builder-vmware-iso plugin: Sending char 'u', code 0x75, shift false
2021/06/15 16:29:23 packer-builder-vmware-iso plugin: Sending char 'r', code 0x72, shift false
2021/06/15 16:29:23 packer-builder-vmware-iso plugin: Sending char 'l', code 0x6C, shift false
2021/06/15 16:29:23 packer-builder-vmware-iso plugin: Sending char '=', code 0x3D, shift false
2021/06/15 16:29:23 packer-builder-vmware-iso plugin: Sending char 'h', code 0x68, shift false
2021/06/15 16:29:23 packer-builder-vmware-iso plugin: Sending char 't', code 0x74, shift false
2021/06/15 16:29:24 packer-builder-vmware-iso plugin: Sending char 't', code 0x74, shift false
2021/06/15 16:29:24 packer-builder-vmware-iso plugin: Sending char 'p', code 0x70, shift false
2021/06/15 16:29:24 packer-builder-vmware-iso plugin: Sending char ':', code 0x3A, shift true
2021/06/15 16:29:24 packer-builder-vmware-iso plugin: Sending char '/', code 0x2F, shift false
2021/06/15 16:29:25 packer-builder-vmware-iso plugin: Sending char '/', code 0x2F, shift false
2021/06/15 16:29:25 packer-builder-vmware-iso plugin: Sending char '1', code 0x31, shift false
2021/06/15 16:29:25 packer-builder-vmware-iso plugin: Sending char '9', code 0x39, shift false
2021/06/15 16:29:25 packer-builder-vmware-iso plugin: Sending char '2', code 0x32, shift false
2021/06/15 16:29:25 packer-builder-vmware-iso plugin: Sending char '.', code 0x2E, shift false
2021/06/15 16:29:26 packer-builder-vmware-iso plugin: Sending char '1', code 0x31, shift false
2021/06/15 16:29:26 packer-builder-vmware-iso plugin: Sending char '6', code 0x36, shift false
2021/06/15 16:29:26 packer-builder-vmware-iso plugin: Sending char '8', code 0x38, shift false

ISO file still attached to vSphere template

Overview of the Issue

I'm using packer 1.7.7 to build several linux distros like ubuntu, debian and almalinux/centos. After updating the json-based config to hcl, all my templates have an ISO file connected in vsphere.

Reproduction Steps

Use packer 1.7.7 and a remote ESXi server to build images and upload them to vsphere and mark them as a template

Packer version

1.7.7

Simplified Packer Template

https://gist.github.com/Isotop7/44d91bee7c81fb6d4c08dc0b4f6f196f

Operating system and Environment details

Packer runner: Ubuntu 20.04.3 LTS
Builder: ESXi 7.0 U2
vSphere Hosts: ESXi 7.0 U2 and U3

Log Fragments and crash.log files

image

How to specify multiple ISO definition in a vmware-iso JSON file

is it possible to add multiple CD drives at time vmaware-iso build?
say one would for OS ISO and other would be Vmware tool

Issues on GitHub are intended to be related to bugs or feature requests, so we
recommend using our other community resources instead of asking here if you
have a question.

vmware player builds don't work on currently supported versions

This issue was originally opened by @mwhooker as hashicorp/packer#5787. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


the vmware player builder needs a couple of tools, including vmrun. According to this thread, vmrun was deprecated in version 12. It may be possible to get it running with VIX api libraries.

We should either figure out how to get builds to run with the currently available player, or refuse to run with a useful error message if the wrong version of player is installed.

See:
#1102
#4503
and reverted commit c5ec92c88bb154bd317aec5b81ba6cf9e4dff9c4

packer-builder-vmware-iso plugin: failed to unlock port lockfile: close tcp [::]:5907: use of closed network connection

This issue was originally opened by @dyzone in hashicorp/packer#11779 and has been migrated to this repository. The original issue description is below.


pls help i keep getting this error: packer-builder-VMware-iso plugin: failed to unlock port lockfile: close tcp [::]:5907: use of closed network connection

"builders": [{
      "type": "vmware-iso",
      "iso_url": "https://ussl-toolsp.usanainc.com/artifactory/centos-remote/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso",
      "iso_checksum": "07b94e6b1a0b0260b94c83d6bb76b26bf7a310dc78d7a9c7432809fb9bc6194a",
      "boot_command": [
        "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
      ],
      "boot_wait": "10s",
      "guest_os_type": "centos-64",
      "http_directory": "http",
      "ssh_username": "root",
      "ssh_password": "changeme",
      "ssh_wait_timeout": "10m",
      "disk_size": "60000",
      "disk_type_id":"0",
      "tools_upload_flavor": "linux",
      "vnc_bind_address": "0.0.0.0",
      "vm_name":"CentOS_7.7_Template",
      "name":"CentOS_7.7_Template",
      "vnc_disable_password": true,
      "vnc_port_min": 5901,
      "vnc_port_max": 5909,
      "shutdown_command": "sudo /sbin/halt -p",
      "headless": "true",
      "output_directory": "output-vmware-iso"
    }]

==> CentOS_7.7_Template: Starting HTTP server on port 8941
2022/05/15 07:54:33 packer-builder-vmware-iso plugin: Looking for available port between 5901 and 5909
2022/05/15 07:54:33 packer-builder-vmware-iso plugin: Found available port: 5907 on IP: 0.0.0.0
2022/05/15 07:54:33 packer-builder-vmware-iso plugin: Found available VNC port: 0.0.0.0:5907
2022/05/15 07:54:33 packer-builder-vmware-iso plugin: Writing VMX to: output-vmware-iso/CentOS_7.7_Template.vmx
==> CentOS_7.7_Template: Starting virtual machine...
CentOS_7.7_Template: The VM will be run headless, without a GUI. If you want to
CentOS_7.7_Template: view the screen of the VM, connect via VNC with the password "" to
CentOS_7.7_Template: vnc://0.0.0.0:5907
2022/05/15 07:54:33 packer-builder-vmware-iso plugin: Executing: /usr/bin/vmrun -T ws start output-vmware-iso/CentOS_7.7_Template.vmx nogui
CentOS_7.7_Template: view the screen of the VM, connect via VNC with the password "" to
CentOS_7.7_Template: vnc://0.0.0.0:5907
2022/05/15 07:54:34 packer-builder-vmware-iso plugin: stdout: Error: The operation was canceled
2022/05/15 07:54:34 packer-builder-vmware-iso plugin: stderr:
==> CentOS_7.7_Template: Error starting VM: VMware error: Error: The operation was canceled
==> CentOS_7.7_Template: Waiting 4.706809746s to give VMware time to clean up...
2022/05/15 07:54:38 packer-builder-vmware-iso plugin: Executing: /usr/bin/vmrun -T ws list
2022/05/15 07:54:38 packer-builder-vmware-iso plugin: stdout: Total running VMs: 0
2022/05/15 07:54:38 packer-builder-vmware-iso plugin: stderr:
2022/05/15 07:54:38 packer-builder-vmware-iso plugin: failed to unlock port lockfile: close tcp [::]:5907: use of closed network connection
==> CentOS_7.7_Template: Deleting output directory...
2022/05/15 07:54:38 [INFO] (telemetry) ending CentOS_7.7_Template
==> Wait completed after 11 seconds 856 milliseconds
2022/05/15 07:54:38 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2022/05/15 07:54:38 machine readable: CentOS_7.7_Template,error []string{"Error starting VM: VMware error: Error: The operation was canceled"}
==> Builds finished but no artifacts were created.
Build 'CentOS_7.7_Template' errored after 11 seconds 856 milliseconds: Error starting VM: VMware error: Error: The operation was canceled

==> Wait completed after 11 seconds 856 milliseconds

==> Some builds didn't complete successfully and had errors:
--> CentOS_7.7_Template: Error starting VM: VMware error: Error: The operation was canceled

==> Builds finished but no artifacts were created.
2022/05/15 07:54:38 [INFO] (telemetry) Finalizing.
2022/05/15 07:54:39 waiting for all plugin processes to complete...
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
2022/05/15 07:54:39 /usr/local/bin/packer: plugin process exited
[root@ussl-bamboobuildp01 centos_7x]# PACKER_LOG=1
[root@ussl-bamboobuildp01 centos_7x]# 1

VMware Workstation on Windows: "Incorrect path in network mappings"

Windows 11
VMwareยฎ Workstation 16 Pro (16.2.2 build-19200509)
Packer v1.7.10
Plugin pulled today

When running packer build on a freshly setup system it fails with:

"Could not determine network mappings from files in path: C:/Program Files (x86)/VMware/VMware Workstation"

Workstation 16 Pro has installed network files in "C:\ProgramData\VMware", the missing file is netmap.conf. If netmap.conf is placed in the directory stated and not "C:\ProgramData\VMware" the build continues to fail with the same message. I only found this out after realising netmap.conf could be made by editing the network config with vmware and by chance Packer started working.

Originally I was putting a copy of netmap.conf in the stated directory and packer still wouldn't work. After using the network editor and it working I then tested Packer with the file only in one location at a time and it would not work under "C:/Program Files (x86)/VMware/VMware Workstation" which is the stated directory in the message. I'm guessing there was a change in structure at some point for VMware and the error message was overlooked.

Thanks
Luke

Windows 10 / VMware Workstation 16 ... Webserver for preseed not reachable from VM

Overview of the Issue

Windows 10 / VMware Workstation 16 ... webserver for pressed not reachable from vm, so the installation hangs when the OS is looking for the preseed file ... From a debian installation I could start the shell. Pinging the preseed webserver ip works but a wget or netcat on that port doesn't work. From the Windows 10 machin itself I can reach the webserver and open the file via browser or wget.
On an ubuntu 20.10 install also with VMware Workstation 16 it works without problems. Similar problems happen when I use an ubuntu template.
VMware Workstation network adapter config (virtual network editor) looks ok for me.

Reproduction Steps

Steps to reproduce this issue:
Windows 10 Build 21370.1
VMWare Workstation 16.1.1 build-17801498
Debian Template from Bento:
https://raw.githubusercontent.com/chef/bento/master/packer_templates/debian/debian-9.13-amd64.json

Packer version

1.7.2

Simplified Packer Buildfile

https://raw.githubusercontent.com/chef/bento/master/packer_templates/debian/debian-9.13-amd64.json

Operating system and Environment details

Windows 10 Build 21370.1
VMWare Workstation 16.1.1 build-17801498
Started from Powershell
packer installed with chocolatey

image

Log Fragments and crash.log files

https://gist.github.com/ssahlender/e5a106644efd3a0eac3cefea762ad548

Additional Disks Do Not Get Configured and Mounted Correctly When Using a Non-SCSI Disk Adapter Type

Overview of the Issue

When specifying multiple disks with disk_additional_size = [...] in combination with a non-SCSI adapter type, e. g. disk_adapter_type = "nvme" or disk_adapter_type = "sata", only the first disk is available.
VMs with a bus adapter type that uses SCSI will not experience the problem.
The error appears regardless of using BIOS or UEFI.

Reproduction Steps

Add the following code to a working Packer configuration:

disk_additional_size = [ 
  204800, # Disk 1
  51200, # Disk 2
  204800, # Disk 3
]
disk_adapter_type = "nvme"

Your VM will boot up with only one NVMe disk connected.
To verify, open the settings of the VM and see that only one disk shows up.
Checking the .vmx-file will reveal, that the additional disks have been created with adapter type lsilogic.
The same is true for disk_adapter_type = "sata".

Plugin and Packer version

Tested on:

  • Packer 1.8.3
  • VMware plugin 1.0.7

Simplified Packer Buildfile

source "vmware-iso" "test-multiple-non-scsi-disks" {
  iso_url = https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.5.0-amd64-netinst.iso
  iso_checksum = 6a6607a05d57b7c62558e9c462fe5c6c04b9cfad2ce160c3e9140aa4617ab73aff7f5f745dfe51bbbe7b33c9b0e219a022ad682d6c327de0e53e40f079abf66a
  vm_name = "Test Multiple Non-SCSI Disks"
  cpus = 4
  memory = 8192
  cores = 4
  sound = true
  usb = true
  disk_size = "40960"
  disk_additional_size = [
    30720, # Disk 2
    92160, # Disk 3
    122880, # Disk 4
  ]
  disk_adapter_type = "nvme"
  vmx_data = {
    "bios.bootorder" = "", # Avoids error "No compatible bootloader found."
    "firmware" = "efi",
  }
  network_adapter_type = "vmxnet3"
  version = 19 # VMware Workstation Pro 16.2.x and official Debian 11 support
  guest_os_type = "debian11-64"
}

Virtual Hardware version 19 (equivalent to Workstation Pro 16.2.x) is required for official Debian 11 support.

Operating system and Environment details

  • Host OS: Microsoft Windows 10 21H2
  • Hypervisor: VMware Workstation Pro 16.2.3
  • Guest OS: Debian 11 "Bullseye" 64-Bit (amd64)

Log Fragment

2022/09/13 15:14:19 ui: ==> vmware-iso.test-multiple-non-scsi-disks: Creating required virtual machine disks
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 [INFO] Creating disk with Path: output-test-multiple-non-scsi-disks\disk.vmdk and Size: 40960M
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 Executing: C:/Program Files (x86)/VMware/VMware Workstation/vmware-vdiskmanager.exe -c -s 40960M -a nvme -t 1 output-test-multiple-non-scsi-disks\disk.vmdk
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 stdout: Creating disk 'output-test-multiple-non-scsi-disks\disk.vmdk'
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: Virtual disk creation successful.
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 stderr:
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 [INFO] Creating disk with Path: output-test-multiple-non-scsi-disks\disk-1.vmdk and Size: 30720M
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 Executing: C:/Program Files (x86)/VMware/VMware Workstation/vmware-vdiskmanager.exe -c -s 30720M -a nvme -t 1 output-test-multiple-non-scsi-disks\disk-1.vmdk
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 stdout: Creating disk 'output-test-multiple-non-scsi-disks\disk-1.vmdk'
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: Virtual disk creation successful.
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 stderr:
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 [INFO] Creating disk with Path: output-test-multiple-non-scsi-disks\disk-2.vmdk and Size: 92160M
2022/09/13 15:14:19 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:19 Executing: C:/Program Files (x86)/VMware/VMware Workstation/vmware-vdiskmanager.exe -c -s 92160M -a nvme -t 1 output-test-multiple-non-scsi-disks\disk-2.vmdk
2022/09/13 15:14:20 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:20 stdout: Creating disk 'output-test-multiple-non-scsi-disks\disk-2.vmdk'
2022/09/13 15:14:20 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: Virtual disk creation successful.
2022/09/13 15:14:20 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:20 stderr:
2022/09/13 15:14:20 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:20 [INFO] Creating disk with Path: output-test-multiple-non-scsi-disks\disk-3.vmdk and Size: 122880M
2022/09/13 15:14:20 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:20 Executing: C:/Program Files (x86)/VMware/VMware Workstation/vmware-vdiskmanager.exe -c -s 122880M -a nvme -t 1 output-test-multiple-non-scsi-disks\disk-3.vmdk
2022/09/13 15:14:20 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: 2022/09/13 15:14:20 stdout: Creating disk 'output-test-multiple-non-scsi-disks\disk-3.vmdk'
2022/09/13 15:14:20 packer-plugin-vmware_v1.0.7_x5.0_windows_amd64.exe plugin: Virtual disk creation successful.

VMX-File Excerpts

Primary Disk (NVMe)

nvme0.pciSlotNumber = "192"
nvme0.present = "TRUE"
nvme0:0.present = "TRUE"
nvme0:0.redo = ""
nvme0:0.filename = "disk.vmdk"

Additional Disks (SCSI)

scsi0.pcislotnumber = "-1"
scsi0.present = "FALSE"
scsi0.virtualdev = "lsilogic"
scsi0:0.redo = ""
scsi0:1.filename = "disk-1.vmdk"
scsi0:1.present = "FALSE"
scsi0:1.redo = ""
scsi0:2.filename = "disk-2.vmdk"
scsi0:2.present = "FALSE"
scsi0:2.redo = ""
scsi0:3.filename = "disk-3.vmdk"
scsi0:3.present = "FALSE"
scsi0:3.redo = ""

Add support for VMware Cloud Director (VCD) builder

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I would very much like to use packer in our VMware Cloud Director (VCD) environment natively. I am aware that there is a vSphere-iso builder, but that is, imho, just a workaround and does not help tenants without access to the vSphere backend at all.

Use Case(s)

A VCD Packer builder would enable us to move heavily towards immutable infrastructure on our VCD environment. We already have years of experience doing that on public clouds like azure or gcp.

References

There are multiple references here and there and many people have tried to create a Packer builder in the past. See #1824 and #3280 for example. These are already pretty old and relied on a deprecated library. The new library would be vmware/go-vcloud-director, which is also used for the VCD Terraform provider and maintained by the same devs.
There has also been another try by a dev, but that did not go anywhere, since he did not manage to find a publicly available instance to test against. He was also stuck on this issue regarding the go-vcloud-director library.

Let's see if this leads to anywhere :)

`vmware-iso`: Error: "ExtraConfig options exists in source (use --allowExtraConfig option to allow this)"

This issue was originally opened by @stevetavve as hashicorp/packer#5886. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Getting this error when I add "format": "ova" to builders.

ln issue hashicorp/packer#5771, the thread asks for a simple repro case. I am running into 100% of the time when I add "format". Posted to the packer community and was instructed to open a new issue referencing 5771.

Without format option, the build is successful.

packer version is 1.1.3
ovftool version is 4.2.0
Host platform is centos-release-7-2.1511.el7.centos.2.10.x86_64
VMware vCenter is 6.5.0 Update 1 (Build 6765664)

Associated files: json, ks file, packer log output
https://gist.github.com/stevetavve/823aaeee8911994fdf20df2bcc86d945

`vmware-iso` never invokes `boot_command`

Overview of the Issue

I am trying to run a build using VMware Fusion Pro and an Ubuntu 20.04 image. I am using the following boot command:

  boot_command = [
    "<enter><enter><f6><esc><wait> ",
    "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
    "<enter>"
  ]

Which works well in my vsphere-iso builds, but does not seem to ever be called when running vmware-iso builds. The last log I see is Starting virtual machine..., and eventually Error starting VM: VMware error: Error: Cannot connect to the virtual machine.

Watching what happens in VMware Fusion, the VM starts up with the Ubuntu ISO, the installer loads, passes the area where the boot command can be entered, and then ends up on the default "Welcome!" language selection screen. Eventually I end up with the above "cannot connect to VM" error.

Reproduction Steps

Create a simple Ubuntu build using vmware-iso, VMware Fusion, and the above boot command. Run with debug settings and notice the VM starts but apparently can't be connected to, and the boot command is never sent.

Plugin and Packer version

Packer v1.8.3
git github.com/ethanmdavidson/git ">= 0.3.2"

Simplified Packer Buildfile

Packer Buildfile
data "git-commit" "cwd_head" {}

locals {
  ssh_username           = "user"
  ssh_password           = var.ssh-password
  ssh_port               = "20022"
  ssh_pty                = true
  ssh_handshake_attempts = "40"
  ssh_timeout            = "20m"
  boot_wait              = "5s"
  boot_command = [
    "<enter><enter><f6><esc><wait> ",
    "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
    "<enter>"
  ]
  guest_os_type        = "ubuntu64Guest"
  http_directory       = "subiquity/http"
  shutdown_command     = "echo '${var.ssh-password}' | sudo -S shutdown -P now"
  storage = {
    disk_size             = 122880
  }
}

local "execute_command" {
  expression = "echo '${var.ssh-password}' | {{.Vars}} sudo -S -E bash '{{.Path}}'"
  sensitive  = true
}


source "vmware-iso" "ubuntu20_small" {
  # E.g. 'ubu-build-20220803113100-b5ee72a3'
  vm_name = "ubu-build-${regex_replace(timestamp(), ".*(T|:|-).*", "")}-${split("-", uuidv4())[0]}"
  cpus    = 2
  memory     = 8192

  ssh_username           = local.ssh_username
  ssh_password           = local.ssh_password
  ssh_port               = local.ssh_port
  ssh_pty                = local.ssh_pty
  ssh_handshake_attempts = local.ssh_handshake_attempts
  ssh_timeout            = local.ssh_timeout

  iso_url = "file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso"
  iso_checksum = "28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad"

  disk_size = local.storage.disk_size

  boot_wait            = local.boot_wait
  boot_command         = local.boot_command
  guest_os_type        = local.guest_os_type
  http_directory       = local.http_directory
  shutdown_command     = local.shutdown_command
}


build {
  sources = [
    "source.vmware-iso.ubuntu20_small"
  ]

  provisioner "file" {
    destination = "/tmp/00-motd"
    source      = "scripts/00-motd"
  }

  provisioner "shell" {
    execute_command = "${local.execute_command}"
    script          = "scripts/common/setup.sh"
  }

  provisioner "shell" {
    execute_command = "${local.execute_command}"
    script          = "scripts/common/cleanup.sh"
  }

}

Operating system and Environment details

macOS 12.5 (Intel x86_64).
VMware Fusion Professional Version 12.2.4 (20071091)

Log Fragments and crash.log files

Packer Debug Logs
2022/08/08 09:18:02 [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:18:02 [TRACE] discovering plugins in /usr/local/bin
2022/08/08 09:18:02 [TRACE] discovering plugins in /Users/me/.config/packer/plugins
2022/08/08 09:18:02 [DEBUG] Discovered plugin: git = /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64
2022/08/08 09:18:02 found external [commit repository tree] datasource from git plugin
2022/08/08 09:18:02 [TRACE] discovering plugins in .
2022/08/08 09:18:02 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:18:02 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:18:02 [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:18:02 [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:18:02 [TRACE] listing potential installations for "github.com/ethanmdavidson/git" that match ">= 0.3.2". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/usr/local/bin/packer", ".", "/Users/me/.config/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0006b0080)}}}}
2022/08/08 09:18:02 [TRACE] Found the following "github.com/ethanmdavidson/git" installations: [{/Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64 v0.3.2}]
2022/08/08 09:18:02 found external [commit repository tree] datasource from git plugin
2022/08/08 09:18:02 [TRACE] validateValue: not active for vsphere-datacenter, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for vsphere-datastore, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for iso-url, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for vsphere-password, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for ssh-password, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for vsphere-cluster, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for vsphere-network, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for vsphere-server, so skipping
2022/08/08 09:18:02 [TRACE] validateValue: not active for vsphere-user, so skipping
2022/08/08 09:18:02 [TRACE] Starting external plugin /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64 start datasource commit
2022/08/08 09:18:02 Starting plugin: /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64 []string{"/Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64", "start", "datasource", "commit"}
2022/08/08 09:18:02 Waiting for RPC address for: /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64
2022/08/08 09:18:02 Received unix RPC address for /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin3739552183
2022/08/08 09:18:02 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:18:02 Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin3739552183
2022/08/08 09:18:02 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:18:02 Waiting for connection...
2022/08/08 09:18:02 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:18:02 Serving a plugin connection...
2022/08/08 09:18:02 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:18:02 [TRACE] starting datasource commit
2022/08/08 09:18:02 [TRACE] Starting internal plugin packer-builder-vmware-iso
2022/08/08 09:18:02 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-vmware-iso"}
2022/08/08 09:18:02 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: args: []string{"packer-builder-vmware-iso"}
2022/08/08 09:18:02 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin2888302291
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin2888302291
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: Waiting for connection...
2022/08/08 09:18:02 packer-builder-vmware-iso plugin: Serving a plugin connection...
2022/08/08 09:18:02 [TRACE] Starting internal plugin packer-provisioner-file
2022/08/08 09:18:02 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-file"}
2022/08/08 09:18:02 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:18:02 packer-provisioner-file plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:18:02 packer-provisioner-file plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:18:02 packer-provisioner-file plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:18:02 packer-provisioner-file plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:18:02 packer-provisioner-file plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:18:02 packer-provisioner-file plugin: args: []string{"packer-provisioner-file"}
2022/08/08 09:18:02 packer-provisioner-file plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin333495220
2022/08/08 09:18:02 packer-provisioner-file plugin: Waiting for connection...
2022/08/08 09:18:02 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin333495220
2022/08/08 09:18:02 packer-provisioner-file plugin: Serving a plugin connection...
2022/08/08 09:18:02 [TRACE] Starting internal plugin packer-provisioner-shell
2022/08/08 09:18:02 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-shell"}
2022/08/08 09:18:02 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:18:03 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:18:03 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2022/08/08 09:18:03 packer-provisioner-shell plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin979373942
2022/08/08 09:18:03 packer-provisioner-shell plugin: Waiting for connection...
2022/08/08 09:18:03 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin979373942
2022/08/08 09:18:03 packer-provisioner-shell plugin: Serving a plugin connection...
2022/08/08 09:18:03 [TRACE] Starting internal plugin packer-provisioner-shell
2022/08/08 09:18:03 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-shell"}
2022/08/08 09:18:03 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:18:03 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:18:03 packer-provisioner-shell plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:18:03 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2022/08/08 09:18:03 packer-provisioner-shell plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin4140100492
2022/08/08 09:18:03 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin4140100492
2022/08/08 09:18:03 packer-provisioner-shell plugin: Waiting for connection...
2022/08/08 09:18:03 packer-provisioner-shell plugin: Serving a plugin connection...
2022/08/08 09:18:03 Build debug mode: true
2022/08/08 09:18:03 Force build: false
2022/08/08 09:18:03 On error: ask
2022/08/08 09:18:03 Debug enabled, so waiting for build to finish: vmware-iso.ubuntu20_small
Debug mode enabled. Builds will not be parallelized.
2022/08/08 09:18:03 Starting build run: vmware-iso.ubuntu20_small
2022/08/08 09:18:03 Running builder:
2022/08/08 09:18:03 [INFO] (telemetry) Starting builder vmware-iso.ubuntu20_small
vmware-iso.ubuntu20_small: output will be in this color.

2022/08/08 09:18:03 packer-builder-vmware-iso plugin: Detected VMware version: 12
2022/08/08 09:18:03 packer-builder-vmware-iso plugin: Testing against vmware driver *common.Fusion6Driver, Success: true
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepPrepareTools'. Press enter to continue.
2022-08-08T09:18:05-07:00: ==> vmware-iso.ubuntu20_small: Retrieving ISO
2022-08-08T09:18:05-07:00: ==> vmware-iso.ubuntu20_small: Trying file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso
2022/08/08 09:18:05 packer-builder-vmware-iso plugin: Acquiring lock for: file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso?checksum=sha256%3A28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad (/Users/me/.cache/packer/47de2d7266acde194681de2a24f5d76b43b452ca.iso.lock)
2022-08-08T09:18:05-07:00: ==> vmware-iso.ubuntu20_small: Trying file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso?checksum=sha256%3A28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad
2022/08/08 09:18:08 packer-builder-vmware-iso plugin: Leaving retrieve loop for ISO
2022-08-08T09:18:08-07:00: ==> vmware-iso.ubuntu20_small: file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso?checksum=sha256%3A28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad => /Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepDownload'. Press enter to continue.
2022-08-08T09:18:10-07:00: ==> vmware-iso.ubuntu20_small: Configuring output and export directories...
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepOutputDir'. Press enter to continue.
2022/08/08 09:18:11 packer-builder-vmware-iso plugin: No floppy files specified. Floppy disk will not be made.
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepCreateFloppy'. Press enter to continue.
2022/08/08 09:18:11 packer-builder-vmware-iso plugin: No CD files specified. CD disk will not be made.
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepCreateCD'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepRemoteUpload'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepRemoteUpload'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepRemoteUpload'. Press enter to continue.
2022/08/08 09:18:13 packer-builder-vmware-iso plugin: [INFO] Creating disk with Path: output-ubuntu20_small/disk.vmdk and Size: 122880M
2022-08-08T09:18:13-07:00: ==> vmware-iso.ubuntu20_small: Creating required virtual machine disks
2022/08/08 09:18:13 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager -c -s 122880M -a lsilogic -t 1 output-ubuntu20_small/disk.vmdk
2022/08/08 09:18:13 packer-builder-vmware-iso plugin: stdout: Creating disk 'output-ubuntu20_small/disk.vmdk'
2022/08/08 09:18:13 packer-builder-vmware-iso plugin: Virtual disk creation successful.
2022/08/08 09:18:13 packer-builder-vmware-iso plugin: stderr:
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepCreateDisks'. Press enter to continue.
2022-08-08T09:18:13-07:00: ==> vmware-iso.ubuntu20_small: Building and writing VMX file
2022/08/08 09:18:13 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2022/08/08 09:18:13 packer-builder-vmware-iso plugin: Writing VMX to: output-ubuntu20_small/srt-ubu-build--13c60bec.vmx
==> vmware-iso.ubuntu20_small: Pausing after run of step 'stepCreateVMX'. Press enter to continue.
2022/08/08 09:18:14 packer-builder-vmware-iso plugin: Configuring VMX...
2022/08/08 09:18:14 packer-builder-vmware-iso plugin: Writing VMX to: output-ubuntu20_small/srt-ubu-build--13c60bec.vmx
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepConfigureVMX'. Press enter to continue.
2022/08/08 09:18:15 packer-builder-vmware-iso plugin: Suppressing messages in VMX
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepSuppressMessages'. Press enter to continue.
2022/08/08 09:18:15 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2022/08/08 09:18:15 packer-builder-vmware-iso plugin: HostIP discovered device matching nat: vmnet8
2022/08/08 09:18:15 packer-builder-vmware-iso plugin: Host IP for the VMware machine: 192.168.8.1
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepHTTPIPDiscover'. Press enter to continue.
2022/08/08 09:18:16 packer-builder-vmware-iso plugin: Found available port: 8030 on IP: 0.0.0.0
2022-08-08T09:18:16-07:00: ==> vmware-iso.ubuntu20_small: Starting HTTP server on port 8030
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepHTTPServer'. Press enter to continue.
2022/08/08 09:18:16 packer-builder-vmware-iso plugin: Looking for available port between 5900 and 6000
2022/08/08 09:18:16 packer-builder-vmware-iso plugin: Found available port: 5940 on IP: 127.0.0.1
2022/08/08 09:18:16 packer-builder-vmware-iso plugin: Found available VNC port: 127.0.0.1:5940
2022/08/08 09:18:16 packer-builder-vmware-iso plugin: Writing VMX to: output-ubuntu20_small/srt-ubu-build--13c60bec.vmx
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepConfigureVNC'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing after run of step 'StepRegister'. Press enter to continue.
2022-08-08T09:18:17-07:00: ==> vmware-iso.ubuntu20_small: Starting virtual machine...
2022/08/08 09:18:17 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmrun -T fusion start output-ubuntu20_small/srt-ubu-build--13c60bec.vmx gui
2022/08/08 09:19:47 packer-builder-vmware-iso plugin: stdout: Error: Cannot connect to the virtual machine
2022/08/08 09:19:47 packer-builder-vmware-iso plugin: stderr:
2022-08-08T09:19:47-07:00: ==> vmware-iso.ubuntu20_small: Error starting VM: VMware error: Error: Cannot connect to the virtual machine
2022-08-08T09:19:47-07:00: ==> vmware-iso.ubuntu20_small: Error starting VM: VMware error: Error: Cannot connect to the virtual machine
2022-08-08T09:19:47-07:00: ==> vmware-iso.ubuntu20_small: Step "StepRun" failed
==> vmware-iso.ubuntu20_small: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)? c
2022/08/08 09:19:54 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmrun -T fusion list
2022/08/08 09:19:54 packer-builder-vmware-iso plugin: stdout: Total running VMs: 0
2022/08/08 09:19:54 packer-builder-vmware-iso plugin: stderr:
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepRegister'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepConfigureVNC'. Press enter to continue.
2022/08/08 09:19:55 packer-builder-vmware-iso plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5940: use of closed network connection
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepHTTPServer'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepHTTPIPDiscover'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepSuppressMessages'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepConfigureVMX'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'stepCreateVMX'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepCreateDisks'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepRemoteUpload'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepRemoteUpload'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepRemoteUpload'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepCreateCD'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepCreateFloppy'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepOutputDir'. Press enter to continue.
2022-08-08T09:19:59-07:00: ==> vmware-iso.ubuntu20_small: Deleting output directory...
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepDownload'. Press enter to continue.
==> vmware-iso.ubuntu20_small: Pausing before cleanup of step 'StepPrepareTools'. Press enter to continue.
2022/08/08 09:20:00 [INFO] (telemetry) ending vmware-iso.ubuntu20_small
2022/08/08 09:20:00 Waiting on builds to complete...
==> Wait completed after 1 minute 57 seconds
2022/08/08 09:20:00 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2022/08/08 09:20:00 machine readable: vmware-iso.ubuntu20_small,error []string{"Error starting VM: VMware error: Error: Cannot connect to the virtual machine"}
==> Builds finished but no artifacts were created.
2022/08/08 09:20:00 [INFO] (telemetry) Finalizing.
2022-08-08T09:20:00-07:00: Build 'vmware-iso.ubuntu20_small' errored after 1 minute 57 seconds: Error starting VM: VMware error: Error: Cannot connect to the virtual machine

==> Wait completed after 1 minute 57 seconds

==> Some builds didn't complete successfully and had errors:
--> vmware-iso.ubuntu20_small: Error starting VM: VMware error: Error: Cannot connect to the virtual machine

==> Builds finished but no artifacts were created.
2022/08/08 09:20:01 waiting for all plugin processes to complete...
2022/08/08 09:20:01 /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64: plugin process exited
2022/08/08 09:20:01 /usr/local/bin/packer: plugin process exited
2022/08/08 09:20:01 /usr/local/bin/packer: plugin process exited
2022/08/08 09:20:01 /usr/local/bin/packer: plugin process exited
2022/08/08 09:20:01 /usr/local/bin/packer: plugin process exited

Additional Context

  • The example output above was generated with -debug set for more context, however, I have also tried this without that flag set.
  • I have played around with the boot_wait command to no avail. I've tried between 1-5 seconds.

WinRM proxy issues with VMWare Workstation.

This issue was originally opened by @theemptyone as hashicorp/packer#6775. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


My Environment is:

  • CentOS 7 Host System
  • VMWare Workstation
  • Windows 2016 VM.
  • Packer 1.3.1

VMWare Workstation setups a virtual nic on your system with a reserved ip space, in my case 172.16.50.1. Then when it creates a VM it uses dhcp within VMWare that sits on the subnet it created on the virtual switch with that as the default gateway.

The problem is that the WinRM connector (I assume) uses curl to check if WinRM is available. Curl does not respect ip ranges in no_proxy; which means that you cannot put that entire subnet into no_proxy by default. Since there is no way to 'set' the ip for the VM through packer (due to how VMWare works i believe), there is no way to logically pre-empt that with a variable wrapper.

An Option is needed to allow curl (again, i assume) to ignore proxy for everything before it runs it's validator, or to add the ip that packer connects to, to it's no_proxy env variable in it's local session.

I've been able to work around this for my test cases (Vmware generally reuses the ip for a rebuild, and i've narrowed the dhcp pool to 8 ips and added each of them to no_proxy), but this does not scale.

packer build stuck after Connecting to VM via VNC (127.0.0.1:5964)

This issue was originally opened by @atileren as hashicorp/packer#9847. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


when I was run packer build over ssh packer stucks the Connecting to VM via VNC (127.0.0.1:5964). I built centos 7.8 machine with headless true option. I have updated packer to 1.6.2. Is there any solution for this?

vmware-iso: view the screen of the VM, connect via VNC with the password "F8GCrvNX" to
vmware-iso: vnc://127.0.0.1:5964
vmware-iso: Waiting 10s for boot...
vmware-iso: Connecting to VM via VNC (127.0.0.1:5964)

`vmware-vmx`: builder ova import functionality

This issue was originally opened by @orcutt989 as hashicorp/packer#9228. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Feature Description

Take an OVA artifact form vmware-iso or from anywhere else and use it to provision a machine with the vmware-vmx builder.

"source_path": "vmx or ova file path"

Use Case(s)

OVA is smaller than VMX format and would take up less space on the datastore. Vcenter/esx both have functionality to import OVA let's extend this to Packer.

cd_content does not seem to work

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

The cd_content options (doc: https://www.packer.io/docs/builders/vmware/vmx#cd_content) does not seem to work with the vmware-vmx build - no CDROM is generated. cd_files does work, but that can't be used to substitute anything (e.g. instance-id for a NoCloud meta-data file).

Plugin and Packer version

packer 1.7.4, which seems to vendor packer-plugin-vmware 1.0.0

Simplified Packer Buildfile

source "vmware-vmx" "vmware" {
  communicator     = "winrm"
  output_directory = "foo"
  source_path      = "..."
  vm_name          = "foo"

  cd_label         = "cidata"
  cd_content = {
    "meta-data" = "instance-id: \"${uuidv4()}\""
    "user-data" = <<EOF
#cloud-config
...
EOF
    }
}

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

Operating system and Environment details

Windows 10, VMware workstation 15.5.7

vmware-iso need add hpet to vmx template

This issue was originally opened by @aru-vmw as hashicorp/packer#10824. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

vmware-iso builder is hardcoded a vmx template in

https://github.com/hashicorp/packer/blob/master/builder/vmware/iso/step_create_vmx.go

however, we noticed the hpet is missing from the template, which will result in some recent Windows releases behavior abnormally

for example, some Windows 10 will BSOD during reboot.
also some application unresponsive https://kb.vmware.com/s/article/67175

the VM created by VMware Product will add hpet by default.

VMware recommends enabling hpet to all VMware machine by setting

hpet0.present = "True"

in the vmx.

Reproduction Steps

Create a VM using vmware-iso builder,
and there is no 'hpet0.present = "True"' in the vmx
some recent Windows OS will BSOD during reboot.
after adding the hpet, the problem is gone.

Users can enable the hpet by themselves by adding it to vmx_data filed.

"vmx_data": {
"hpet0.present": "TRUE"
}
but it would be nice to have this setting as the default for vmware-iso builder.

Packer version

1.7.0

Build OVF with vmware-iso. The VM cannot reach the builder over HTTP

This issue was originally opened by @dmilov as hashicorp/packer#11060. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

Using vmware-iso I'm building an OVF on an ESXi server.
The build hangs on Waiting for SSH to become available....
The VM Console displays an error Failed to establish a new connection to the builder machine.

If I run curl to the builder machine from the VM Console the command is successful, so there is access to the machine.

Reproduction Steps

  1. Photon-builder points to a configured ESXi server
  2. Builder type is vmware-iso
 "builders": [
    {
      "type": "vmware-iso",
      "vm_name": "{{ user `vm_name` }}",
      "vnc_over_websocket": true,
      "insecure_connection": true,
  1. I have kickstarter file which the VM should get from the builder machine over http
  2. Builder machine starts the HTTP server on a port and the file is accessible over the network
  3. The VM that should get the file fails to get it with Failed to establish a new connection error and the build hangs

Packer version

From packer version 1.7.2

Simplified Packer Buildfile

packer-photon-json

Operating system and Environment details

Ubuntu 20 x64

Log Fragments and crash.log files

packer-log

VM Console during the build with manual curl command to the runner

PackerVmwareISO

VMware Provisioner sometimes finishes with i/o timeout after shrinking disk

This issue was originally opened by @mindrunner as hashicorp/packer#5077. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


I am using VMware provisioner to build a macOS Vagrant box. The last step is to call the shrink.sh script to compact the vmdk-files. This script calls 'vmware-tools-cli disk shrink' in the virtual machine. I assume, that zeros are written to the whole free disk space. Calling this manually, makes the vm unresponsive for some seconds (probably when the disk is completely filled) and drops some network connections (including the ssh connection from packer).

==> vmware-iso: Pausing 30s before the next provisioner...
==> vmware-iso: Provisioning with shell script: ../osx-vm-templates/scripts/shrink.sh
    vmware-iso: rm: /private/var/vm/swapfile0: Operation not permitted
    vmware-iso: Please disregard any warnings about disk space for the duration of shrink process.
    vmware-iso:
    vmware-iso: Progress: 100 [===========>]
==> vmware-iso: Pausing 30s before the next provisioner...
==> vmware-iso: Provisioning with shell script: ../scripts/nothing.sh
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Retryable error: Error uploading script: dial tcp 192.168.151.129:22: i/o timeout

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Retryable error: Error uploading script: dial tcp 192.168.151.129:22: i/o timeout

==> Builds finished but no artifacts were created.

This does not always happen. About 1 of 10 builds finishes without error.

Packer Version: Packer v1.0.2
Host: macOS 10.12.5
Debug Log:
https://gist.github.com/mindrunner/b70b5a1f30cc3d8511246886b85a784c

Example:
https://gist.github.com/mindrunner/369bd841277984d5e1322c478916cb26

I cannot really provide a "minimal example" The Ansible provisioning script is huge and not (yet) open source. However, when I skip the big provisioning step and create an almost empty macOS box, I never see the i/o error problem.

Add remove_cdrom to vmware-iso

This issue was originally opened by @jeremymcgee73 in hashicorp/packer#10704 and has been migrated to this repository. The original issue description is below.


Community Note

Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

I would like to be able to use remove_cdrom with the vmware-iso provider. I am adding a disk using cd_files with vmware-iso, then I am use vmware-vmx to import the vmx, do some more config and convert to ova. However, the conversion fails because the temporary ISO no longer exists. I would like to cleanup the CD drive in the vmware-iso run. I may be able to fix this with ovftool_options, but have not gotten that to work yet.

Use Case(s)

Potential configuration

Potential References

`vmware-vmx`: does not find HostIP if network type is being changed

Overview of the Issue

If a packer vmware-vmx template is changing the ethernet0.connectionType from its source image in vmx_data, packer fails to correctly determine the HostIP.

This seems to be because it retreives the network name from the StateBag

network := state.Get("vmnetwork").(string)

where it was set during cloning

state.Put("vmnetwork", networkType)

And therefore does not notice if StepConfigureVMX made any changes later before the image launched (e.g. using vmx_data)

Reproduction Steps

Start with a base .vmx that is using e.g. Bridged networking (I had used ovftool.exe to import http://cloud-images-archive.ubuntu.com/releases/focal/release-20210315/ubuntu-20.04-server-cloudimg-amd64.ova

ovftool ubuntu-20.04-server-cloudimg-amd64.ova testin\test.vmx

This creates test.vmx with ethernet0.connectionType = "bridged".

packer build -debug test.pkr.hcl (template has vmx_data = { "ethernet0.connectionType" = "nat" })

Build fails with

==> vmware-vmx.vmware: Cloning source VM...
==> vmware-vmx.vmware: Pausing after run of step 'StepCloneVMX'. Press enter to continue.
==> vmware-vmx.vmware: Pausing after run of step 'StepConfigureVMX'. Press enter to continue.
==> vmware-vmx.vmware: Pausing after run of step 'StepSuppressMessages'. Press enter to continue.
==> vmware-vmx.vmware: Error detecting host IP: Unable to find host IP from devices [vmnet0], last error: No host declarations containing vmnet0 found

The same error would of course also affect PotentialGuestIP and HostAddress, but HostIP fails first.

I would have said that the initialization of state.Put("vmnetwork", networkType) should just be done slightly later, after StepConfigurVMX has run, but there is very specifically a test to make sure StepCloneVMX sets it.

// Test we got the network type
if networkType, ok := state.GetOk("vmnetwork"); !ok {
t.Fatal("should set vmnetwork")

Obviously tests can be changed, but it makes me unsure that this is the right way to proceed...

Plugin and Packer version

Packer v1.7.8

Simplified Packer Buildfile

test.pkr.hcl
source "vmware-vmx" "vmware" {
  communicator         = "ssh"
  headless             = "true"
  output_directory     = "testout"
  shutdown_command     = "shutdown -P now"
  source_path          = "testin/test.vmx"
  ssh_username         = "root"
  vm_name              = "test"
  vmx_data = {
    "bios.bootOrder"        = "hdd"
    "bios.hddOrder"         = "scsi0"
    "ide1:0.startConnected" = "TRUE"
    "rtc.diffFromUTC"       = "0"
    "ethernet0.connectionType" = "nat"
  }
}

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

  provisioner "shell" {
    inline = [ "echo communicator works" ]
  }
}

Operating system and Environment details

Windows 10 20H2, vmware 15.5.7

`vmware-iso`: Allow Architecture configuration for arm64/aarch64

This issue was originally opened by @MarkProminic in hashicorp/packer#10706 and has been migrated to this repository. The original issue description is below.


Community Note

Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

When the ESXI-Arm fling came out I was giddy with excitement about where this could lead. In my process of trying to get OctoPi installed on my freshly install ESXI 7 Raspberry Pi v4. I found that it wasn't super easy to convert everything over. So In their source, they include instructions for Vagrant, but since the Vagrant image uses debian\buster64 (arm64) and is only build for Virtualbox. I thought, how hard can it be to get Packer to build for ESXI on Raspberry Pi if I can get it to work on ESXI x86.

Well, after some trial an error creating a Packer json build file for it, I found that there is one setting left that I can't change in the builder variables. That is the Architecture in the VMX file:

architecture = "arm64"

is the variable in the VMX that I need to adjust, and I have confirmed that after adjusting this variable, I was able to get the invalid VMX configuration to change to valid an the VM would boot up.

I've searched the Github repo and I can see that there was a Architecture flag added for AWS/AMI instances. Would it be possible to get this flag added to the VMWare-ISO Module?

Use Case(s)

The ability to build and protoype different OS's rapidly on ESXI-Arm.

Working Configuration

.encoding = "UTF-8"
RemoteDisplay.maxConnections = "-1"
architecture = "arm64"
bios.bootorder = "hdd,cdrom"
cleanshutdown = "TRUE"
config.version = "8"
displayname = "DebianBuster641"
ehci.pcislotnumber = "34"
ehci.present = "TRUE"
ethernet0.bsdname = "en0"
ethernet0.connectiontype = "nat"
ethernet0.displayname = "Ethernet"
ethernet0.linkstatepropagation.enable = "FALSE"
ethernet0.pcislotnumber = "33"
extendedconfigfile = "DebianBuster641.vmxf"
firmware = "efi"
floppy0.present = "FALSE"
guestos = "debian10-64"
gui.fullscreenatpoweron = "FALSE"
gui.viewmodeatpoweron = "windowed"
hgfs.linkrootshare = "TRUE"
hgfs.maprootshare = "TRUE"
isolation.tools.hgfs.disable = "FALSE"
memsize = "4096"
msg.autoanswer = "true"
numvcpus = "2"
nvme0.present = "FALSE"
nvram = "DebianBuster641.nvram"
parallel0.autodetect = "FALSE"
parallel0.filename = ""
parallel0.present = "FALSE"
parallel0.startconnected = "FALSE"
pcibridge0.pcislotnumber = "17"
pcibridge0.present = "TRUE"
pcibridge4.functions = "8"
pcibridge4.pcislotnumber = "21"
pcibridge4.present = "TRUE"
pcibridge4.virtualdev = "pcieRootPort"
pcibridge5.functions = "8"
pcibridge5.pcislotnumber = "22"
pcibridge5.present = "TRUE"
pcibridge5.virtualdev = "pcieRootPort"
pcibridge6.functions = "8"
pcibridge6.pcislotnumber = "23"
pcibridge6.present = "TRUE"
pcibridge6.virtualdev = "pcieRootPort"
pcibridge7.functions = "8"
pcibridge7.pcislotnumber = "24"
pcibridge7.present = "TRUE"
pcibridge7.virtualdev = "pcieRootPort"
powertype.poweron = "soft"
powertype.suspend = "soft"
proxyapps.publishtohost = "FALSE"
replay.supported = "FALSE"
sched.cpu.affinity = "all"
sched.cpu.latencySensitivity = "normal"
sched.cpu.min = "0"
sched.cpu.shares = "normal"
sched.cpu.units = "mhz"
sched.mem.min = "0"
sched.mem.minSize = "0"
sched.mem.shares = "normal"
sched.scsi0:0.shares = "normal"
sched.scsi0:0.throughputCap = "off"
scsi0.pcislotnumber = "16"
scsi0.present = "TRUE"
scsi0.virtualdev = "pvscsi"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.filename = "disk.vmdk"
scsi0:0.present = "TRUE"
serial0.autodetect = "FALSE"
serial0.filename = ""
serial0.filetype = ""
serial0.pipe.endpoint = ""
serial0.present = "FALSE"
serial0.startconnected = "FALSE"
serial0.trynorxloss = ""
serial0.yieldonmsrread = ""
sound.autodetect = "TRUE"
sound.filename = "-1"
sound.present = "FALSE"
sound.startconnected = "FALSE"
svga.autodetect = "TRUE"
toolScripts.afterPowerOn = "TRUE"
toolScripts.afterResume = "TRUE"
toolScripts.beforePowerOff = "TRUE"
toolScripts.beforeSuspend = "TRUE"
tools.guest.desktop.autolock = "FALSE"
tools.synctime = "FALSE"
tools.upgrade.policy = "manual"
usb.pcislotnumber = "32"
usb.present = "FALSE"
uuid.action = "create"
virtualhw.productcompatibility = "hosted"
virtualhw.version = "17"
vmci0.id = "1861462627"
vmci0.pcislotnumber = "35"
vmci0.present = "TRUE"
vmotion.checkpointfbsize = "65536000"

Currently Generated Packer Configuration:

.encoding = "UTF-8"
RemoteDisplay.maxConnections = "-1"
bios.bootorder = "hdd,cdrom"
cleanshutdown = "TRUE"
config.version = "8"
displayname = "DebianBuster641"
ehci.pcislotnumber = "34"
ehci.present = "TRUE"
ethernet0.bsdname = "en0"
ethernet0.connectiontype = "nat"
ethernet0.displayname = "Ethernet"
ethernet0.linkstatepropagation.enable = "FALSE"
ethernet0.pcislotnumber = "33"
extendedconfigfile = "DebianBuster641.vmxf"
firmware = "efi"
floppy0.present = "FALSE"
guestos = "debian10-64"
gui.fullscreenatpoweron = "FALSE"
gui.viewmodeatpoweron = "windowed"
hgfs.linkrootshare = "TRUE"
hgfs.maprootshare = "TRUE"
isolation.tools.hgfs.disable = "FALSE"
memsize = "4096"
msg.autoanswer = "true"
numvcpus = "2"
nvme0.present = "FALSE"
nvram = "DebianBuster641.nvram"
parallel0.autodetect = "FALSE"
parallel0.filename = ""
parallel0.present = "FALSE"
parallel0.startconnected = "FALSE"
pcibridge0.pcislotnumber = "17"
pcibridge0.present = "TRUE"
pcibridge4.functions = "8"
pcibridge4.pcislotnumber = "21"
pcibridge4.present = "TRUE"
pcibridge4.virtualdev = "pcieRootPort"
pcibridge5.functions = "8"
pcibridge5.pcislotnumber = "22"
pcibridge5.present = "TRUE"
pcibridge5.virtualdev = "pcieRootPort"
pcibridge6.functions = "8"
pcibridge6.pcislotnumber = "23"
pcibridge6.present = "TRUE"
pcibridge6.virtualdev = "pcieRootPort"
pcibridge7.functions = "8"
pcibridge7.pcislotnumber = "24"
pcibridge7.present = "TRUE"
pcibridge7.virtualdev = "pcieRootPort"
powertype.poweron = "soft"
powertype.suspend = "soft"
proxyapps.publishtohost = "FALSE"
replay.supported = "FALSE"
sched.cpu.affinity = "all"
sched.cpu.latencySensitivity = "normal"
sched.cpu.min = "0"
sched.cpu.shares = "normal"
sched.cpu.units = "mhz"
sched.mem.min = "0"
sched.mem.minSize = "0"
sched.mem.shares = "normal"
sched.scsi0:0.shares = "normal"
sched.scsi0:0.throughputCap = "off"
scsi0.pcislotnumber = "16"
scsi0.present = "TRUE"
scsi0.virtualdev = "pvscsi"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.filename = "disk.vmdk"
scsi0:0.present = "TRUE"
serial0.autodetect = "FALSE"
serial0.filename = ""
serial0.filetype = ""
serial0.pipe.endpoint = ""
serial0.present = "FALSE"
serial0.startconnected = "FALSE"
serial0.trynorxloss = ""
serial0.yieldonmsrread = ""
sound.autodetect = "TRUE"
sound.filename = "-1"
sound.present = "FALSE"
sound.startconnected = "FALSE"
svga.autodetect = "TRUE"
toolScripts.afterPowerOn = "TRUE"
toolScripts.afterResume = "TRUE"
toolScripts.beforePowerOff = "TRUE"
toolScripts.beforeSuspend = "TRUE"
tools.guest.desktop.autolock = "FALSE"
tools.synctime = "FALSE"
tools.upgrade.policy = "manual"
usb.pcislotnumber = "32"
usb.present = "FALSE"
uuid.action = "create"
virtualhw.productcompatibility = "hosted"
virtualhw.version = "17"
vmci0.id = "1861462627"
vmci0.pcislotnumber = "35"
vmci0.present = "TRUE"
vmotion.checkpointfbsize = "65536000"

Current JSON Build File

{
    "builders": [
      {
        "name": "DebianBuster641",
        "type": "vmware-iso",
        "vm_name": "DebianBuster641",
        "network": "lan",
        "guest_os_type": "debian11-64",
        "tools_upload_flavor": "linux",
        "headless": true,
        "vnc_over_websocket": true,
        "insecure_connection": true,
  
        "iso_urls": ["iso/ubuntu-18.04.5-server-amd64.iso",
        "http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.5-server-amd64.iso"
        ],
        "iso_checksum": "8c5fc24894394035402f66f3824beb7234b757dd2b5531379cb310cedfdf0996",
  
        "cpus": 2,
        "memory": 4096,
        "disk_size": 20140,
        "disk_type_id": "thin",
  
        "boot_wait": "10s",
        "boot_command": [
          "<esc><wait>",
          "<esc><wait>",
          "<enter><wait>",
          "/install/vmlinuz",
          " initrd=/install/initrd.gz ",
          "auto=true ",
          "url=https://gist.githubusercontent.com/G0nz0uk/22afe85abc8a1b008602f79b381ea262/raw/ef166effdbdc12b6dc00e40fe5e194181a6b06d4/preseed1.cfg ",
          "fb=false ",
          "auto=true ",
          "language=en ",
          "locale=en_GB ",
          "priority=critical ",
          "keymap=uk ",
          "netcfg/get_hostname={{ .Name }} ",
          "netcfg/get_domain=vm ",
          "debconf/frontend=noninteractive ",
          "debian-installer/country=US ",
          "console-setup/ask_detect=false ",
          "console-keymaps-US/keymap=us ",
          "DEBCONF_DEBUG=5 ",
          "<enter>"
        ],
  
        "ssh_username": "vagrant",
        "ssh_password": "vagrant",
        "ssh_port": 22,
        "ssh_wait_timeout": "20m",
        "shutdown_command": "sudo systemctl poweroff",
  
        "vnc_disable_password": true,
        "format": "vmx",
        "remote_type": "esx5",
		"version": 17,
        "remote_host": "{{user `esxi_host`}}",
        "remote_datastore": "{{user `esxi_datastore`}}",
        "remote_username": "{{user `esxi_username`}}",
        "remote_password": "{{user `esxi_password`}}",
        "keep_registered": true,
        "skip_export": true
        ,
        "vmx_data": {
        "ethernet0.networkName": "lan"
        }
      }
    ],
    
  "provisioners": [
      {
        "type": "shell",
        "execute_command": "echo '{{user `ssh_password`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
        "inline": [
          "apt-get update",
          "apt-get install -y",
          "echo '%sudo    ALL=(ALL)  NOPASSWD:ALL' >> /etc/sudoers"
        ]  
      }         
   ]
}
 

References to get me this far

https://www.virtuallyghetto.com/2020/10/how-to-run-raspberry-pi-os-as-a-vm-on-esxi-arm.html
https://www.reddit.com/r/homelab/comments/lemdr4/trying_to_use_packer_with_single_esxi_host_for/
https://www.reddit.com/r/vmware/comments/lfbzw9/packer_almost_working_with_my_esxi_host_lab_just/

The term 'c:/Windows/Temp/packer-ps-env-vars-[GUID].ps1' is not recognized as the name of a cmdlet

This issue was originally opened by @johnypony3 as hashicorp/packer#11013. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

When building windows 2012/2016 (possibly others, but I'm not building them currently) the log contains the error in the title. This is a non critical error as the build completes.

Reproduction Steps

Standard build

Packer version

From 1.7.0

Simplified Packer Buildfile

https://gist.github.com/johnypony3/8886cbfa8c62056cc1e53bf47c0eebc7

Operating system and Environment details

RedHat 7 64bit
VMWare VMware Workstation 15.5.1 build-15018445

Log Fragments and crash.log files

 [0KRunning with gitlab-runner 12.1.0 (de7731dd)
 [0;m[0K  on rfds-builder 6pxscSV5
 [0;msection_start:1620758694:prepare_executor
 [0K[0KUsing Shell executor...
 [0;msection_end:1620758694:prepare_executor
 [0Ksection_start:1620758694:prepare_script
 [0KRunning on y0319t12546...
 section_end:1620758694:prepare_script
 [0Ksection_start:1620758694:get_sources
 [0K[32;1mFetching changes with git depth set to 50...[0;m
 Reinitialized existing Git repository in /u01/builds/6pxscSV5/2/devx/golden-images/golden-ami-factory/.git/
 [32;1mChecking out 9e2da290 as ADOPT-2289...[0;m
 Removing build/
 [32;1mSkipping Git submodules setup[0;m
 section_end:1620758695:get_sources
 [0Ksection_start:1620758695:restore_cache
 [0Ksection_end:1620758695:restore_cache
 [0Ksection_start:1620758695:download_artifacts
 [0K[32;1mDownloading artifacts for make_artifacts_dir (14193184)...[0;m
 Runtime platform                                  [0;m  arch[0;m=amd64 os[0;m=linux pid[0;m=106603 revision[0;m=de7731dd version[0;m=12.1.0
 Downloading artifacts from coordinator... ok      [0;m  id[0;m=14193184 responseStatus[0;m=200 OK token[0;m=g3onVq5b
 section_end:1620758696:download_artifacts
 [0Ksection_start:1620758696:build_script
 [0K[32;1m$ if [ $CI_COMMIT_REF_NAME = 'master' ]; then export ENVIRONMENT=prod; fi;[0;m
 [32;1m$ export CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME,,}[0;m
 [32;1m$ packer build -machine-readable -force -var-file=common/vsphere.variables.json -var-file=common/vsphere.${ENVIRONMENT}.variables.json -var-file=common/variables.json -var-file=$VAR_OS -var-file=$VAR_OS_VER -var "datetag=$(date +%Y%m%d%H%M%S)" -only=$RULE $TEMPLATE[0;m
 1620758697,,ui,say,Warning: Warning when preparing build: "vmware-iso"\n\nYour vmx data contains the following variable(s)%!(PACKER_COMMA) which Packer normally sets\nwhen it generates its own default vmx template. This may cause your build to\nfail or behave unpredictably: scsi0.virtualDev\n\n
 1620758697,,ui,say,== vmware-iso: Retrieving ISO
 1620758697,,ui,say,== vmware-iso: Trying https://[MASKED]:[MASKED]@artifactory.[MASKED].com/artifactory/generic-local/iso/os/windows/2016/WS2016-b14393.iso
 1620758697,,ui,say,== vmware-iso: Trying https://[MASKED]:[MASKED]@artifactory.[MASKED].com/artifactory/generic-local/iso/os/windows/2016/WS2016-b14393.iso?checksum=sha256%3A5a62abeb55e3a0f45189fa4b2c192be384956869b9e00b76963992234065b91a
 1620758825,,ui,say,== vmware-iso: https://[MASKED]:[MASKED]@artifactory.[MASKED].com/artifactory/generic-local/iso/os/windows/2016/WS2016-b14393.iso?checksum=sha256%3A5a62abeb55e3a0f45189fa4b2c192be384956869b9e00b76963992234065b91a = /u01/packer/packer_cache/c39bf4219846883ba39d1a9f3a7b74c8bea1e747.iso
 1620758825,,ui,say,== vmware-iso: Configuring output and export directories...
 1620758825,,ui,say,== vmware-iso: Creating floppy disk...
 1620758825,,ui,message,    vmware-iso: Copying files flatly from floppy_files
 1620758825,,ui,message,    vmware-iso: Copying file: packer/windows/2016_onprem/mount/Autounattend.xml
 1620758825,,ui,message,    vmware-iso: Copying file: packer/windows/scripts/Invoke-Defrag.ps1
 1620758825,,ui,message,    vmware-iso: Copying file: packer/windows/scripts/Remove-UpdateCache.ps1
 1620758825,,ui,message,    vmware-iso: Copying file: packer/windows/scripts/Reset-EmptySpace.ps1
 1620758825,,ui,message,    vmware-iso: Copying file: packer/windows/scripts/sysprep.ps1
 1620758825,,ui,message,    vmware-iso: Copying file: packer/windows/scripts/winrmConfig.bat
 1620758825,,ui,message,    vmware-iso: Copying directory: packer/windows/drivers/
 1620758825,,ui,message,    vmware-iso: Adding file: packer/windows/drivers/pvscsi.cat
 1620758825,,ui,message,    vmware-iso: Adding file: packer/windows/drivers/pvscsi.inf
 1620758825,,ui,message,    vmware-iso: Adding file: packer/windows/drivers/pvscsi.sys
 1620758825,,ui,message,    vmware-iso: Adding file: packer/windows/drivers/txtsetup.oem
 1620758825,,ui,message,    vmware-iso: Done copying files from floppy_files
 1620758825,,ui,message,    vmware-iso: Collecting paths from floppy_dirs
 1620758825,,ui,message,    vmware-iso: Resulting paths from floppy_dirs : []
 1620758825,,ui,message,    vmware-iso: Done copying paths from floppy_dirs
 1620758825,,ui,say,== vmware-iso: Creating required virtual machine disks
 1620758826,,ui,say,== vmware-iso: Building and writing VMX file
 1620758826,,ui,say,== vmware-iso: Starting virtual machine...
 1620758826,,ui,message,    vmware-iso: The VM will be run headless%!(PACKER_COMMA) without a GUI. If you want to\n    vmware-iso: view the screen of the VM%!(PACKER_COMMA) connect via VNC with the password "wJI4Q3E0" to\n    vmware-iso: vnc://0.0.0.0:5906
 1620758827,,ui,say,== vmware-iso: Connecting to VNC...
 1620758827,,ui,say,== vmware-iso: Waiting 5m0s for boot...
 1620759127,,ui,say,== vmware-iso: Typing the boot command over VNC...
 1620759127,,ui,say,== vmware-iso: Waiting for WinRM to become available...
 1620759736,,ui,message,    vmware-iso: WinRM connected.
 1620759736,,ui,say,== vmware-iso: Connected to WinRM!
 1620759736,,ui,say,== vmware-iso: Provisioning with Powershell...
 1620759736,,ui,say,== vmware-iso: Provisioning with powershell script: /u01/packer/packer_tmp/powershell-provisioner956887563
 1620760129,,ui,message,    vmware-iso: . : The term 'c:/Windows/Temp/packer-ps-env-vars-609ad0a9-ead9-ff96-1c10-f80ef5977d8e.ps1' is not recognized as the
 1620760129,,ui,message,    vmware-iso: name of a cmdlet%!(PACKER_COMMA) function%!(PACKER_COMMA) script file%!(PACKER_COMMA) or operable program. Check the spelling of the name%!(PACKER_COMMA) or if a path was
 1620760129,,ui,message,    vmware-iso: included%!(PACKER_COMMA) verify that the path is correct and try again.
 1620760129,,ui,message,    vmware-iso: At line:1 char:138
 1620760129,,ui,message,    vmware-iso: + ... ontinue'};. c:/Windows/Temp/packer-ps-env-vars-609ad0a9-ead9-ff96-1c1 ...
 1620760129,,ui,message,    vmware-iso: +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1620760129,,ui,message,    vmware-iso:     + CategoryInfo          : ObjectNotFound: (c:/Windows/Temp...80ef5977d8e.ps1:String) []%!(PACKER_COMMA) CommandNotFoundException
 1620760129,,ui,message,    vmware-iso:     + FullyQualifiedErrorId : CommandNotFoundException
 1620760129,,ui,message,    vmware-iso:
 1620761964,,ui,message,    vmware-iso:
 1620761964,,ui,message,    vmware-iso: Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
 1620761964,,ui,message,    vmware-iso: -------  ------    -----      -----     ------     --  -- -----------
 1620761964,,ui,message,    vmware-iso:     125       9     6288       7416       0.11    352   0 msiexec
 1620762438,,ui,error,== vmware-iso: . : The term 'c:/Windows/Temp/packer-ps-env-vars-609ad0a9-ead9-ff96-1c10-f80ef5977d8e.ps1' is not recognized as the
 1620762438,,ui,error,== vmware-iso: name of a cmdlet%!(PACKER_COMMA) function%!(PACKER_COMMA) script file%!(PACKER_COMMA) or operable program. Check the spelling of the name%!(PACKER_COMMA) or if a path was
 1620762438,,ui,error,== vmware-iso: included%!(PACKER_COMMA) verify that the path is correct and try again.
 1620762438,,ui,error,== vmware-iso: At line:1 char:138
 1620762438,,ui,error,== vmware-iso: + ... ontinue'};. c:/Windows/Temp/packer-ps-env-vars-609ad0a9-ead9-ff96-1c1 ...
 1620762438,,ui,error,== vmware-iso: +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1620762438,,ui,error,== vmware-iso:     + CategoryInfo          : ObjectNotFound: (c:/Windows/Temp...80ef5977d8e.ps1:String) []%!(PACKER_COMMA) CommandNotFoundException
 1620762438,,ui,error,== vmware-iso:     + FullyQualifiedErrorId : CommandNotFoundException

Thank you!

VMware Fusion VM startup failure during build

This issue was originally opened by @NathanDotTo as hashicorp/packer#3424. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Hi

When I build a VMware Fusion VM with Packer, and the build fails, or I Ctrl-C it, and then try to build a VM with the same name again, it fails. I can provoke this as show in the logs below. The symptom is the VNC connection failure, but the cause is that the VM simply was not created at all.

The solution is to change the "vm_name" in the json configuration. For example, if start a process to build a VM called "packer-ubuntu-14.04-amd64", and I Ctrl-C that, and then I try to build the same VM again, the build fails.

If I change the name to "packer-ubuntu-14.04-amd64-test", the build will succeed.

Note that I can't find a way to delete the previously built VMs from Fusion as they do not appear in the list of Virtual Machines in the UI. The vmrun command, which is a possible CLI, option requires a .vmx file as argument, but that has been deleted by the build cleanup stages.

  • Packer Version - 0.10.0
  • Host platform OSX 10.11.4
  • Debug log output from PACKER_LOG=1 packer build template.json.
  • VMware Fusion Professional Version 8.1.0 (3272237) and 7.1.3

https://gist.github.com/NathanDotTo/6bbb5a82070891428d9e985c97a59945

  • The simplest example template and scripts needed to reproduce the bug.

https://gist.github.com/NathanDotTo/d9b3f59f694801926a339300a8c8e982

Regards

Nathan

VMware Workstation 16 does not generate netmap.conf during installation

This issue was originally opened by @clong as hashicorp/packer#10009. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

While not a bug with Packer specifically, Packer relies on this file to build vmware-iso boxes successfully. Beginning with VMware Workstation 16 for Linux, a netmap.conf file is not generated during the installation of VMware

Reproduction Steps

  1. Launch Ubuntu 18.04 server
  2. Install VMware Workstation 16 for Linux
  3. Attempt to build a box using Packer vmware-iso provisioner
  4. Encounter Could not find netmap conf file: /etc/vmware/netmap.conf error message

Packer version

1.6.3

Simplified Packer Buildfile

https://github.com/clong/DetectionLab/blob/master/Packer/windows_2016.json

Operating system and Environment details

Ubuntu 18.04, x64

Log Fragments and crash.log files

vmware-iso: output will be in this color.

==> vmware-iso: Retrieving ISO
==> vmware-iso: Trying https://software-download.microsoft.com/download/pr/18363.418.191007-0143.19h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso
==> vmware-iso: Trying https://software-download.microsoft.com/download/pr/18363.418.191007-0143.19h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso?checksum=sha256%3A9ef81b6a101afd57b2dbfa44d5c8f7bc94ff45b51b82c5a1f9267ce2e63e9f53
    vmware-iso: 18363.418.191007-0143.19h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso 4.56 GiB / 4.56 GiB [==========================================================================] 100.00% 1m17s
==> vmware-iso: https://software-download.microsoft.com/download/pr/18363.418.191007-0143.19h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso?checksum=sha256%3A9ef81b6a101afd57b2dbfa44d5c8f7bc94ff45b51b82c5a1f9267ce2e63e9f53 => /tmp/Packer/packer_cache/fbe860439e10a6d50766c5ec20ebd394160a1b61.iso
==> vmware-iso: Configuring output and export directories...
==> vmware-iso: Creating floppy disk...
    vmware-iso: Copying files flatly from floppy_files
    vmware-iso: Copying file: ./answer_files/10/Autounattend.xml
    vmware-iso: Copying file: ./floppy/WindowsPowershell.lnk
    vmware-iso: Copying file: ./floppy/PinTo10.exe
    vmware-iso: Copying file: ./scripts/fixnetwork.ps1
    vmware-iso: Copying file: ./scripts/rearm-windows.ps1
    vmware-iso: Copying file: ./scripts/disable-screensaver.ps1
    vmware-iso: Copying file: ./scripts/disable-winrm.ps1
    vmware-iso: Copying file: ./scripts/enable-winrm.ps1
    vmware-iso: Copying file: ./scripts/microsoft-updates.bat
    vmware-iso: Copying file: ./scripts/win-updates.ps1
    vmware-iso: Copying file: ./scripts/unattend.xml
    vmware-iso: Copying file: ./scripts/sysprep.bat
    vmware-iso: Done copying files from floppy_files
    vmware-iso: Collecting paths from floppy_dirs
    vmware-iso: Resulting paths from floppy_dirs : []
    vmware-iso: Done copying paths from floppy_dirs
==> vmware-iso: Creating required virtual machine disks
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Could not find netmap conf file: /etc/vmware/netmap.conf
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored after 1 minute 27 seconds: Could not find netmap conf file: /etc/vmware/netmap.conf

==> Wait completed after 1 minute 27 seconds

Looking for guidance on dry builds with the ISO builder

I was building with the ISO builder and tried to use the skip_export flag in the build configuration unto which I got an error about using the flag

`
Error: Unsupported argument

on vsphere_rhel8.pkr.hcl line 84:

(source code not available)

An argument named "skip_export" is not expected here.
`

With this I am unsure if it is a bug or if it is for the ESX builder only as this setting was underneath the ISO section of the packer plugins for VMWare. If this setting is not available for ISO builds is there another setting I am missing or an example config where I can skip saving the ISO at the end

Problem uploading iso/floppy to ESX host

This issue was originally opened by @pmanno as hashicorp/packer#9616. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

Whenever I try to build more than one VM at at time, even on two different build servers, I get an error:
vmware-iso: Error uploading file: Process exited with status 1

Reproduction Steps

Attempt to build more than 1 VM at a time.

Packer version

1.6.0

Simplified Packer Buildfile

gist

Operating system and Environment details

Build Server packer is run on: Ubuntu 18.04.4 LTS

Log Fragments and crash.log files

gist

floppy_content not working on vmware builders

Hi, recently I've discovered that the floppy_content statement doesn't work at all when used in conjunction with any of the vmware builders (vmware-iso or vmware-vmx) provided by this plugin.

Overview of the Issue

As the packer vmware plugin documentation states, there are some statements to configure a floppy disk in the virtual machine that's built by packer. This floppy disk is really useful for unattended Windows installs.

However, when the floppy_content statement is used no floppy disk is created by packer neither attached to the virtual machine. Any of the other statements (floppy_files or floppy_dirs) work as expected.

Reproduction Steps

Create a packer template with floppy_content, packer will ignore that option and build the template without creating the corresponding floppy disk.

Plugin and Packer version

packer 1.8.1
packer-plugin-vmware 1.0.7

Simplified Packer Buildfile

The following packer template can be used to reproduce the issue:

packer {
  required_version = "~> 1.8.1"

  required_plugins {
    vmware = {
      source = "github.com/hashicorp/vmware"
      version = ">= 1.0.0"
    }
  }
}

locals {
  alpine_base_url = "http://dl-cdn.alpinelinux.org/alpine/v3.16"
  alpine_iso_url  = "${local.alpine_base_url}/releases/x86_64/alpine-virt-3.16.0-x86_64.iso"
  alpine_iso_checksum_url = "${local.alpine_iso_url}.sha256"
  alpine_repository_url = "http://dl-cdn.alpinelinux.org/alpine/v3.16/main"
}

source "vmware-iso" "alpine" {
  iso_checksum = "file:${local.alpine_iso_checksum_url}"
  iso_url      = local.alpine_iso_url

  communicator = "none"
  headless     = false

  floppy_content = {
    "hello.txt" = "Hello world!"
  }

  boot_command = [
    "<wait5>",
    "root<enter>",
    "<wait>",
    "mount -t vfat /dev/fd0 /media/floppy<enter>",
    "<wait>",
    "cat /media/floppy/hello.txt<enter>",
    "<wait10>",
  ]
  boot_wait = "10s"
}

build {
  sources = ["vmware-iso.alpine"]
}

As you can see, this template is pretty simple. An alpine ISO is downloaded and a floppy must be created with a hello.txt file, at boot time the floppy disk is mounted and the hello.txt file is printed to stdout.

Operating system and Environment details

Debian 11.3
VMWare WS 16.2.3

Log Fragments and crash.log files

==> vmware-iso.alpine: Trying http://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.0-x86_64.iso?checksum=sha256%3Aba8007f74f9b54fbae3b2520da577831b4834778a498d732f091260c61aa7ca1
2022/06/17 06:56:48 packer-plugin-vmware_v1.0.7_x5.0_linux_amd64 plugin: 2022/06/17 06:56:48 Leaving retrieve loop for ISO
2022/06/17 06:56:48 packer-plugin-vmware_v1.0.7_x5.0_linux_amd64 plugin: 2022/06/17 06:56:48 No floppy files specified. Floppy disk will not be made.
2022/06/17 06:56:48 packer-plugin-vmware_v1.0.7_x5.0_linux_amd64 plugin: 2022/06/17 06:56:48 No CD files specified. CD disk will not be made.

Full log file

`vmware-iso`: Error detecting host IP: Could not find `vmnetdhcp` conf file:` /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf`

Overview of the Issue

I am trying to build a VM using bridged networking. I was previously using whatever the default was set to, and then changed to bridged to test something. When set to bridged, every build fails immediately with:

2022/08/08 09:51:37 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2022/08/08 09:51:37 packer-builder-vmware-iso plugin: HostIP discovered device matching bridged: vmnet0
2022-08-08T09:51:37-07:00: ==> vmware-iso.srt_ubuntu20_small: Error detecting host IP: Could not find vmnetdhcp conf file: /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf
2022-08-08T09:51:37-07:00: ==> vmware-iso.srt_ubuntu20_small: Error detecting host IP: Could not find vmnetdhcp conf file: /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf
2022/08/08 09:51:37 machine readable: error-count []string{"1"}
2022/08/08 09:51:37 machine readable: vmware-iso.srt_ubuntu20_small,error []string{"Error detecting host IP: Could not find vmnetdhcp conf file: /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf"}

Reproduction Steps

I'm not exactly sure. All I've done is run a vmware-iso build a few times unsuccessfully, and then changed network to bridged and try to run it again.

Plugin and Packer version

Packer v1.8.3
git github.com/ethanmdavidson/git ">= 0.3.2"

Simplified Packer Buildfile

Packer Buildfile
data "git-commit" "cwd_head" {}

local "execute_command" {
  expression = "echo '${var.ssh-password}' | {{.Vars}} sudo -S -E bash '{{.Path}}'"
  sensitive  = true
}


source "vmware-iso" "ubuntu20_small" {
  # E.g. 'ubu-build-20220803113100-b5ee72a3'
  vm_name   = "ubu-build-${regex_replace(timestamp(), ".*(T|:|-).*", "")}-${split("-", uuidv4())[0]}"
  cpus      = 2
  memory    = 8192
  disk_size = 122880
  network   = "bridged"

  ssh_username           = "user"
  ssh_password           = var.ssh-password
  ssh_port               = "20022"
  ssh_pty                = true
  ssh_handshake_attempts = "40"
  ssh_timeout            = "20m"
  boot_wait              = "5s"
  boot_command = [
    "<enter><enter><f6><esc><wait> ",
    "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
    "<enter>"
  ]
  guest_os_type        = "ubuntu64Guest"
  http_directory       = "subiquity/http"
  shutdown_command     = "echo '${var.ssh-password}' | sudo -S shutdown -P now"

  iso_url       = "file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso"
  iso_checksum  = "28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad"

}


build {
  sources = [
    "source.vmware-iso.ubuntu20_small"
  ]
}

Operating system and Environment details

macOS 12.5 (Intel x86_64).
VMware Fusion Professional Version 12.2.4 (20071091)

Log Fragments and crash.log files

Packer Debug Logs
2022/08/08 09:46:36 [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:46:36 [TRACE] discovering plugins in /usr/local/bin
2022/08/08 09:46:36 [TRACE] discovering plugins in /Users/me/.config/packer/plugins
2022/08/08 09:46:36 [DEBUG] Discovered plugin: git = /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64
2022/08/08 09:46:36 found external [commit repository tree] datasource from git plugin
2022/08/08 09:46:36 [TRACE] discovering plugins in .
2022/08/08 09:46:36 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:46:36 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:46:36 [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:46:36 [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:46:36 [TRACE] listing potential installations for "github.com/ethanmdavidson/git" that match ">= 0.3.2". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/usr/local/bin/packer", ".", "/Users/me/.config/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0009ce780)}}}}
2022/08/08 09:46:36 [TRACE] Found the following "github.com/ethanmdavidson/git" installations: [{/Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64 v0.3.2}]
2022/08/08 09:46:36 found external [commit repository tree] datasource from git plugin
2022/08/08 09:46:36 [TRACE] validateValue: not active for vsphere-cluster, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for vsphere-datacenter, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for vsphere-server, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for ssh-password, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for iso-url, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for vsphere-datastore, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for vsphere-network, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for vsphere-user, so skipping
2022/08/08 09:46:36 [TRACE] validateValue: not active for vsphere-password, so skipping
2022/08/08 09:46:36 [TRACE] Starting external plugin /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64 start datasource commit
2022/08/08 09:46:36 Starting plugin: /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64 []string{"/Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64", "start", "datasource", "commit"}
2022/08/08 09:46:36 Waiting for RPC address for: /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64
2022/08/08 09:46:36 Received unix RPC address for /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin418670440
2022/08/08 09:46:36 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:46:36 Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin418670440
2022/08/08 09:46:36 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:46:36 Waiting for connection...
2022/08/08 09:46:36 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:46:36 Serving a plugin connection...
2022/08/08 09:46:36 packer-plugin-git_v0.3.2_x5.0_darwin_amd64 plugin: 2022/08/08 09:46:36 [TRACE] starting datasource commit
2022/08/08 09:46:36 [TRACE] Starting internal plugin packer-builder-vmware-iso
2022/08/08 09:46:36 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-vmware-iso"}
2022/08/08 09:46:36 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: args: []string{"packer-builder-vmware-iso"}
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin633914082
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: Waiting for connection...
2022/08/08 09:46:36 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin633914082
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: Serving a plugin connection...
2022/08/08 09:46:36 [TRACE] Starting internal plugin packer-provisioner-file
2022/08/08 09:46:36 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-file"}
2022/08/08 09:46:36 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:46:36 packer-provisioner-file plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:46:36 packer-provisioner-file plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:46:36 packer-provisioner-file plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-provisioner-file plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-provisioner-file plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:46:36 packer-provisioner-file plugin: args: []string{"packer-provisioner-file"}
2022/08/08 09:46:36 packer-provisioner-file plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin998893557
2022/08/08 09:46:36 packer-provisioner-file plugin: Waiting for connection...
2022/08/08 09:46:36 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin998893557
2022/08/08 09:46:36 packer-provisioner-file plugin: Serving a plugin connection...
2022/08/08 09:46:36 [TRACE] Starting internal plugin packer-provisioner-shell
2022/08/08 09:46:36 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-shell"}
2022/08/08 09:46:36 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:46:36 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2022/08/08 09:46:36 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin1683256834
2022/08/08 09:46:36 packer-provisioner-shell plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin1683256834
2022/08/08 09:46:36 packer-provisioner-shell plugin: Waiting for connection...
2022/08/08 09:46:36 packer-provisioner-shell plugin: Serving a plugin connection...
2022/08/08 09:46:36 [TRACE] Starting internal plugin packer-provisioner-shell
2022/08/08 09:46:36 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-shell"}
2022/08/08 09:46:36 Waiting for RPC address for: /usr/local/bin/packer
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] Packer version: 1.8.3 [go1.17.11 darwin amd64]
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/me/.packerconfig
2022/08/08 09:46:36 packer-provisioner-shell plugin: [INFO] Setting cache directory: /Users/me/.cache/packer
2022/08/08 09:46:36 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2022/08/08 09:46:36 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin3213835639
2022/08/08 09:46:36 packer-provisioner-shell plugin: Plugin address: unix /var/folders/bj/d20cbn1d31dc9hxb2q06qf5m0000gn/T/packer-plugin3213835639
2022/08/08 09:46:36 packer-provisioner-shell plugin: Waiting for connection...
2022/08/08 09:46:36 packer-provisioner-shell plugin: Serving a plugin connection...
2022/08/08 09:46:36 Build debug mode: false
2022/08/08 09:46:36 Force build: false
2022/08/08 09:46:36 On error:
2022/08/08 09:46:36 Waiting on builds to complete...
2022/08/08 09:46:36 Starting build run: vmware-iso.ubuntu20_small
2022/08/08 09:46:36 Running builder:
2022/08/08 09:46:36 [INFO] (telemetry) Starting builder vmware-iso.ubuntu20_small
vmware-iso.ubuntu20_small: output will be in this color.

2022/08/08 09:46:36 packer-builder-vmware-iso plugin: Detected VMware version: 12
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: Testing against vmware driver *common.Fusion6Driver, Success: true
2022-08-08T09:46:36-07:00: ==> vmware-iso.ubuntu20_small: Retrieving ISO
2022/08/08 09:46:36 packer-builder-vmware-iso plugin: Acquiring lock for: file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso?checksum=sha256%3A28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad (/Users/me/.cache/packer/47de2d7266acde194681de2a24f5d76b43b452ca.iso.lock)
2022-08-08T09:46:36-07:00: ==> vmware-iso.ubuntu20_small: Trying file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso
2022-08-08T09:46:36-07:00: ==> vmware-iso.ubuntu20_small: Trying file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso?checksum=sha256%3A28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad
2022/08/08 09:46:39 packer-builder-vmware-iso plugin: Leaving retrieve loop for ISO
2022-08-08T09:46:39-07:00: ==> vmware-iso.ubuntu20_small: file:///Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso?checksum=sha256%3A28ccdb56450e643bad03bb7bcf7507ce3d8d90e8bf09e38f6bd9ac298a98eaad => /Users/me/Downloads/ubuntu-20.04.4-live-server-amd64.iso
2022-08-08T09:46:39-07:00: ==> vmware-iso.ubuntu20_small: Configuring output and export directories...
2022/08/08 09:46:39 packer-builder-vmware-iso plugin: No floppy files specified. Floppy disk will not be made.
2022/08/08 09:46:39 packer-builder-vmware-iso plugin: No CD files specified. CD disk will not be made.
2022-08-08T09:46:39-07:00: ==> vmware-iso.ubuntu20_small: Creating required virtual machine disks
2022/08/08 09:46:39 packer-builder-vmware-iso plugin: [INFO] Creating disk with Path: output-ubuntu20_small/disk.vmdk and Size: 122880M
2022/08/08 09:46:39 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager -c -s 122880M -a lsilogic -t 1 output-ubuntu20_small/disk.vmdk
2022-08-08T09:46:40-07:00: ==> vmware-iso.ubuntu20_small: Building and writing VMX file
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: stdout: Creating disk 'output-ubuntu20_small/disk.vmdk'
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: Virtual disk creation successful.
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: stderr:
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: Writing VMX to: output-ubuntu20_small/srt-ubu-build--1f121eb7.vmx
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: Configuring VMX...
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: Writing VMX to: output-ubuntu20_small/srt-ubu-build--1f121eb7.vmx
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: Suppressing messages in VMX
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2022/08/08 09:46:40 packer-builder-vmware-iso plugin: HostIP discovered device matching bridged: vmnet0
2022-08-08T09:46:40-07:00: ==> vmware-iso.ubuntu20_small: Error detecting host IP: Could not find vmnetdhcp conf file: /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf
2022-08-08T09:46:40-07:00: ==> vmware-iso.ubuntu20_small: Deleting output directory...
2022/08/08 09:46:40 [INFO] (telemetry) ending vmware-iso.ubuntu20_small
==> Wait completed after 3 seconds 385 milliseconds
2022/08/08 09:46:40 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2022/08/08 09:46:40 machine readable: vmware-iso.ubuntu20_small,error []string{"Error detecting host IP: Could not find vmnetdhcp conf file: /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf"}
==> Builds finished but no artifacts were created.
2022-08-08T09:46:40-07:00: Build 'vmware-iso.ubuntu20_small' errored after 3 seconds 385 milliseconds: Error detecting host IP: Could not find vmnetdhcp conf file: /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf

2022/08/08 09:46:40 [INFO] (telemetry) Finalizing.
==> Wait completed after 3 seconds 385 milliseconds

==> Some builds didn't complete successfully and had errors:
--> vmware-iso.ubuntu20_small: Error detecting host IP: Could not find vmnetdhcp conf file: /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf

==> Builds finished but no artifacts were created.
2022/08/08 09:46:41 waiting for all plugin processes to complete...
2022/08/08 09:46:41 /Users/me/.config/packer/plugins/github.com/ethanmdavidson/git/packer-plugin-git_v0.3.2_x5.0_darwin_amd64: plugin process exited
2022/08/08 09:46:41 /usr/local/bin/packer: plugin process exited
2022/08/08 09:46:41 /usr/local/bin/packer: plugin process exited
2022/08/08 09:46:41 /usr/local/bin/packer: plugin process exited
2022/08/08 09:46:41 /usr/local/bin/packer: plugin process exited

Additional Context

  • I found a few closed issues that seem to be the same issue, however, none of them had solutions or workarounds that work for me. (Note: these are both in hashicorp/packer and not this plugin's repo, but they are a few years old, so I wasn't sure if that was before this plugin was maybe split from the core packer project? Please let me know if I need to resubmit there).
  • While I don't have /Library/Preferences/VMware Fusion/vmnet0/dhcpd.conf, I do have /Library/Preferences/VMware Fusion/vmnet1/dhcpd.conf and /Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf. Unsure why these are incorrectly labeled? My next attempt is going to be after I recursively link vmnet8 to vmnet0. No idea if that will work, but we'll see!

SSH Fails on OSX Big Sur when upgraded from Earlier Mac/Fusion Versions

Overview of the Issue

Packer was unable to ssh into the vm due to its looking at an old DHCP leases file.

hashicorp/packer#10177

The PR code checks first the old location of the VMware leases file. For users who upgrade from Fusion 11 and Macos Catalina, for example, the old vmware leases file will exist and the code currently process that file first. In my case i had used the same vm in my previous configuration and there was a MAC address match in the old file, preventing the processing of the new apple leases file. Perhaps it should check the version of macos to determine which file to check

I was able to resolve by doing the following

sudo rm /var/db/vmware/*.leases
sudo rm /var/db/vmware/*.leases~

Packer version

Packer: 1.7.4

Operating system and Environment details

MacOS 11.4
VMware Fusion: 12.1.2

Set RAM size for video card

Hi!

I generated an OVA format image of CentOS 8 Stream using an ISO file, but when I run terraform to create the VM in ESXi 6.7 it returns an error message: Invalid VM configuration. Reason: 'Invalid configuration for device '2'.' for property 'VirtualVideoCard.videoRamSizeInKB'.

So I did some searchs and find a bug about the videoRamSizeInKB parameter: https://kb.vmware.com/s/article/65205

To confirm this I extracted the OVA file, opened the ovf file and found that the value is set to 262144KB (256MB).

Before this Stream image, I did an image of CentOS 8 'normal' and this one generated an ovf with value 131072KB (128MB)

Is the same computer and same script (I only changed the iso's URL and checksum).

I looked on documentation and don't found how to set video ram size.

When I create VM manually using ISO on VMware Workstation it already sets video ram to 256MB and doesn't enable to change.

Is possible to change this parameter? There is any workarround?

Here my environment:

  • Packer v1.7.10
  • Ubuntu 20.04.3 LTS 64bits

Thanks!

Wrong parameter in .vmx on Big Sur / VMware Fusion 12.2 Pro

Closed hashicorp/packer#11380 and moved to here:

Overview of the Issue

I tried to create a Linux VM (Fedora) using packer, kickstart and VMware Fusion 12.2 Pro. The Linux VM should run in a separate network vmnet5 I created before in VMware Fusion. After kicking the VM gots an IP address from the NAT network (Share with my Mac). But according to the VM settings the network adapter has been configured to use vmnet5.
When looking into the .vmx file created I saw, that there's a parameter:

ethernet.bsdname=en0

which refers to the main ethernet adapter of the Mac. If I remove this line, the VM booted into the right network.

Reproduction Steps

  • Create a packer file fedora.json (see below)
  • Create necessary kickstart files and place them into path
  • Start packer builder:
PACKER_LOG=1 packer build fedora.json 
  • Wait until VM is up and provides an emergency shell
  • Verify IP with ip a

Packer version

packer version:

Packer v1.7.8

Simplified Packer Template

{
  "builders": [
    {
      "boot_command": [
        "<tab> ",
        "inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}} loglevel=10 ",
        "biosdevname=0 ",
        "net.ifnames=0 ",
        "<enter>"
      ],
      "boot_wait": "5s",
      "cpus": "2",
      "disk_adapter_type": "scsi",
      "disk_size": "10240",
      "disk_type_id": "0",
      "guest_os_type": "fedora64Guest",
      "http_directory": "/path/to/ks",
      "iso_checksum": "...",
      "iso_url": "/path/to/fedora-server-netinst.iso",
      "network": "vmnet5",
      "network_adapter_type": "e1000",
      "memory": "2048",
      "output_directory": "/path/to/output/directory}",
      "shutdown_command": "****",
	  "ssh..."
      "type": "vmware-iso",
      "vm_name": "test"
    }
  ]
}

Operating system and Environment details

MacOS Big Sur, 11.6

Log Fragments and crash.log files

Log files looked good, packer detected the network:

[...]
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: Writing VMX to: /PATH/TO/VM/fedora.vmx
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: Configuring VMX...
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: Setting VMX: 'virtualHW.version' = '18'
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: Writing VMX to: /PATH/TO/VM/fedora.vmx
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: Suppressing messages in VMX
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2021/11/04 10:58:28 packer-builder-vmware-iso plugin: HostIP discovered custom device matching vmnet5: vmnet5
[...]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.