Ok
The output shows the buikd failed from packer point of view
the issue is here\
"sudo shutdown -h now"
you shoudln't do that
there is a section in the configuration that after all the provisioners are
done, will continue with poweroff
"builders": [
{
..
"shutdown_command": "echo 'shutdown -P now' > shutdown.sh; echo
'vagrant' | sudo -S sh 'shutdown.sh'"
}],
So the shutdown in the provisining is causing the problems
Alvaro
On Tue, Oct 17, 2017 at 1:42 AM, <[email protected]> wrote:
> I really appreciate the assistance. Full output is attached.
>
> End of the output is:
>
> ......
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 [INFO] Attempting SSH
> connection...
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 reconnecting to TCP
> connection for SSH
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 handshaking with SSH
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 handshake complete!
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 opening new ssh session
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 [INFO] agent forwarding
> enabled
> 2017/10/17 02:36:13 ui: ==> vmware-vmx: Connected to SSH!
> ==> vmware-vmx: Connected to SSH!
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 Running the provision hook
> 2017/10/17 02:36:13 [INFO] (telemetry) Starting provisioner shell
> 2017/10/17 02:36:13 ui: ==> vmware-vmx: Provisioning with shell script:
> /tmp/packer-shell888268440
> ==> vmware-vmx: Provisioning with shell script: /tmp/packer-shell888268440
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 Opening
> /tmp/packer-shell888268440 for reading
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 [INFO] 118 bytes written
> for 'uploadData'
> 2017/10/17 02:36:13 [INFO] 118 bytes written for 'uploadData'
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 opening new ssh session
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 Starting remote scp
> process: scp -vt /tmp
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 Started SCP session,
> beginning transfers...
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 Copying input data into
> temporary file so we can read the length
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 [DEBUG] scp: Uploading
> script_3281.sh: perms=C0644 size=118
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 SCP session complete,
> closing stdin pipe.
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 Waiting for SSH session to
> complete.
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 scp stderr (length 31):
> Sink: C0644 118 script_3281.sh
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 opening new ssh session
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 starting remote command:
> chmod 0755 /tmp/script_3281.sh
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 [INFO] RPC endpoint:
> Communicator ended with: 0
> 2017/10/17 02:36:13 [INFO] RPC client: Communicator ended with: 0
> 2017/10/17 02:36:13 [INFO] RPC endpoint: Communicator ended with: 0
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 [INFO] RPC client:
> Communicator ended with: 0
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 opening new ssh session
> 2017/10/17 02:36:13 packer: 2017/10/17 02:36:13 starting remote command:
> chmod +x /tmp/script_3281.sh; PACKER_BUILDER_TYPE='vmware-vmx'
> PACKER_BUILD_NAME='vmware-vmx' /tmp/script_3281.sh
> 2017/10/17 02:36:44 ui: vmware-vmx: Loaded plugins: fastestmirror
> vmware-vmx: Loaded plugins: fastestmirror
> 2017/10/17 02:36:44 ui: vmware-vmx: Loading mirror speeds from cached
> hostfile
> vmware-vmx: Loading mirror speeds from cached hostfile
> 2017/10/17 02:36:44 ui: vmware-vmx: * base:
> centos.mirror.colo-serv.net
> vmware-vmx: * base: centos.mirror.colo-serv.net
> 2017/10/17 02:36:44 ui: vmware-vmx: * extras:
> centos.mirror.netelligent.ca
> vmware-vmx: * extras: centos.mirror.netelligent.ca
> 2017/10/17 02:36:44 ui: vmware-vmx: * updates:
> centos.mirror.netelligent.ca
> vmware-vmx: * updates: centos.mirror.netelligent.ca
> 2017/10/17 02:36:45 ui: vmware-vmx: No packages marked for update
> vmware-vmx: No packages marked for update
> 2017/10/17 02:36:45 ui: vmware-vmx: Loaded plugins: fastestmirror
> vmware-vmx: Loaded plugins: fastestmirror
> 2017/10/17 02:36:45 ui: vmware-vmx: Loading mirror speeds from cached
> hostfile
> vmware-vmx: Loading mirror speeds from cached hostfile
> 2017/10/17 02:36:45 ui: vmware-vmx: * base:
> centos.mirror.colo-serv.net
> vmware-vmx: * base: centos.mirror.colo-serv.net
> 2017/10/17 02:36:45 ui: vmware-vmx: * extras:
> centos.mirror.netelligent.ca
> vmware-vmx: * extras: centos.mirror.netelligent.ca
> 2017/10/17 02:36:45 ui: vmware-vmx: * updates:
> centos.mirror.netelligent.ca
> vmware-vmx: * updates: centos.mirror.netelligent.ca
> 2017/10/17 02:36:46 ui: vmware-vmx: Package
> git-1.8.3.1-12.el7_4.x86_64 already installed and latest version
> vmware-vmx: Package git-1.8.3.1-12.el7_4.x86_64 already installed and
> latest version
> 2017/10/17 02:36:46 ui: vmware-vmx: Nothing to do
> vmware-vmx: Nothing to do
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 Remote command exited
> without exit status or exit signal.
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 [INFO] RPC endpoint:
> Communicator ended with: 2300218
> 2017/10/17 02:36:46 [INFO] 499 bytes written for 'stdout'
> 2017/10/17 02:36:46 [INFO] 0 bytes written for 'stderr'
> 2017/10/17 02:36:46 [INFO] RPC client: Communicator ended with: 2300218
> 2017/10/17 02:36:46 [INFO] RPC endpoint: Communicator ended with: 2300218
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 [INFO] 499 bytes written
> for 'stdout'
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 [INFO] 0 bytes written for
> 'stderr'
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 [INFO] RPC client:
> Communicator ended with: 2300218
> 2017/10/17 02:36:46 [INFO] (telemetry) ending shell
> 2017/10/17 02:36:46 [INFO] (telemetry) found error: Script disconnected
> unexpectedly.
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 Executing: /usr/bin/vmrun
> [-T ws list]
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 stdout: Total running VMs:
> 1
> 2017/10/17 02:36:46 packer: /root/Downloads/testdir/
> packer-vmware-vmx-1508222149.vmx
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 stderr:
> 2017/10/17 02:36:46 ui: ==> vmware-vmx: Stopping virtual machine...
> ==> vmware-vmx: Stopping virtual machine...
> 2017/10/17 02:36:46 packer: 2017/10/17 02:36:46 Executing: /usr/bin/vmrun
> [-T ws stop testdir/packer-vmware-vmx-1508222149.vmx hard]
> 2017/10/17 02:36:47 packer: 2017/10/17 02:36:47 stdout:
> 2017/10/17 02:36:47 packer: 2017/10/17 02:36:47 stderr:
> 2017/10/17 02:36:47 ui: ==> vmware-vmx: Deleting output directory...
> ==> vmware-vmx: Deleting output directory...
> 2017/10/17 02:36:47 [INFO] (telemetry) ending vmware-vmx
> 2017/10/17 02:36:47 [INFO] (telemetry) found error: Script disconnected
> unexpectedly.
> 2017/10/17 02:36:47 ui error: Build 'vmware-vmx' errored: Script
> disconnected unexpectedly.
> 2017/10/17 02:36:47 Builds completed. Waiting on interrupt barrier...
> 2017/10/17 02:36:47 machine readable: error-count []string{"1"}
> 2017/10/17 02:36:47 ui error:
> ==> Some builds didn't complete successfully and had errors:
> 2017/10/17 02:36:47 machine readable: vmware-vmx,error []string{"Script
> disconnected unexpectedly."}
> 2017/10/17 02:36:47 ui error: --> vmware-vmx: Script disconnected
> unexpectedly.
> 2017/10/17 02:36:47 ui:
> ==> Builds finished but no artifacts were created.
> Build 'vmware-vmx' errored: Script disconnected unexpectedly.
>
> ==> Some builds didn't complete successfully and had errors:
> --> vmware-vmx: Script disconnected unexpectedly.
>
> ==> Builds finished but no artifacts were created.
> 2017/10/17 02:36:48 waiting for all plugin processes to complete...
> 2017/10/17 02:36:48 /root/Downloads/packer: plugin process exited
> 2017/10/17 02:36:48 /root/Downloads/packer: plugin process exited
> 2017/10/17 02:36:48 /root/Downloads/packer: plugin process exited
>
>
> On Monday, October 16, 2017 at 11:39:37 PM UTC-4, Alvaro Miranda Aguilera
> wrote:
>>
>> can you share a verbose log and the error ?
>>
>> set this var
>> PACKER_LOG=1
>>
>> Alvaro
>>
>> On Mon, Oct 16, 2017 at 1:11 PM, <[email protected]> wrote:
>>
>>> Hello All,
>>>
>>> I'm trying to get my feet wet with using packer for template management
>>> in my vSphere environment. I've started with a simple case following this
>>> blog ( https://theithollow.com/2017/03/06/using-packer-create-vsphe
>>> re-aws-images/ ) and adjusting based on other examples I've found
>>> online.
>>>
>>> Using VMware workstation (trying both windows and linux as a host) on my
>>> local VM, I've attempted to use either the vmware-iso or vmware-vmx
>>> builders to create a VM within Workstation and then use the vsphere
>>> post-provisioner to distribute to my vsphere environment. While the
>>> builders and provisioner seem to work flawlessly, the vsphere
>>> post-provisioner keeps erroring out with "Script disconnected unexpectedly"
>>> and deleting the working directory.
>>>
>>> ovftool is in the $PATH
>>>
>>>
>>> Is there something I'm missing? Is there some other method or plugin
>>> that I need here?
>>>
>>> Example of my json:
>>>
>>> {
>>> "builders": [
>>> {
>>> "type": "vmware-vmx",
>>> "source_path": "/root/Downloads/output-vmware
>>> -iso/test-centos.vmx",
>>> "ssh_username": "vagrant",
>>> "ssh_password": "vagrant",
>>> "ssh_wait_timeout": "10000s",
>>> "shutdown_command": "echo 'shutdown -P now' > shutdown.sh;
>>> echo 'vagrant' | sudo -S sh 'shutdown.sh'"
>>> }],
>>> "provisioners": [
>>> {
>>> "type": "shell",
>>> "inline":
>>> [
>>> "sleep 30",
>>> "sudo yum -y update ",
>>> "sudo yum -y install git",
>>> "sudo touch ~/I_DID_MORE_THINGS",
>>> "sudo shutdown -h now"
>>> ]
>>> }],
>>> "post-processors": [
>>> {
>>> "type": "vsphere",
>>> "host": "vCenter-hostname",
>>> "username": "vCenter-user",
>>> "password": "vCenter-password",
>>> "cluster": "CLUSTERNAME",
>>> "datacenter": "DATACENTERNAME",
>>> "resource_pool": "RPNAME",
>>> "datastore": "DATASTORENAME",
>>> "vm_folder": "FOLDER",
>>> "vm_name": "test1",
>>> "vm_network": "PORTGROUP",
>>> "disk_mode": "thin",
>>> "insecure": "true"
>>> }
>>> ]
>>>
>>> }
>>>
>>> --
>>> 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/ms
>>> gid/packer-tool/db842bd2-ba62-4169-8468-fb8bd9154048%40googlegroups.com
>>> <https://groups.google.com/d/msgid/packer-tool/db842bd2-ba62-4169-8468-fb8bd9154048%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Alvaro
>>
>> --
> 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/0ccde473-e899-49a7-ad5a-3af4e217e96d%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/0ccde473-e899-49a7-ad5a-3af4e217e96d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
Alvaro
--
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/CAHqq0ewf0f44%3D8RGQyQsbSzLi0tBTRWpc7cCHuqaupAZMtJ%3D2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.