Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmware-iso: cd_files not working properly #15

Open
ghost opened this issue Apr 22, 2021 · 7 comments
Open

vmware-iso: cd_files not working properly #15

ghost opened this issue Apr 22, 2021 · 7 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Apr 22, 2021

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:
@azr
Copy link
Contributor

azr commented Aug 18, 2021

Hello there, thanks for opening, this should have been solved by #30, you can try the most recent release of this plugin ! Please tell us if something's wrong !

@azr azr closed this as completed Aug 18, 2021
@t0rr3sp3dr0
Copy link

@azr this problem is still reproducible on version v1.0.3.

Added the following to the simplified packer buildfile to make sure I'm using the latest version of the plugin:

packer {
  required_version = ">= 1.7.0"

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

@azr azr reopened this Nov 1, 2021
@jtognazzi
Copy link

jtognazzi commented Oct 25, 2022

I also have a similar issue when build against a remote ESXi Hypervisor vith the current v1.0.7.
the cd is created and uploaded but not mounted !
adding

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

Make the cdrom to be mounted

@tenthirtyam tenthirtyam changed the title cd_files not working properly on vmware-iso vmware-iso: cd_files not working properly Aug 22, 2023
@tenthirtyam tenthirtyam self-assigned this Mar 11, 2024
@tenthirtyam tenthirtyam added hypervisor/fusion VMware Fusion hypervisor/player VMware Player labels May 19, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone May 24, 2024
@tenthirtyam tenthirtyam modified the milestones: Backlog, v1.1.1 Jul 10, 2024
@tenthirtyam
Copy link
Collaborator

tenthirtyam commented Aug 15, 2024

Have you set the following?

cdrom_adapter_type = "sata"

@jasase
Copy link

jasase commented Sep 3, 2024

When try with cdrom_adapter_type = "data" i get the following error:

2024/09/03 15:16:34 packer-plugin-vmware_v1.1.0_x5.0_windows_amd64.exe plugin: 2024/09/03 15:16:34 [TRACE] starting builder iso
Error: 1 error(s) occurred:


* cdrom_adapter_type must be one of ide, sata, or scsi

@tenthirtyam
Copy link
Collaborator

When try with cdrom_adapter_type = "data" i get the following error:

cdrom_adapter_type = "sata"

@tenthirtyam tenthirtyam modified the milestones: v1.1.1, v1.1.2 Sep 7, 2024
@tenthirtyam
Copy link
Collaborator

I think I have tracked this issue down and will plan to address it for the next release, v1.1.1.

@tenthirtyam tenthirtyam modified the milestones: v1.1.2, v1.1.1 Sep 7, 2024
@tenthirtyam tenthirtyam added hypervisor/workstation VMware Workstation hypervisor/esxi VMware ESXi and removed stage/waiting-reply labels Sep 7, 2024
@tenthirtyam tenthirtyam modified the milestones: v1.1.1, v1.2.0 Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants