Skip to content

Packer Google builder with Debian 10 started giving SSH authentication issue #8939

@ggprod

Description

@ggprod

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 had implemented a Packer build for GCE (Google compute engine) building a GCE custom image. This was working previously but has recently broken giving this error:

Build 'googlecompute' errored: 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

I see the packer VM that gets created and I see an SSH key is properly created by the SSH communicator and added to the VM (for the specified 'debian' user) but for some reason the SSH communicator can no longer authenticate to it using this generated SSH Key

Reproduction Steps

Steps to reproduce this issue:

I was using this Builders section in my packer json:
"builders": [
{
"type": "googlecompute",
"zone": "us-central1-a",
"project_id": "minimal-viable-product",
"source_image_family": "debian-10",
"ssh_username": "debian",
"image_family": "debian-10-gcloud-packer-terraform-helm-gitlab",
"image_name": "debian-10-gcloud-packer-terraform-helm-gitlab-{{timestamp}}",
"disable_default_service_account": true,
"subnetwork": "mvp-subnet",
"use_internal_ip": true
}
]

There does not appear to be any connectivity issue, simply an SSH authentication issue (and it was working before and just broke recently)

Packer version

1.5.4
From packer version

Simplified Packer Buildfile

"builders": [
{
"type": "googlecompute",
"zone": "us-central1-a",
"project_id": "minimal-viable-product",
"source_image_family": "debian-10",
"ssh_username": "debian",
"image_family": "debian-10-gcloud-packer-terraform-helm-gitlab",
"image_name": "debian-10-gcloud-packer-terraform-helm-gitlab-{{timestamp}}",
"disable_default_service_account": true,
"subnetwork": "mvp-subnet",
"use_internal_ip": true
}
]

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.

Operating system and Environment details

Debian-10
OS, Architecture, and any other information you can provide about the
environment.

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the gist of the log or
use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions