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": [
                " 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": "http://cdimage.ubuntu.com/releases/19.04/release/ubuntu-19.04-server-amd64.iso",
            "iso_checksum_type": "sha256",
            "iso_checksum_url": "http://cdimage.ubuntu.com/releases/19.04/release/SHA256SUMS",
            "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"

1 Answer 1


It looks like I was bitten by a race condition. Building on Qemu 4 fixed it, and once I fixed my config file on macOS, I was able to get a build.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.