Packer qemu getting authentication error for rhel9

2022/11/14 12:16:15 packer-builder-qemu plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2022/11/14 12:16:22 packer-builder-qemu plugin: [INFO] Attempting SSH connection to 127.0.0.1:3706…
2022/11/14 12:16:22 packer-builder-qemu plugin: [DEBUG] reconnecting to TCP connection for SSH
2022/11/14 12:16:22 packer-builder-qemu plugin: [DEBUG] handshaking with SSH
2022/11/14 12:16:24 packer-builder-qemu plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain.

This is my packer config

 source "qemu" "redhat_9" {
  qemu_binary       = "/usr/libexec/qemu-system-x86_64"
  iso_url           = "/opt/rhel-baseos-9.0-x86_64-boot.iso"
  iso_checksum      = "f3ca9b53122212ed98866ef60e4895cc762493ced765e2961458944ba7c0ced3"
  output_directory  = "/media/test.raw"
  shutdown_command  = "echo 'packer' | sudo -S shutdown -P now"
  disk_size         = "60G"
  memory            = "2048"
  cpus              = "2"
  format            = "raw"
  disk_interface    = "virtio-scsi"
  accelerator       = "kvm"
  disk_cache        = "unsafe"
  headless          = true
  ssh_username      = "root"
  ssh_password      = "temp123"
  ssh_timeout       = "20m"
  vm_name           = "localhost"
  boot_wait         = "3s"
  display           = "none"
  vnc_port_min = "5901"
  vnc_port_max = "5901"
  qemuargs                = [
	[
	  "-cpu",
	  "host"
	]
  ]
  boot_command            = [
	   "<up><wait><tab><wait> text  ip=dhcp hostname=localhost inst.ks=<kickstart server>/test.ks net.ifnames=0  <enter>"
  ]
}

build {
  sources = [
	"qemu.redhat_9"
  ]
}

Sam

Looks like issue with ssh configuration. Fixed it and is working now

@midhuhk can you share the fix?