-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packer stuck at: "Gracefully halting virtual machine" after Windows sysprep #4134
Comments
Sure, example gists were added to the initial post, here's log output: https://gist.github.com/kagarlickijd/672e2bd901c7860678f941390c5b01e0 Please be informed that errors like If you want, I can do the same for Parallels provider, but it's really the same with VMware |
Could you provide the templet for VirtualBox that works? |
@rickard-von-essen sure, here's repo with all necessary code - https://github.com/kagarlickijd/packer-demo Branch "win-sysprep" uses sysprep which works only with VirtualBox, but not with Parallels and VMware |
My Windows foo is extremely low but this is what I found so far.
I'll try and add some extra debugging of the WinRM comm. |
I've been experiencing much the same issue with my Windows builds. After alot of messing around and experimentation I've come to much the same conclusions as Rickard. I was wondering if the sysprep command is doing something with the WinRM firewall settings or with WinRM itself. This could cause the same apparent behaviour as when we leave in the command to disable the WinRM firewall rules and then run sysprep; We're just seeing the root issue manifest itself one step further down the line... I've not been able to look at the issue with the Parallels builder as I don't have Parallels. However, ui.Error(err.Error())
return multistep.ActionHalt
}
// Wait for the command to run so we can print std{err,out}
// We don't care if the command errored, since we'll notice
// if the vm didn't shut down.
// cmd.Wait()
// log.Printf("Shutdown stdout: %s", stdout.String())
// log.Printf("Shutdown stderr: %s", stderr.String())
// Wait for the machine to actually shut down
log.Printf("Waiting max %s for shutdown to complete", s.Timeout)
shutdownTimer := time.After(s.Timeout) In other words, not doing It would be really nice to get a fix in for the v1.0 release!! Many thanks for all your efforts! Dan Packer version: 0.11.1.dev @kagarlickijd I had to comment out the steps to restart the WinRM service in your enable-WinRM.ps1 script. The restart causes the build to fail for me as Packer has 'Connected to WinRM!' and is uploading the VMware Tools ISO when WinRM is restarted by your script. |
The strange thing is that it works for VirtualBox which have the same code as Parallels, where it doesn't work. |
Hello, I've only had this problem while trying to build Windows Server 2016 machines and using the Sysprep command as the I would think this indicates a problem with the new I hope this adds additional information that can help you guys diagnose the problem. |
Have a look at my insane shutdown approach. Don't forget to look at cmd file that calls powershell. It appears to work between different Windows versions. |
@mwhooker I noticed you have previously looked at getting rid of cmd.Wait() in #4041 here but then reintroduced it in the same PR on the next commit here. I've been running Packer with cmd.Wait() commented out for a while and haven't suffered any ill effects.
@taliesins I've managed to avoid this so far :). My thinking is as follows:
I'm also wondering if #4191 might be related in some way. Could we get a fix in for this for 0.12.2? Since I'm affected by this, my feeling is that this bug is deserving of a milestone tag!! ;) |
@rickard-von-essen Great! TY! |
👍 Works for me! VMware builder now completing sucessfully. |
I've spent so long working on this issue. I didn't want to custom-build Packer with cmd.wait() commented-out, so I had to find another solution. Here's what's working for me (in Hyper-V and a Server2016 guest): For my shutdown_command, use this: In the autounattend.xml file, it's VERY IMPORTANT that you use this:
Sysprep, by default, will remove all device drivers from the system. This completely breaks WinRM functionality when using Packer, and it doesn't allow the sysprep command to return. This setting alone fixed my problem after days/weeks(maybe months?) of troubleshooting. I hope that helps someone. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi there, my environment is:
Host platform - macOS 10.12.1
Packer version - 0.11.0 (the same with packer 0.10.2)
Vagrant version - 1.8.6
VMware Fusion Pro version - 8.5.1
VirtualBox version - 5.1.18
Parallels version - 12.0.2
vagrant plugin list
vagrant-aws (0.7.2)
vagrant-parallels (1.6.3)
vagrant-share (1.1.5, system)
vagrant-vmware-fusion (4.0.14)
Repo with all necessary code to reproduce bug - https://github.com/kagarlickijd/packer-demo
If I use
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1"
it works correctly for VirtualBox, VMware and Parallels.But I need to perform sysprep instead of just shutdown, so I use
shutdown-packer.bat
script inshutdown_command
section.It works correctly with VirtualBox, BUT both Parallels and VMware builders are stuck at "Gracefully halting virtual machine" step.
VM is powered down correctly with
shutdown-packer.bat
script, so it seems like Packer doesn't receive "messages" from Parallels and VMware.How can this one can be resolved?
Thanks in advance!
The text was updated successfully, but these errors were encountered: