Open vicvi1997 opened 1 year ago
I can confirm the same behavior - I was trying to use Cloud Build to create an image based on ubuntu-2204. it has some simple scripts to add software, and it continually failed when trying to use IAP to SSH to the box. found this issue and adjusted to 2004-lts and it works fine
[1;31m==> googlecompute: 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 publickey], no supported methods remain[0m
In my case, the the problem is that the temporary script that sets the tunnel was being removed during the initial bootstrapping process of the tunnel. I was looking at the code and the gcloud-setup script contains the gcloud compute start-iap-tunnel
, I executed the following commands in my terminal:
watch 'ps aux | grep gcloud-setup'
watch 'ps aux | grep tunnel'
That's when I realized about the race condition, not sure if it's because of NewTunnelDriver.
After looking at the documentation, I realized that the option iap_tunnel_launch_wait increases the timeout in seconds before marking the tunnel creation as successful, setting it to 90 fixed the problem.
Hello,
We are running a Bash Script that runs Packer to build a GCE image using the
googlecompute
builder. It was running fine when the propertysource_image_family
was set tocentos-7
and later torocky-linux-8-optimized-gcp
, but when we changed it toubuntu-2204-lts
it stopped working. I'm attaching the details below:The Packer template is the following:
The following is the output of the
packer validate
+packer build
commands:The error seems to be related to the property
"use_iap": true,
. We need to use IAP in our use case so we cannot turn that property OFF. There might be a problem with the IAP functionality on Ubuntu images that is not present on RHEL-based ones.The issue should be easily reproduceable with the information provided, but let me know if more information is needed from my side.