Removing c:\windows\temp before sysprep?

370 views
Skip to first unread message

goffries

unread,
Feb 26, 2019, 12:38:31 PM2/26/19
to Packer
I'm running a script right before i sysprep that removed c:\windows\temp. I'm just wondering if this could potentially mess packer up in some way? I occasionally will see this crash. Or this error.

 Error processing command: Error generating elevated runner: Error preparing elevated powershell script: Error restoring file from $env:TEMP\winrmcp-a3199f9a-79a6-4b0e-612b-7f279e1d31dd.tmp to C:\Windows\Temp\packer-elevated-shell-5c748275-21d1-f725-68ba-0dce7a1ad627.ps1: unknown error Post https://<ipaddress>:5986/wsman: read tcp 10.5.0.22:64620-><ipaddress>:5986: wsarecv: An existing connection was forcibly closed by the remote host.

panic: runtime error: invalid memory address or nil pointer dereference
2019/02/25 23:41:27 packer.exe: [signal 0xc0000005 code=0x0 addr=0x10 pc=0x6735ad]
2019/02/25 23:41:27 packer.exe: 
2019/02/25 23:41:27 packer.exe: goroutine 751 [running]:
2019/02/25 23:41:27 packer.exe: net/http.redirectBehavior(0x2820744, 0x4, 0x0, 0xc0000f5100, 0x0, 0x0, 0x0)
2019/02/25 23:41:27 packer.exe: /usr/local/Cellar/go/1.11.4/libexec/src/net/http/client.go:422 +0x2d
2019/02/25 23:41:27 packer.exe: net/http.(*Client).do(0xc0003e6ba0, 0xc0000f5100, 0x0, 0x0, 0x0)
2019/02/25 23:41:27 packer.exe: /usr/local/Cellar/go/1.11.4/libexec/src/net/http/client.go:655 +0x327
2019/02/25 23:41:27 packer.exe: net/http.(*Client).Do(0xc0003e6ba0, 0xc0000f5100, 0x6, 0xc0004282c0, 0x20)
2019/02/25 23:41:27 packer.exe: /usr/local/Cellar/go/1.11.4/libexec/src/net/http/client.go:509 +0x3c
2019/02/25 23:41:27 packer.exe: github.com/hashicorp/packer/vendor/github.com/masterzen/winrm.clientRequest.Post(0x2b18120, 0xc000709800, 0xc0003ca080, 0xc000250f80, 0x0, 0x0, 0x0, 0x0)
2019/02/25 23:41:27 packer.exe: /Users/azr/go/src/github.com/hashicorp/packer/vendor/github.com/masterzen/winrm/http.go:82 +0x2c9
2019/02/25 23:41:27 packer.exe: github.com/hashicorp/packer/vendor/github.com/masterzen/winrm.ClientNTLM.Post(0x2b18120, 0xc000709800, 0xc0003ca080, 0xc000250f80, 0xc000250f80, 0xc000a265a0, 0x28
2019/02/25 23:41:27 packer.exe: /Users/azr/go/src/github.com/hashicorp/packer/vendor/github.com/masterzen/winrm/ntlm.go:22 +0x50
2019/02/25 23:41:27 packer.exe: github.com/hashicorp/packer/vendor/github.com/masterzen/winrm.(*Client).sendRequest(0xc0003ca080, 0xc000250f80, 0xc000250f80, 0xc000250f80, 0x987049, 0x150000)
2019/02/25 23:41:27 packer.exe: /Users/azr/go/src/github.com/hashicorp/packer/vendor/github.com/masterzen/winrm/client.go:102 +0x4a
2019/02/25 23:41:27 packer.exe: /Users/azr/go/src/github.com/hashicorp/packer/vendor/github.com/masterzen/winrm/client.go:81 +0xa0
2019/02/25 23:41:27 packer.exe: github.com/hashicorp/packer/communicator/winrm.(*Communicator).Start(0xc0001416e0, 0xc000065c80, 0xc000610000, 0x2b186a0)
2019/02/25 23:41:27 packer.exe: /Users/azr/go/src/github.com/hashicorp/packer/communicator/winrm/communicator.go:78 +0x3a
2019/02/25 23:41:27 packer.exe: github.com/hashicorp/packer/packer/rpc.(*CommunicatorServer).Start(0xc0006c4460, 0xc0006d0620, 0xc0002f82f0, 0x0, 0x0)
2019/02/25 23:41:27 packer.exe: /Users/azr/go/src/github.com/hashicorp/packer/packer/rpc/communicator.go:263 +0x1f9
2019/02/25 23:41:27 packer.exe: reflect.Value.call(0xc000064b40, 0xc000006c78, 0x13, 0x282059c, 0x4, 0xc0003f9f18, 0x3, 0x3, 0xc00016e9c0, 0x28e4d78, ...)
2019/02/25 23:41:27 packer.exe: /usr/local/Cellar/go/1.11.4/libexec/src/reflect/value.go:447 +0x45b
2019/02/25 23:41:27 packer.exe: reflect.Value.Call(0xc000064b40, 0xc000006c78, 0x13, 0xc0003f9f18, 0x3, 0x3, 0xc00028c200, 0xc0003f9f20, 0x97f8ec)
2019/02/25 23:41:27 packer.exe: /usr/local/Cellar/go/1.11.4/libexec/src/reflect/value.go:308 +0xab
2019/02/25 23:41:27 packer.exe: net/rpc.(*service).call(0xc00023c5c0, 0xc000235270, 0xc000306750, 0xc000306760, 0xc0000f3580, 0xc000251b40, 0x1fcc380, 0xc0006d0620, 0x16, 0x20327c0, ...)
2019/02/25 23:41:27 packer.exe: /usr/local/Cellar/go/1.11.4/libexec/src/net/rpc/server.go:384 +0x155
2019/02/25 23:41:27 packer.exe: created by net/rpc.(*Server).ServeCodec
2019/02/25 23:41:27 packer.exe: /usr/local/Cellar/go/1.11.4/libexec/src/net/rpc/server.go:481 +0x485
2019/02/25 23:41:27 [INFO] 0 bytes written for 'stdout'
2019/02/25 23:41:27 [INFO] 0 bytes written for 'stderr'
2019/02/25 23:41:27 [ERR] Error decoding response stream 40: EOF
2019/02/25 23:41:27 [ERR] Error decoding response stream 15: EOF
2019/02/25 23:41:27 [ERR] Error decoding response stream 37: EOF
2019/02/25 23:41:27 [INFO] (telemetry) ending azure-arm
2019/02/25 23:41:27 ui error: 2019-02-25T23:41:27Z: Build 'azure-arm' errored: unexpected EOF
2019/02/25 23:41:27 Builds completed. Waiting on interrupt barrier...
2019/02/25 23:41:27 machine readable: error-count []string{"1"}
2019/02/25 23:41:27 ui error: 
==> Some builds didn't complete successfully and had errors:
2019/02/25 23:41:27 machine readable: azure-arm,error []string{"unexpected EOF"}
2019/02/25 23:41:27 ui error: --> azure-arm: unexpected EOF

Megan Marsh

unread,
Feb 26, 2019, 12:40:59 PM2/26/19
to packe...@googlegroups.com
I'm pretty sure we expect $TEMP to be there, yes. We upload our powershell files to it. If you delete that folder, you can _probably_ work around this by updating the value of $TEMP so that Packer has somewhere to upload files to.

goffries

unread,
Feb 26, 2019, 2:49:33 PM2/26/19
to Packer
My primary concern is files being left over with secrets left behind. Is there a way to safely guarantee everything gets cleaned up properly?

Megan Marsh

unread,
Feb 26, 2019, 2:50:56 PM2/26/19
to packe...@googlegroups.com
You could have a provisioner delete the temp folder as the last step in the build process.

--
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 packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/8b8441f7-cc69-46b3-8ffa-a3ba8fabd77b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

goffries

unread,
Feb 26, 2019, 4:31:13 PM2/26/19
to Packer
As in after the sysprep step, Or right before?

Megan Marsh

unread,
Feb 26, 2019, 4:57:42 PM2/26/19
to packe...@googlegroups.com
Neither; I assume after sysprep you're using Packer's provisioners?  At the very end of your provisioning section, add a powershell provisioner to delete the folder; that way it's there while the machine is being provisioned but any sensitive information generated during the provisioning will be gone before the vm is saved into a golden image.

Reply all
Reply to author
Forward
0 new messages