pause_before_connecting does not pause before connecting #11878
Labels
enhancement
stage/thinking
Flagged for internal discussions about possible enhancements
sync to jira
For issues that need to be imported to Packer internal JIRA backlog
Community Note
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
I was deploying a simple template to build a VM on a VMware systems and ran into a problem with the build timing out before the VM was fully set up and running. When this occurs the SSH daemon isn't running yet so trying to connect to it too early cannot succeed. We expected to use the pause_before_connecting as a sleep period to wait until the SSH daemon was started and listening on its port. It never gets to the pause timer because it timed out trying to do its initial (and unneeded) connection.
This is really a duplicate of #7430 that was submitted a couple of years ago and the "solution" was to update the documentation to describe how the option actually behaves. I believe that if it works incorrectly to begin with, simply documenting that behavior is not a solution at all. The option states "pause BEFORE connecting", not Connect -> log off -> pause -> and then reconnect.
The way it currently functions makes the option completely useless. I cannot imagine any scenario where I would ever want to connect via SSH, wait, and then reconnect. If you're going to have an option called pause_before_connecting then please make it actually pause before connecting.
Reproduction Steps
Steps to reproduce this issue:
Produce on a system that takes longer than 3 minutes to download Ubuntu ISO and build the VM.
Packer version
Packer v1.8.2
Simplified Packer Template
Operating system and Environment details
Client: Ubuntu 20.04 workstation
VMware: vcenter 7.0.0
Log Fragments and crash.log files
==> vsphere-iso: File /home/myuser/.cache/packer/f56bff3df62a8576625321cf140b318c53705f7f.iso already uploaded; continuing
==> vsphere-iso: File [datastore1] packer_cache//f56bff3df62a8576625321cf140b318c53705f7f.iso already exists; skipping upload.
==> vsphere-iso: Creating VM...
==> vsphere-iso: Customizing hardware...
==> vsphere-iso: Mounting ISO images...
==> vsphere-iso: Adding configuration parameters...
==> vsphere-iso: Set boot order temporary...
==> vsphere-iso: Power on VM...
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
==> vsphere-iso: Waiting for IP...
==> vsphere-iso: IP address: 192.168.121.25
==> vsphere-iso: Using SSH communicator to connect: 192.168.121.25
==> vsphere-iso: Waiting for SSH to become available...
==> vsphere-iso: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
==> vsphere-iso: Clear boot order...
==> vsphere-iso: Power off VM...
==> vsphere-iso: Destroying VM...
Build 'vsphere-iso' errored after 2 minutes 57 seconds: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
Set the env var
PACKER_LOG=1
for maximum log detail.The text was updated successfully, but these errors were encountered: