Skip to content

Packer 1.8.2 and newer disregards ssh_host parameter (checked with qemu builder) #11961

@amaczuga

Description

@amaczuga

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

Version 1.8.2 and older is disregarding ssh_host variable, at least with qemu builder.

Reproduction Steps

Just try to force ssh_host value and watch it being disregarded.

Packer version

1.8.2, 1.8.3

Simplified Packer Template

{
  "builders": [
    {
      "name": "mybuild",
      "vm_name": "image.qcow2",
      "type": "qemu",
      "qemuargs": [
        [ "-cpu", "host,pmu=off" ],
        [ "-bios", "/usr/share/OVMF/OVMF_CODE.fd" ],
        [ "-device", "{{user `net_device`}},netdev=user.0" ],
        [ "-netdev", "bridge,id=user.0,br={{user `net_bridge`}}" ],
        [ "-serial", "stdio" ],
        [ "-no-reboot" ]
      ],
      "disk_image": "true",
      "disk_interface": "ide",
      "net_device": "{{user `net_device`}}",
      "disk_size": "150000",
      "cpus": "4",
      "memory": "4096",
      "boot_wait": "9s",
      "format": "qcow2",
      "headless": "true",
      "http_directory": ".",
      "iso_checksum": "none",
      "iso_url": "output-uefi/{{user `image_name`}}.qcow2",
      "ssh_username": "root",
      "ssh_password": "{{user `password`}}",
      "skip_nat_mapping": "true",
      "ssh_host": "192.168.133.2",
      "ssh_port": 22,
      "ssh_pty": true,
      "ssh_wait_timeout": "10000s",
      "vnc_bind_address": "0.0.0.0",
      "shutdown_command": "/sbin/halt"
    }
  ]
}

Operating system and Environment details

ubuntu:jammy amd64
packer_1.8.2_linux_amd64.zip
packer_1.8.3_linux_amd64.zip

Log Fragments and crash.log files

  1. packer 1.8.1
+ PACKER_LOG=1
+ packer build -parallel-builds=1 -only=mybuild template.json
2022/08/26 11:54:21 [INFO] Packer version: 1.8.1 [go1.17.8 linux amd64]
(...)
2022/08/26 11:54:37 packer-builder-qemu plugin: Using host value: 192.168.133.2
ESC[0;32m    postconfig-uefi: Not using a NetBridge -- skipping StepWaitGuestAddressESC[0m
ESC[1;32m==> postconfig-uefi: Using SSH communicator to connect: 192.168.133.2ESC[0m
2022/08/26 11:54:37 packer-builder-qemu plugin: [INFO] Waiting for SSH, up to timeout: 2h46m40s
2022/08/26 11:54:37 packer-builder-qemu plugin: Using host value: 192.168.133.2
ESC[1;32m==> postconfig-uefi: Waiting for SSH to become available...ESC[0m
2022/08/26 11:54:38 packer-builder-qemu plugin: Qemu stdout: <4>TCG2 protocol not available: 800000000000000e
2022/08/26 11:54:40 packer-builder-qemu plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.133.2:22: connect: no route to host
2022/08/26 11:54:45 packer-builder-qemu plugin: Using host value: 192.168.133.2
  1. packer 1.8.2
+ PACKER_LOG=1
+ packer build -parallel-builds=1 -only=mybuild template.json
2022/08/25 09:33:09 [INFO] Packer version: 1.8.2 [go1.17.11 linux amd64]
(...)
2022/08/25 09:33:23 packer-builder-qemu plugin: Using host value: 127.0.0.1
ESC[0;32m    postconfig-uefi: Not using a NetBridge -- skipping StepWaitGuestAddressESC[0m
ESC[1;32m==> postconfig-uefi: Using SSH communicator to connect: 127.0.0.1ESC[0m
2022/08/25 09:33:23 packer-builder-qemu plugin: [INFO] Waiting for SSH, up to timeout: 2h46m40s
2022/08/25 09:33:23 packer-builder-qemu plugin: Using host value: 127.0.0.1
ESC[1;32m==> postconfig-uefi: Waiting for SSH to become available...ESC[0m
2022/08/25 09:33:23 packer-builder-qemu plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:22: connect: connection refused
2022/08/25 09:33:24 packer-builder-qemu plugin: Qemu stdout: <4>TCG2 protocol not available: 800000000000000e
2022/08/25 09:33:28 packer-builder-qemu plugin: Using host value: 127.0.0.1

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