Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SSH connection fails with ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain while using custom ssh-key #156

Open
rilla0308 opened this issue Apr 19, 2023 · 3 comments
Labels

Comments

@rilla0308
Copy link

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 am using google compute plugin version 1.1.0
and packer version 1.7.2
I am hitting the error
Build 'googlecompute' errored after 1 minute 58 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 publickey], no supported methods remain

Reproduction Steps

I am using google compute plugin version 1.1.0
and packer version 1.7.2

Steps to reproduce this issue

Plugin and Packer version

I am using google compute plugin version 1.1.0
and packer version 1.7.2

Simplified Packer Buildfile

{
"builders": [
{
"type": "googlecompute",
"project_id": "core-autobuilds-production",
"account_file": "/home/build/packer-workspace/adc.json",
"source_image": "rhel-20230119-03-secure",
"disk_size": "310",
"subnetwork": "prod-pod-gcp-1",
"omit_external_ip": "true",
"ssh_username": "cloud-user",
"ssh_private_key_file": "/home/build/.ssh/gcp-rhel9",
"ssh_keypair_name": "gcp-rhel9",
"temporary_key_pair_type": "ed25519",
"use_internal_ip": "true",
"state_timeout": "60m",
"disable_default_service_account": "true",
"metadata": { "ssh-keys": "cloud-user: ******** cloud-user"},
"zone": "us-central1-a"
}
],
"provisioners": [
{
"type": "shell",
"inline": ["echo Welcome to RHEL9"]
}
]
}

Operating system and Environment details

Centos7

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines,
https://gist.github.com/rilla0308/53bacba7e3983dc7b47758117cfc069b

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

@rilla0308 rilla0308 added the bug label Apr 19, 2023
@rilla0308
Copy link
Author

I have been stuck with this issue for two days - crazy part is i am able to ssh to the vm with same ssh key from the same host to the vm which Packer is creating

@rilla0308
Copy link
Author

The issue is with packer version 1.7.2 when i upgraded to packer version 1.8.4 ssh connection was successful

@VakarisZ
Copy link

For me it was root username on debian image that caused this problem

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants