-
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 hangs while running shell provisioners #11407
Comments
I'm seeing a similar possibly related issue. A shell provisioner will fail, but instead of aborting the build, packer will hang, even past the configured timeout. I've seen variations on this issue with other scripts, box configs, where a build pipeline will hang indefinitely.
The provisioner has a timeout of 120m, and if you look at the log, you'll see that at ~120m it says "Cancelling provisioner after a timeout..." but instead of aborting the box build, or trying the next step, packer hangs until I come along several days later and abort it manually using Control-C. This is with packer 1.6.6 and VirtualBox 5.2.44. At one point packer had issues with VirtualBox 5.2, and trying to use an invalid command line option. I don't know if that's been fixed, but if so I can try updating to a newer packer version. The box/config which triggered this issue this time was the If you want to try running it, clone the robox repo and run: I've seen this issue pop up for awhile now, but it seems to occur rather inconsistently, so it's been hard to pickup on any pattern. |
I might have a fix for this. Testing it now, but since the hangs are intermittent, it might be awhile before I'm confident of the cause/workaround. Not posting this update to tease anyone, but to keep the nasty hashicorp robots from closing this issue prematurely. |
So far my fix has worked. It turns out that whenever the host renewed its DHCP lease, it was triggering a dispatch event, even when the renewal doesn't result in the host IP changing. But regardless of the outcome, the renewal event was causing packer to lose track of the guest IP address. I don't recall at this point if the guest IP was changing, or VirtualBox simply lost track, but either way, disabling the following dispatchers seems to have fixed the issue. Please note, on my CentOS 7 server, which does not have a graphical desktop, there is nothing important being triggered by the dispatch event, so it was safe to run the following commands. Your environment may be different.
|
I'm having hanging issues with a shell provisioner as well. Mine hangs after "starting remote command" about 25% of the time.
|
I can't offer any insight on the vsphere plugin/provisioners. But @aj-cruz you might want to manually test/check whether the guest IP is changing. Quite simply you can find the connecting IP in the Packer log (you might need to enable a debug level of output). You can then connect yourself from the host while packer is running and see if your connection gets dropped, and/or test whether you can still manually connect after the packer connection is dropped. use the But as I mentioned above, I haven't had poroblems with provisioners hanging since I disabled those dispatchers. Of course that was on CentOS 7 build robots. Different distros and releases are likely to have different dispatchers which can trigger the underlying issue, which is tricking the system into thinking it needs to give the guest a new DHCP IP, and Packer not being smart enough to use the platform API to find the current IP and see if it's changed before exploding. In theory it should be able to find a new guest IP using the same process it uses to find it in the first place, which varies by platform. |
We are experiencing the same hangup with the Ansible provisioner. Packer output from a Jenkins job:
I manually deleted the cloud server at 22:39:20 for testing. Packer should terminate the Ansible provisioner around 23:08 (20 minutes provisioner timeout). At 23:38 the Jenkins pipeline timeout (60 minutes) killed the packer process. pstree output:
Provisioner from the HCL file:
|
Hi
Packer is hanging while i'm running shell provisioners.
The hanging build is happening to me on two different qemu builds and on two different scripts. one thing in common for both of those scripts is that they produce a lot of output to stdout which might be the case (based on this former closed issue #4627)
those same scripts are running also on amazon-ebs builds where this issue haven't reproduced, it only occurs on qemu builds.
couldn't find anything in the log file and it all seems fine except that the script never exits
i also tried two different packer versions, 1.7.8 and 1.5.5 and it occurred on both
@SwampDragons - i saw that you commented on the issue i mentioned above
Thnx
The text was updated successfully, but these errors were encountered: