Skip to content

Batch file in shutdown_command non-zero after 1.0.0 #51

@timsutton

Description

@timsutton

The weird side effects of me trying to sysprep as a shutdown_command continue!

Using the released 1.0.0 binaries, I can put this command into a batch file:

c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown

..and call it using `shutdown_command: "a:\run_sysprep.bat"

I can add an /unattend:c:\path\to\unattend.xml flag as well.

With the latest 1.0.1 prerelease (https://github.com/packer-community/packer-windows-plugins/releases/tag/pre-release), I get a non-zero exit status on the shutdown:

2015/05/11 13:48:00 ui: ==> vmware-windows-iso: Gracefully halting virtual machine...
==> vmware-windows-iso: Gracefully halting virtual machine...
2015/05/11 13:48:00 packer-builder-vmware-windows-iso: 2015/05/11 13:48:00 Executing shutdown command: a:\run_sysprep.bat
2015/05/11 13:48:00 packer-builder-vmware-windows-iso: 2015/05/11 13:48:00 starting remote command: a:\run_sysprep.bat
2015/05/11 13:48:33 packer-builder-vmware-windows-iso: 2015/05/11 13:48:33 Executing: /Applications/VMware Fusion.app/Contents/Library/vmrun [-T fusion list]
2015/05/11 13:48:33 packer-builder-vmware-windows-iso: 2015/05/11 13:48:33 stdout: Total running VMs: 1
2015/05/11 13:48:33 packer-builder-vmware-windows-iso: /Users/cda/windows-builds/output-vmware-windows-iso/packer-vmware-windows-iso.vmx
2015/05/11 13:48:33 packer-builder-vmware-windows-iso: 2015/05/11 13:48:33 stderr:
2015/05/11 13:48:33 ui: ==> vmware-windows-iso: Stopping virtual machine...
==> vmware-windows-iso: Stopping virtual machine...
2015/05/11 13:48:33 packer-builder-vmware-windows-iso: 2015/05/11 13:48:33 Executing: /Applications/VMware Fusion.app/Contents/Library/vmrun [-T fusion stop output-vmware-windows-iso/packer-vmware-windows-iso.vmx hard]
2015/05/11 13:48:35 packer-builder-vmware-windows-iso: 2015/05/11 13:48:35 stdout:
2015/05/11 13:48:35 packer-builder-vmware-windows-iso: 2015/05/11 13:48:35 stderr:
2015/05/11 13:48:35 packer-builder-vmware-windows-iso: 2015/05/11 13:48:35 Deleting floppy disk: /var/folders/61/snzd00312v76hn7yzjk_mmg00000kr/T/packer251798140
2015/05/11 13:48:35 ui: ==> vmware-windows-iso: Deleting output directory...
==> vmware-windows-iso: Deleting output directory...
2015/05/11 13:48:35 ui error: Build 'vmware-windows-iso' errored: Shutdown command has non-zero exit status.

Stdout: 
C:\Users\vagrant>c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown 


Stderr: 
2015/05/11 13:48:35 Builds completed. Waiting on interrupt barrier...
2015/05/11 13:48:35 machine readable: error-count []string{"1"}
2015/05/11 13:48:35 ui error: 
==> Some builds didn't complete successfully and had errors:
2015/05/11 13:48:35 machine readable: vmware-windows-iso,error []string{"Shutdown command has non-zero exit status.\n\nStdout: \r\nC:\\Users\\vagrant>c:\\windows\\system32\\sysprep\\sysprep.exe /oobe /generalize /shutdown \r\n\n\nStderr: "}
2015/05/11 13:48:35 ui error: --> vmware-windows-iso: Shutdown command has non-zero exit status.

Stdout: 
C:\Users\vagrant>c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown 


Stderr: 
2015/05/11 13:48:35 ui: 
==> Builds finished but no artifacts were created.
2015/05/11 13:48:35 waiting for all plugin processes to complete...
Build 'vmware-windows-iso' errored: Shutdown command has non-zero exit status.

Stdout: 
C:\Users\vagrant>c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown 


Stderr: 

==> Some builds didn't complete successfully and had errors:
--> vmware-windows-iso: Shutdown command has non-zero exit status.

Stdout: 
C:\Users\vagrant>c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown 


Stderr: 

==> Builds finished but no artifacts were created.
2015/05/11 13:48:35 /Users/cda/.packer.d/plugins/packer-provisioner-powershell: plugin process exited
2015/05/11 13:48:35 /Users/cda/.packer.d/plugins/packer-builder-vmware-windows-iso: plugin process exited

At first I thought this was related to a powershell provisioning step (since as far as I could tell the current prerelease only includes a change to the powershell timeout), but removing the step I still see the same issue. So currently, the template I'm testing has no provisioning steps.

Any ideas? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions