I tried this:
"builders": [
{
"accelerator": "kvm",
"boot_command": [
"<enter><enter><f6><esc><wait> ",
"autoinstall ds='nocloud-net;s=
http://127.0.0.1:3003/'",
"<wait><enter>"
],
"boot_wait": "10s",
"cpus": "1",
"disk_cache": "none",
"disk_compression": true,
"disk_interface": "ide",
"disk_size": "30G",
"format": "qcow2",
"headless": "true",
"http_directory": "./http",
"iso_checksum": "sha256:f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98",
"iso_urls": [
"/var/lib/libvirt/images/ubuntu-20.04.3-live-server-amd64.iso"
],
"memory": "1024",
"name": "ubuntu-packer1",
"net_device": "virtio-net",
"net_bridge": "virbr0",
"output_directory": "output/ubuntu",
"shutdown_command": "shutdown -P now",
"ssh_handshake_attempts": "20",
"ssh_password": "huuhaa",
"ssh_pty": "true",
"ssh_timeout": "20m",
"ssh_username": "ubuntu",
"type": "qemu",
"use_default_display": false
}
],
"provisioners": [
{
"inline": [
"ls /"
],
"type": "shell"
}
]
}
user-data:
#cloud-config
autoinstall:
version: 1
early-commands:
- sudo systemctl stop ssh
identity:
hostname: ubuntu-vm
password: "$6$Yvfsk9tx64XW.w77$4mq6vQDclsQiJMAEc.TwPguRRRntVWmINa9ubpZwJG4SpAJgNYgBaBjwIokSO3X3bkulCeZr2bqMfXeiOupL.1"
username: ubuntu
locale: en_US.UTF-8
keyboard:
layout: fi
user-data:
disable_root: false
timezone: Europe/Helsinki
late-commands:
- echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu
- sudo systemctl start ssh
2022/02/05 21:14:26 ui: ==> ubuntu-packer1: Waiting for SSH to become available...
2022/02/05 21:14:26 packer-builder-qemu plugin: [INFO] Attempting SSH connection to 192.168.122.78:22...
2022/02/05 21:14:26 packer-builder-qemu plugin: [DEBUG] reconnecting to TCP connection for SSH
2022/02/05 21:14:26 packer-builder-qemu plugin: [DEBUG] handshaking with SSH
2022/02/05 21:14:28 packer-builder-qemu plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2022/02/05 21:14:28 packer-builder-qemu plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.