I'm trying to build a Windows AMI with packer.io.
In the powershell file I have run the following command as the last command of the provisioning step:
Write-Host "Running the EC2Config.exe file to sysprep the image for UserData to run on next boot."
cmd.exe /c "C:\Program Files\Amazon\Ec2ConfigService\ec2config.exe" -sysprep
In my packer output, I see the following text:
amazon-ebs: Running the EC2Config.exe file to sysprep the image for UserData to run on next boot.
amazon-ebs: Running in foreground...
amazon-ebs: SysprepUtils: Setting bundle/Sysprep operations for Vista/2008.
amazon-ebs: SysprepUtils: Reading Bundle Properties from C:\Program Files\Amazon\Ec2ConfigService\Settings\BundleConfig.xml
amazon-ebs: SysprepUtils: Processing property: AutoSysprep
amazon-ebs: SysprepUtils: Processing property: SetRDPCertificate
amazon-ebs: SysprepUtils: Changing plugin Ec2ConfigureRDP state to Disabled
amazon-ebs: SysprepUtils: Changing plugin Ec2OutputRDPCert state to Enabled
amazon-ebs: SysprepUtils: Processing property: SetPasswordAfterSysprep
amazon-ebs: SysprepUtils: Changing plugin Ec2SetPassword state to Enabled
amazon-ebs: SysprepUtils: Changing plugin Ec2WindowsActivate state to Enabled
amazon-ebs: SysprepUtils: Changing plugin Ec2HandleUserData state to Enabled
amazon-ebs: SysprepUtils: Changing plugin Ec2DynamicBootVolumeSize state to Enabled
amazon-ebs: SysprepUtils: Sysprep command: 'C:\windows\system32\sysprep\sysprep.exe'
amazon-ebs: SysprepUtils: Sysprep args: '"/unattend:C:\Program Files\Amazon\Ec2ConfigService\sysprep2008.xml" /oobe /shutdown /generalize'
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: No AMIs to cleanup
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]
So...
It's running successfully, and then running sysprep, but sysprep is causing packer to see that it isn't ran successfully. I've tried running packer with -force
, but, that doesn't seem to allow me to build the images successfully.
I'm kind of at a loss here -- I'm not sure if the easiest way is for me to try to force packer to see that an image is being built, or, to try to add another step at the end of my powershell script for packer to try to force that result to have a good error code and move forward.