Packer and Qemu – Qemu hangs during SIGKILL – reboot requested

I’m attempting to build an Ubuntu 19.04 server image with packer. I have it booting and running the install seemingly fine, and after an hour and change, Qemu shows that the install is finished and a SIGINT and sometimes SIGKILL were sent, and a reboot requested, but eventually packer times out because Qemu never reboots the OS to let packer SSH in and finish its thing. I’ve tried a few things to get Qemu to output something about why it is failing to reboot:

-serial stdio

-serial mon:stdio

-serial telnet:,server,nowait

All to no avail. I get no feedback from Qemu about anything. I’ve also tried finding good examples to configure tracing and -append console=ttyS0 with a kernel. I’m a Qemu and Packer nub, so forgive me if I’m missing something obvious. I’ve done a lot of searching around trying to find ways to debug qemu to figure out why it’s hanging on reboot.

Ubuntu 19.04 Desktop build:

Packer: 1.4.1

Qemu: 3.1.0 (apt install)

macOS 10.14.5 build environment:

Packer: 1.4.0

Qemu: 4.0.0 (brew install)

In both environments, qemu seems to hang on the reboot part. I say seems, because while I do have -display gtk on the Ubuntu desktop and see where it hangs, there’s a bug(?) and -display sdl is broken on Mac, and gtk doesn’t work. I also tried curses on Mac, but that doesn’t work either. So as best as I can tell, both break in the same spot. I can provide my preseed.cfg if needed.

Here’s my ubuntu.json:

{     "builders": [         {             "type": "qemu",             "boot_command": [                 "<enter><wait2><esc><wait2><enter>",                 "<wait>",                 "/install/vmlinuz",                 " initrd=/install/initrd.gz quiet",                 " vga=788",                 " auto=true",                 " priority=critical",                 " reboot=pci",                 " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",                 " --- <enter>"             ],             "qemuargs": [                 ["-display", "gtk"],                 ["-serial", "stdio"]             ],             "boot_wait": "5s",             "disk_size": 20000,             "headless": false,             "http_directory": "http",             "iso_url": "",             "iso_checksum_type": "sha256",             "iso_checksum_url": "",             "communicator": "ssh",             "ssh_username": "ubuntu",             "ssh_password": "ubuntu",             "ssh_port": 22,             "ssh_wait_timeout": "120m",             "shutdown_command": "echo 'ubuntu' | sudo shutdown -P now",             "vm_name": "ubuntu-19.04-amd64.qcow2"         }     ] }