Skip to content

packer unable to ssh to Google Computes latest CentOS image #8924

@desolatorxxl

Description

@desolatorxxl

Overview of the Issue

Getting the below ssh error during the packer build process, similiar to #6341.

Reproduction Steps

packer build --force build.json

Packer version

# packer version               
Packer v1.5.4

Simplified Packer Buildfile

{
  "builders": [
    {
      "image_name": "test_image_centos8",
      "type": "googlecompute",
      "account_file": "account.json",
      "project_id": "my-project",
      "source_image": "centos-8-v20200316",
      "metadata": { "enable-oslogin": "false" },
      "ssh_username": "packer",
      "ssh_timeout": "10m",
      "ssh_handshake_attempts": 20,
      "zone": "europe-west1-b"
    }
  ],
  "provisioners": [
      {
          "type": "shell",
          "inline": [ "sudo touch /boo" ]
      }
  ]
}

Operating system and Environment details

Arch Linux 5.5.2-arch1-1

Log Fragments and crash.log files

==> googlecompute: Checking image does not exist...                                                                                                                                            
==> googlecompute: Creating temporary SSH key for instance...                                                                                                                                  
==> googlecompute: Using image: centos-8-v20200316                                                                                                                                             
==> googlecompute: Creating instance...                                                                                                                                                        
    googlecompute: Loading zone: europe-west1-b                                                                                                                                                
    googlecompute: Loading machine type: n1-standard-1                                                                                                                                         
    googlecompute: Requesting instance creation...                                                                                                                                             
    googlecompute: Waiting for creation operation to complete...                                                                                                                               
2020/03/20 12:03:00 packer-builder-googlecompute plugin: Retryable error: retrying for state DONE, got RUNNING                                                                                 
2020/03/20 12:03:03 packer-builder-googlecompute plugin: Retryable error: retrying for state DONE, got RUNNING                                                                                 
    googlecompute: Instance has been created!                                                                                                                                                  
==> googlecompute: Waiting for the instance to become running...                                                                                                                               
    googlecompute: IP: 35.233.34.84                                                                                                                                                            
2020/03/20 12:03:05 packer-builder-googlecompute plugin: [INFO] Waiting for SSH, up to timeout: 10m0s                                                                                          
==> googlecompute: Using ssh communicator to connect: 35.233.34.84                                                                                                                             
==> googlecompute: Waiting for SSH to become available...                                                                                                                                      
2020/03/20 12:03:20 packer-builder-googlecompute plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 35.233.34.84:22: i/o timeout                                                   
2020/03/20 12:03:25 packer-builder-googlecompute plugin: [INFO] Attempting SSH connection to 35.233.34.84:22...                                                                                
2020/03/20 12:03:25 packer-builder-googlecompute plugin: [DEBUG] reconnecting to TCP connection for SSH                                                                                        
2020/03/20 12:03:25 packer-builder-googlecompute plugin: [DEBUG] handshaking with SSH                                                                                                          
2020/03/20 12:03:26 packer-builder-googlecompute plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported method
s remain                                                                                                                                                                                       
2020/03/20 12:03:26 packer-builder-googlecompute plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2020/03/20 12:03:33 packer-builder-googlecompute plugin: [INFO] Attempting SSH connection to 35.233.34.84:22...
2020/03/20 12:03:33 packer-builder-googlecompute plugin: [DEBUG] reconnecting to TCP connection for SSH
2020/03/20 12:03:33 packer-builder-googlecompute plugin: [DEBUG] handshaking with SSH
2020/03/20 12:03:33 packer-builder-googlecompute plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported method
s remain
2020/03/20 12:03:33 packer-builder-googlecompute plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2020/03/20 12:03:40 packer-builder-googlecompute plugin: [INFO] Attempting SSH connection to 35.233.34.84:22...
2020/03/20 12:03:40 packer-builder-googlecompute plugin: [DEBUG] reconnecting to TCP connection for SSH
2020/03/20 12:03:40 packer-builder-googlecompute plugin: [DEBUG] handshaking with SSH
2020/03/20 12:03:40 packer-builder-googlecompute plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported method
s remain
2020/03/20 12:03:40 packer-builder-googlecompute plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2020/03/20 12:03:47 packer-builder-googlecompute plugin: [INFO] Attempting SSH connection to 35.233.34.84:22...
2020/03/20 12:03:47 packer-builder-googlecompute plugin: [DEBUG] reconnecting to TCP connection for SSH
2020/03/20 12:03:47 packer-builder-googlecompute plugin: [DEBUG] handshaking with SSH
2020/03/20 12:03:47 packer-builder-googlecompute plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported method
s remain
...
2020/03/20 12:04:32 packer-builder-googlecompute plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
==> 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 doubl
e-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
==> googlecompute: Deleting instance...
...

Please note that SSH into a VM instance created with the same image manually works just fine.
Also using the second latest image centos-8-v20200309 with packer works fine aswell.

Any guidance would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions