Hi Steven,

This is something I’ve been working on recently and it sounds like we’re 
trying to achieve the same thing. I think I’ve gotten a bunch further than 
you have, so hopefully this’ll help:

Re the output directory error: You’ll find that that occurs locally, so if 
you create a local directory with the same name, it’ll stop happening. 
These are relevant here:

* https://github.com/mitchellh/packer/issues/3087
* https://github.com/mitchellh/packer/pull/3050

Those fixes are in master now, so if you compile a copy this will go away.

Re: remote artefacts: The artefacts will stay on the remote (ESXi box). 
I’ve been adding ""keep_registered": true” to the builder so I can easily 
boot them back up.

Does this help?

—
Nick

On Thursday, 6 October 2016 18:27:00 UTC-4, Steven Langlois wrote:
>
> When building the VM on an ESX server, everything is working but it fails 
> at the very end when it is about to put the files in the output directory 
> and complains that the output directory does not exist. 
>
> A very similar json (only the network information is different) with the 
> same kickstart file runs fine when I have VM Player on the same machine 
> that where packer is installed but when I use the ESX server I get the 
> following output.
>
> If I create the output directory, it says it works and the files will be 
> put into the output directory but after completion, the output directory is 
> empty. The files are on the ESX server datastore but not on the machine 
> where Packer is installed. When building on an ESX server, is the output 
> directory relative to the local machine or is relative to the ESX datastore?
>
> I've also noticed that after completion, the VM on the ESX server is 
> orphaned. I cannot power it on.
>
> I've attached the json and debug log information from packer.
>
> *==> vmware-iso: Compacting the disk image*
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 Writing VMX to: 
> /tmp/packer-vmx816374223/centos-7.2-x86_64.vmx
>
> 2016/10/06 17:37:40 ui: *==> vmware-iso: Cleaning VMX prior to finishing 
> up...*
>
> *==> vmware-iso: Cleaning VMX prior to finishing up...*
>
> 2016/10/06 17:37:40 ui:     vmware-iso: Unmounting floppy from VMX...
>
>     vmware-iso: Unmounting floppy from VMX...
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 Deleting key: 
> floppy0.present
>
> 2016/10/06 17:37:40 ui:     vmware-iso: Detaching ISO from CD-ROM 
> device...
>
>     vmware-iso: Detaching ISO from CD-ROM device...
>
> 2016/10/06 17:37:40 ui:     vmware-iso: Disabling VNC server...
>
>     vmware-iso: Disabling VNC server...
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 Writing VMX to: 
> /tmp/packer-vmx816374223/centos-7.2-x86_64.vmx
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 opening new ssh session
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 Starting remote scp 
> process:  scp -vt /vmfs/volumes/Datastore2/zr-centos-7.2-x86_64-vmware
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 Started SCP session, 
> beginning transfers...
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 Copying input data into 
> temporary file so we can read the length
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 [DEBUG] scp: Uploading 
> centos-7.2-x86_64.vmx: perms=C0644 size=2388
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 SCP session complete, 
> closing stdin pipe.
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 Waiting for SSH session to 
> complete.
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 scp stderr (length 39): 
> Sink: C0644 2388 centos-7.2-x86_64.vmx
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 opening new ssh session
>
> 2016/10/06 17:37:40 packer: 2016/10/06 17:37:40 starting remote command: 
> vim-cmd vmsvc/reload 947
>
> 2016/10/06 17:37:41 packer: 2016/10/06 17:37:41 remote command exited with 
> '0': vim-cmd vmsvc/reload 947
>
> 2016/10/06 17:37:41 packer: 2016/10/06 17:37:41 opening new ssh session
>
> 2016/10/06 17:37:41 packer: 2016/10/06 17:37:41 starting remote command: 
> vim-cmd vmsvc/power.getstate 947
>
> 2016/10/06 17:37:42 packer: 2016/10/06 17:37:42 remote command exited with 
> '0': vim-cmd vmsvc/power.getstate 947
>
> 2016/10/06 17:37:42 ui: *==> vmware-iso: Unregistering virtual machine...*
>
> 2016/10/06 17:37:42 packer: 2016/10/06 17:37:42 opening new ssh session
>
> *==> vmware-iso: Unregistering virtual machine...*
>
> 2016/10/06 17:37:42 packer: 2016/10/06 17:37:42 starting remote command: 
> vim-cmd vmsvc/unregister 947
>
> 2016/10/06 17:37:43 packer: 2016/10/06 17:37:43 remote command exited with 
> '0': vim-cmd vmsvc/unregister 947
>
> 2016/10/06 17:37:43 ui error: *Build 'vmware-iso' errored: lstat 
> zr-centos-7.2-x86_64-vmware: no such file or directory*
>
> 2016/10/06 17:37:43 Builds completed. Waiting on interrupt barrier...
>
> 2016/10/06 17:37:43 machine readable: error-count []string{"1"}
>
> 2016/10/06 17:37:43 ui error: 
>
> ==> Some builds didn't complete successfully and had errors:
>
> 2016/10/06 17:37:43 machine readable: vmware-iso,error []string{"lstat 
> zr-centos-7.2-x86_64-vmware: no such file or directory"}
>
> 2016/10/06 17:37:43 ui error: --> vmware-iso: lstat 
> zr-centos-7.2-x86_64-vmware: no such file or directory
>
> 2016/10/06 17:37:43 ui: 
>
> ==> Builds finished but no artifacts were created.
>
> 2016/10/06 17:37:43 waiting for all plugin processes to complete...
>
> *Build 'vmware-iso' errored: lstat zr-centos-7.2-x86_64-vmware: no such 
> file or directory*
>
>
> ==> Some builds didn't complete successfully and had errors:
>
> --> vmware-iso: lstat zr-centos-7.2-x86_64-vmware: no such file or 
> directory
>
>
> 2016/10/06 18:04:12 ui:     vmware-iso: Detaching ISO from CD-ROM 
> device...
>
>     vmware-iso: Detaching ISO from CD-ROM device...
>
> 2016/10/06 18:04:12 ui:     vmware-iso: Disabling VNC server...
>
>     vmware-iso: Disabling VNC server...
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 Writing VMX to: 
> /tmp/packer-vmx526502208/centos-7.2-x86_64.vmx
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 opening new ssh session
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 Starting remote scp 
> process:  scp -vt /vmfs/volumes/Datastore2/zr1-centos-7.2-x86_64-vmware
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 Started SCP session, 
> beginning transfers...
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 Copying input data into 
> temporary file so we can read the length
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 [DEBUG] scp: Uploading 
> centos-7.2-x86_64.vmx: perms=C0644 size=2388
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 SCP session complete, 
> closing stdin pipe.
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 Waiting for SSH session to 
> complete.
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 scp stderr (length 39): 
> Sink: C0644 2388 centos-7.2-x86_64.vmx
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 opening new ssh session
>
> 2016/10/06 18:04:12 packer: 2016/10/06 18:04:12 starting remote command: 
> vim-cmd vmsvc/reload 948
>
> 2016/10/06 18:04:13 packer: 2016/10/06 18:04:13 remote command exited with 
> '0': vim-cmd vmsvc/reload 948
>
> 2016/10/06 18:04:13 packer: 2016/10/06 18:04:13 opening new ssh session
>
> 2016/10/06 18:04:13 packer: 2016/10/06 18:04:13 starting remote command: 
> vim-cmd vmsvc/power.getstate 948
>
> 2016/10/06 18:04:14 packer: 2016/10/06 18:04:14 remote command exited with 
> '0': vim-cmd vmsvc/power.getstate 948
>
> 2016/10/06 18:04:14 ui: *==> vmware-iso: Unregistering virtual machine...*
>
> *==> vmware-iso: Unregistering virtual machine...*
>
> 2016/10/06 18:04:14 packer: 2016/10/06 18:04:14 opening new ssh session
>
> 2016/10/06 18:04:14 packer: 2016/10/06 18:04:14 starting remote command: 
> vim-cmd vmsvc/unregister 948
>
> 2016/10/06 18:04:15 packer: 2016/10/06 18:04:15 remote command exited with 
> '0': vim-cmd vmsvc/unregister 948
>
> 2016/10/06 18:04:15 ui: *Build 'vmware-iso' finished.*
>
> 2016/10/06 18:04:15 Builds completed. Waiting on interrupt barrier...
>
> 2016/10/06 18:04:15 ui: 
>
> ==> Builds finished. The artifacts of successful builds are:
>
> 2016/10/06 18:04:15 machine readable: vmware-iso,artifact-count 
> []string{"1"}
>
> *Build 'vmware-iso' finished.*
>
>
> ==> Builds finished. The artifacts of successful builds are:
>
> 2016/10/06 18:04:15 machine readable: vmware-iso,artifact []string{"0", 
> "builder-id", "mitchellh.vmware-esx"}
>
> 2016/10/06 18:04:15 machine readable: vmware-iso,artifact []string{"0", 
> "id", "VM"}
>
> 2016/10/06 18:04:15 machine readable: vmware-iso,artifact []string{"0", 
> "string", "VM files in directory: zr1-centos-7.2-x86_64-vmware"}
>
> 2016/10/06 18:04:15 machine readable: vmware-iso,artifact []string{"0", 
> "files-count", "0"}
>
> 2016/10/06 18:04:15 machine readable: vmware-iso,artifact []string{"0", 
> "end"}
>
> 2016/10/06 18:04:15 ui: --> vmware-iso: VM files in directory: 
> zr1-centos-7.2-x86_64-vmware
>
> 2016/10/06 18:04:15 waiting for all plugin processes to complete...
>
> --> vmware-iso: VM files in directory: zr1-centos-7.2-x86_64-vmware
>
> 2016/10/06 18:04:15 /usr/local/bin/packer: plugin process exited
>
> 2016/10/06 18:04:15 /usr/local/bin/packer: plugin process exited
>
> 2016/10/06 18:04:15 /usr/local/bin/packer: plugin process exited
>
> [newzr@newgw189 bento-master]$ ls -ltr
>
> total 4748
>
> -rw-r--r--  1 newzr newzr   56412 Sep 21 13:44 CHANGELOG.md
>
> -rw-r--r--  1 newzr newzr     119 Sep 21 13:44 Gemfile
>
> -rw-r--r--  1 newzr newzr   10850 Sep 21 13:44 LICENSE
>
> -rw-r--r--  1 newzr newzr    1288 Sep 21 13:44 MAINTAINERS.md
>
> -rw-r--r--  1 newzr newzr     304 Sep 21 13:44 NOTICE.md
>
> -rw-r--r--  1 newzr newzr   11051 Sep 21 13:44 OLD-BOXES.md
>
> -rw-r--r--  1 newzr newzr   22376 Sep 21 13:44 README.md
>
> -rw-r--r--  1 newzr newzr    3165 Sep 21 13:44 Rakefile
>
> -rw-r--r--  1 newzr newzr    1439 Sep 21 13:44 Thorfile
>
> drwxr-xr-x  2 newzr newzr    4096 Sep 21 13:44 archive
>
> drwxr-xr-x  2 newzr newzr    4096 Sep 21 13:44 bin
>
> -rw-r--r--  1 newzr newzr      35 Sep 21 13:44 bootstrap.sh
>
> -rw-r--r--  1 newzr newzr    1486 Sep 21 13:44 build.sh
>
> -rw-r--r--  1 newzr newzr    1068 Sep 21 13:44 buildkite.rb
>
> -rw-r--r--  1 newzr newzr    6038 Sep 21 13:44 centos-5.11-i386.json
>
> -rw-r--r--  1 newzr newzr    6040 Sep 21 13:44 centos-5.11-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6028 Sep 21 13:44 centos-6.8-i386.json
>
> -rw-r--r--  1 newzr newzr    6030 Sep 21 13:44 centos-6.8-x86_64.json
>
> -rw-r--r--  1 newzr newzr    8285 Sep 21 13:44 debian-7.11-amd64.json
>
> -rw-r--r--  1 newzr newzr    8286 Sep 21 13:44 debian-7.11-i386.json
>
> -rw-r--r--  1 newzr newzr    8527 Sep 21 13:44 debian-8.5-amd64.json
>
> -rw-r--r--  1 newzr newzr    8528 Sep 21 13:44 debian-8.5-i386.json
>
> -rw-r--r--  1 newzr newzr    5949 Sep 21 13:44 fedora-23-i386.json
>
> -rw-r--r--  1 newzr newzr    6161 Sep 21 13:44 fedora-23-x86_64.json
>
> -rw-r--r--  1 newzr newzr    5952 Sep 21 13:44 fedora-24-i386.json
>
> -rw-r--r--  1 newzr newzr    6165 Sep 21 13:44 fedora-24-x86_64.json
>
> drwxr-xr-x  4 newzr newzr    4096 Sep 21 13:44 floppy
>
> -rw-r--r--  1 newzr newzr    7959 Sep 21 13:44 freebsd-10.3-amd64.json
>
> -rw-r--r--  1 newzr newzr    7952 Sep 21 13:44 freebsd-10.3-i386.json
>
> -rw-r--r--  1 newzr newzr    8376 Sep 21 13:44 freebsd-9.3-amd64.json
>
> -rw-r--r--  1 newzr newzr    8371 Sep 21 13:44 freebsd-9.3-i386.json
>
> drwxr-xr-x 24 newzr newzr    4096 Sep 21 13:44 http
>
> -rw-r--r--  1 newzr newzr    6589 Sep 21 13:44 macosx-10.10.json
>
> -rw-r--r--  1 newzr newzr    6590 Sep 21 13:44 macosx-10.11.json
>
> -rw-r--r--  1 newzr newzr    6586 Sep 21 13:44 macosx-10.7.json
>
> -rw-r--r--  1 newzr newzr    6586 Sep 21 13:44 macosx-10.8.json
>
> -rw-r--r--  1 newzr newzr    6586 Sep 21 13:44 macosx-10.9.json
>
> -rw-r--r--  1 newzr newzr    8299 Sep 21 13:44 omnios-r151014.json
>
> -rw-r--r--  1 newzr newzr    8299 Sep 21 13:44 omnios-r151018.json
>
> -rw-r--r--  1 newzr newzr    6751 Sep 21 13:44 opensuse-13.2-i386.json
>
> -rw-r--r--  1 newzr newzr    6751 Sep 21 13:44 opensuse-13.2-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6781 Sep 21 13:44 
> opensuse-leap-42.1-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6003 Sep 21 13:44 oracle-5.11-i386.json
>
> -rw-r--r--  1 newzr newzr    6005 Sep 21 13:44 oracle-5.11-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6038 Sep 21 13:44 oracle-6.7-i386.json
>
> -rw-r--r--  1 newzr newzr    6040 Sep 21 13:44 oracle-6.7-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6040 Sep 21 13:44 oracle-7.2-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6004 Sep 21 13:44 rhel-5.11-i386.json
>
> -rw-r--r--  1 newzr newzr    6003 Sep 21 13:44 rhel-5.11-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6039 Sep 21 13:44 rhel-6.8-i386.json
>
> -rw-r--r--  1 newzr newzr    6038 Sep 21 13:44 rhel-6.8-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6038 Sep 21 13:44 rhel-7.2-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6563 Sep 21 13:44 sles-12-sp1-x86_64.json
>
> -rw-r--r--  1 newzr newzr    6620 Sep 21 13:44 sles-12-x86_64.json
>
> -rw-r--r--  1 newzr newzr    4303 Sep 21 13:44 solaris-10.11-x86.json
>
> -rw-r--r--  1 newzr newzr    6342 Sep 21 13:44 solaris-11-x86.json
>
> -rw-r--r--  1 newzr newzr    9168 Sep 21 13:44 ubuntu-12.04-amd64.json
>
> -rw-r--r--  1 newzr newzr    9170 Sep 21 13:44 ubuntu-12.04-i386.json
>
> -rw-r--r--  1 newzr newzr    9168 Sep 21 13:44 ubuntu-14.04-amd64.json
>
> -rw-r--r--  1 newzr newzr    9170 Sep 21 13:44 ubuntu-14.04-i386.json
>
> -rw-r--r--  1 newzr newzr   10718 Sep 21 13:44 ubuntu-15.10-amd64.json
>
> -rw-r--r--  1 newzr newzr   10724 Sep 21 13:44 ubuntu-15.10-i386.json
>
> -rw-r--r--  1 newzr newzr   10718 Sep 21 13:44 ubuntu-16.04-amd64.json
>
> -rw-r--r--  1 newzr newzr   10726 Sep 21 13:44 ubuntu-16.04-i386.json
>
> drwxr-xr-x  3 newzr newzr    4096 Sep 21 13:44 vagrantfile_templates
>
> -rw-r--r--  1 newzr newzr    2386 Sep 21 13:44 windows-nano-tp3.json
>
> drwxr-xr-x  2 newzr newzr    4096 Sep 21 13:44 packer_cache
>
> -rw-r--r--  1 newzr newzr    6033 Sep 21 13:45 centos-7.2-x86_64.json
>
> -rw-------  1 newzr newzr 2097152 Sep 21 13:45 Redhat_64.vdi
>
> -rw-------  1 newzr newzr 2097152 Sep 21 13:45 RedHat_64.vdi
>
> -rw-r--r--  1 newzr newzr    2829 Sep 21 16:09 
> virtualbox-centos-7.2-x86_64.json
>
> drwxr-xr-x  2 newzr newzr    4096 Sep 21 16:09 builds
>
> drwxr-xr-x  2 newzr newzr    4096 Sep 21 16:18 
> packer-centos-7.2-x86_64-virtualbox
>
> -rw-r--r--  1 newzr newzr       0 Sep 21 16:32 build.pwi
>
> -rw-r--r--  1 newzr newzr       0 Sep 21 16:32 build.pwd
>
> -rw-r--r--  1 newzr newzr       0 Sep 21 16:32 build.hwm
>
> -rw-r--r--  1 newzr newzr    2505 Sep 24 16:43 
> vmware-centos-7.2-x86_64.json
>
> drwxr-xr-x 16 newzr newzr    4096 Sep 28 10:08 scripts
>
> -rw-r--r--  1 newzr newzr    2843 Oct  6 13:34 zr60.json
>
> drwxrwxr-x  2 newzr newzr    4096 Oct  6 17:52 
> zr1-centos-7.2-x86_64-vmware
>
> -rw-r--r--  1 newzr newzr    2904 Oct  6 17:52 zr60-remote.json
>
> [newzr@newgw189 bento-master]$ cd zr1-centos-7.2-x86_64-vmware/
>
> [newzr@newgw189 zr1-centos-7.2-x86_64-vmware]$ ls
>
>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/1b8c6a8d-3fad-49aa-a210-ab162ead744f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to