Packer vmware-iso not creating vmx file

2,103 views
Skip to first unread message

Nelson Jeppesen

unread,
Jan 28, 2014, 2:29:58 PM1/28/14
to packe...@googlegroups.com
I've search but cant figure this out. When I run packer it wont create the VMX file but does not raise an exception.

An exception is raised a few steps latter when trying to start the VM. After packer completes I see a corrupt VM added to vCenter as 'unknown'. It can be removed but not edited in any manor.

Thanks for the help!
 
[root@util packer]# ./packer build ubuntu.vmware
vmware-iso output will be in this color.

==> vmware-iso: Downloading or copying ISO
    vmware-iso: Downloading or copying: http://repo/ubuntu-12.04.1-server-amd64.iso
==> vmware-iso: Uploading ISO to remote machine...
==> vmware-iso: Creating virtual machine disk
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Starting HTTP server on port 8367
==> vmware-iso: Registering remote VM...
==> vmware-iso: Starting virtual machine...
==> vmware-iso: Error starting VM: 'vim-cmd vmsvc/power.on /vmfs/volumes/san/test/ubuntu-12.04-packer.vmx'
==> vmware-iso:
==> vmware-iso: Stdout:
==> vmware-iso:
==> vmware-iso: Stderr: (vim.fault.NotFound) {
==> vmware-iso:    dynamicType = <unset>,
==> vmware-iso:    faultCause = (vmodl.MethodFault) null,
==> vmware-iso:    msg = "Unable to find a VM corresponding to "/vmfs/volumes/san/test/ubuntu-12.04-packer.vmx"",
==> vmware-iso: }
==> vmware-iso:

the json:
{
  "builders": [{
    "vm_name": "ubuntu-12.04-packer",
    "output_directory": "test",
    "type": "vmware-iso",
    "guest_os_type": "ubuntu",
    "http_directory": "http",
    "iso_url": "http://repo/ubuntu-12.04.1-server-amd64.iso",
    "iso_checksum_type":"md5",
    "iso_checksum":"a8c667e871f48f3a662f3fbf1c3ddb17",
    "ssh_username": "nnnnnn",
    "ssh_password": "aaaaa",
    "ssh_wait_timeout": "10000s",
    "remote_type":"esx5",
    "remote_host":"n7vmw2524",
    "remote_username":"root",
    "remote_password":"aaaaaaa",
    "remote_datastore":"san",
    "boot_command": [
      "<esc><esc><enter><wait>",
      "/install/vmlinuz auto",
      " console-setup/ask_detect=false",
      " console-setup/layoutcode=us",
      " console-setup/modelcode=pc105",
      " debconf/frontend=noninteractive",
      " debian-installer=en_US",
      " fb=false",
      " initrd=/install/initrd.gz",
      " kbd-chooser/method=us",
      " keyboard-configuration/layout=USA",
      " keyboard-configuration/variant=USA",
      " locale=en_US",
      " netcfg/get_domain=vm",
      " netcfg/get_hostname=vagrant",
      " noapic" ,
      " preseed/url=http://repo/ubuntu.12.04.seed",
      " -- ",
      "<enter>"
    ],
    "shutdown_command": "shutdown -h now",
    "disk_size": 10140
  }]
}


Nelson Jeppesen

unread,
Jan 31, 2014, 8:40:20 PM1/31/14
to packe...@googlegroups.com
Anyone have any suggestion? anything i can try?

Mike Farmer

unread,
Feb 26, 2014, 11:28:43 AM2/26/14
to packe...@googlegroups.com
Just a stab in the dark here, but is vm-cmd in your path? It looks like it isn't finding the vmware command line tools.

Jason Evans

unread,
Mar 7, 2014, 2:44:54 PM3/7/14
to packe...@googlegroups.com
I am getting the same exception. I am using the project https://github.com/dougm/packer-ttylinux.git to test building a VMWare ESXi image. Below is the error message I am getting from packer. Looking at the command line documentation for the "vim-cmd vmsvc/power.on" command it says it should be:

vim-cmd vmsvc/power.on <vmid>

But packer is is passing the vmx path and not the vmid:

vim-cmd vmsvc/power.on /vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx

What am I missing? I am using ESXi 5.0.


Packer output:

vmware-iso output will be in this color.

==> vmware-iso: Downloading or copying ISO
    vmware-iso: Downloading or copying: http://dl.bintray.com/dougm/ttylinux/ttylinux-pc_i486-16.1.iso
==> vmware-iso: Uploading ISO to remote machine...
==> vmware-iso: Creating virtual machine disk
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Registering remote VM...
==> vmware-iso: Starting virtual machine...
==> vmware-iso: Error starting VM: 'vim-cmd vmsvc/power.on /vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx'
==> vmware-iso:
==> vmware-iso: Stdout:
==> vmware-iso:
==> vmware-iso: Stderr: (vim.fault.NotFound) {
==> vmware-iso:    dynamicType = <unset>,
==> vmware-iso:    faultCause = (vmodl.MethodFault) null,
==> vmware-iso:    msg = "Unable to find a VM corresponding to "/vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx"",
==> vmware-iso: }
==> vmware-iso:
==> vmware-iso: Waiting 3.995912725s to give VMware time to clean up...
==> vmware-iso: Unregistering virtual machine...
==> vmware-iso: Error unregistering VM: 'vim-cmd vmsvc/unregister /vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx'
==> vmware-iso:
==> vmware-iso: Stdout:
==> vmware-iso:
==> vmware-iso: Stderr: (vim.fault.NotFound) {
==> vmware-iso:    dynamicType = <unset>,
==> vmware-iso:    faultCause = (vmodl.MethodFault) null,
==> vmware-iso:    msg = "Unable to find a VM corresponding to "/vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx"",
==> vmware-iso: }
==> vmware-iso:
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Error starting VM: 'vim-cmd vmsvc/power.on /vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx'

Stdout:

Stderr: (vim.fault.NotFound) {
   dynamicType = <unset>,
   faultCause = (vmodl.MethodFault) null,
   msg = "Unable to find a VM corresponding to "/vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx"",
}


==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Error starting VM: 'vim-cmd vmsvc/power.on /vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx'

Stdout:

Stderr: (vim.fault.NotFound) {
   dynamicType = <unset>,
   faultCause = (vmodl.MethodFault) null,
   msg = "Unable to find a VM corresponding to "/vmfs/volumes/OS_Images_6/output-vmware-iso/packer-vmware-iso.vmx"",
}


==> Builds finished but no artifacts were created.

Jon Castro

unread,
Mar 26, 2014, 10:35:02 PM3/26/14
to packe...@googlegroups.com
I'm having the same problem. My version of ESXI expects the vmid and not the vmx path. 

vim-cmd help vmsvc/power.on
Usage: power.on vmid

I've checked packer github code and master branch is still using xpath so this bug is not still resolved.

https://github.com/mitchellh/packer/blob/master/builder/vmware/iso/driver_esx5.go

func (d *ESX5Driver) Start(vmxPathLocal string, headless bool) error {
    vmxPath := filepath.Join(d.outputDir, filepath.Base(vmxPathLocal))
    return d.sh("vim-cmd", "vmsvc/power.on", vmxPath)
}

日下部雄也

unread,
Apr 7, 2014, 4:29:24 AM4/7/14
to packe...@googlegroups.com
I fixed it and sended the pull request.
2014年1月29日水曜日 4時29分58秒 UTC+9 Nelson Jeppesen:
Reply all
Reply to author
Forward
0 new messages