Packer: Packer unable to ssh to GCP Latest RHEL Images during bake process

Created on 5 Jun 2018  ยท  6Comments  ยท  Source: hashicorp/packer

Getting the below ssh error during the packer baking process.

Describe the problem and include the following information:

  • Packer version from packer version
    % packer --version
    1.2.3
    %

  • Host platform
    MAC/Linux

% packer build hana.json
googlecompute output will be in this color.

==> googlecompute: Checking image does not exist...
==> googlecompute: Creating temporary SSH key for instance...
==> googlecompute: Using image: rhel-7-v20180522
==> googlecompute: Creating instance...
googlecompute: Loading zone: us-west1-b
googlecompute: Loading machine type: n1-standard-4
googlecompute: Requesting instance creation...
googlecompute: Waiting for creation operation to complete...
googlecompute: Instance has been created!
==> googlecompute: Waiting for the instance to become running...
googlecompute: IP: 35.233.171.204
==> googlecompute: Waiting for SSH to become available...

==> googlecompute: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
==> googlecompute: Deleting instance...
googlecompute: Instance has been deleted!
==> googlecompute: Deleting disk...
googlecompute: Disk has been deleted!
Build 'googlecompute' errored: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

==> Some builds didn't complete successfully and had errors:
--> googlecompute: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

==> Builds finished but no artifacts were created.

Thanks,
Pradeep Kumar A

buildegoogle question

Most helpful comment

Just for anyone having a similar issue and finding this, we had the same ssh problem and realised it was due to having enable-oslogin metadata set to true as a project wide setting. In order to overcome this we had to 'override' this metadata on the packer instance by adding the following line into the builders section:

"metadata": { "enable-oslogin": "false" }

All 6 comments

Please supply the information requested in the issue template:

  • Packer version (packer version)
  • Host platform (uname -a etc.)
  • Debug log output from PACKER_LOG=1 packer build template.json.
    Please paste this in a gist.
  • The _simplest example template and scripts_ needed to reproduce the bug.
    Include these in your gist.

This works for me:

{
  "variables":
  {
    "gcp_project": ""
  },
  "builders": [
  {
    "type": "googlecompute",
    "project_id": "{{ user `gcp_project`}}",
    "image_name": "packer-rhel-{{timestamp}}",
    "machine_type": "f1-micro",
    "source_image": "rhel-7-v20180522",
    "zone": "europe-west1-b",
    "disk_size": "10",
    "ssh_username": "rhel"
  }],
  "provisioners": [{
    "type": "shell",
    "inline": [
      "echo Hi"
    ]
  }]
}

To ask questions or get help use _IRC #packer-tool on Freenode_ or the mailing list.

See https://www.packer.io/community/

Just for anyone having a similar issue and finding this, we had the same ssh problem and realised it was due to having enable-oslogin metadata set to true as a project wide setting. In order to overcome this we had to 'override' this metadata on the packer instance by adding the following line into the builders section:

"metadata": { "enable-oslogin": "false" }

we tried what @rosstimson mentioned and it worked for us.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings