hashicorp/packer-plugin-vmware

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

logicbomb421 opened this issue · 6 comments

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!

More info:

  • Linking vmnet8 to vmnet0 didn't work.
  • Fully reinstalling VMware Fusion doesn't change anything. Still only has 1 and 8, no 0.

This seems like something is possibly hard-coded to vmnet0 somewhere and is now out-of-date?

rbeede commented

vmnet0 is linked to the bridged adapter, but if you try to view it in the VMware Virtual Network Editor it will not appear unless you have admin privileges.

rbeede commented

I have a similar issue with vmware workstation 16.2.5 on Windows and packer 1.9.4.

Error detecting host IP: Unable to find host IP from devices [vmnet0], last error: No host declarations containing vmnet0 found

rbeede commented

Possibly related?

hashicorp/packer#4091

rbeede commented

I do have luck if I comment out
# network = "bridged"

and use instead:

  vmx_data = {
	"ethernet0.connectionType" = "bridged"
  }