Hey all,
Just started learning Packer today, so feel free to point me at docs I may have missed.
I think I’m running into this issue: Packer 1.8.0: QEMU fails to remove CD-ROM installation image during reboot (worked fine with 1.7.10) · Issue #66 · hashicorp/packer-plugin-qemu · GitHub Or, at least, something similar.
Am I reading that issue correctly in that newer versions of qemu wouldn’t have that problem?
Basically, when I try to build my Ubuntu 20.04 server image, the console eventually gets stuck at the language selection screen. Prior to that screen I spot a “failed to unmounting /cdrom” message.
A little while after that it boots directly to the language selection screen.
I have tried using older versions of Packer and older versions of the qemu plugin. I tried with, and without, use_pflash
. When I tried using /usr/share/qemu/OVMF.fd
, I just ended up in grub instead of subquitity. Which mad the boot_command
fail.
Anyone have any other workarounds?
Debugging info:
System: PopOS 20.04
qemu: 4.2.1
Packer: 1.8.3
Logs here: packerqemu - Pastebin.com
My qemu-ubuntu2004.pkr.hcl:
packer {
required_plugins {
qemu = {
version = ">= 1.0.5"
source = "github.com/hashicorp/qemu"
}
}
}
source "qemu" "ubuntu2004" {
iso_url = "https://releases.ubuntu.com/20.04.5/ubuntu-20.04.5-live-server-amd64.iso"
iso_checksum = "sha256:5035be37a7e9abbdc09f0d257f3e33416c1a0fb322ba860d42d74aa75c3468d4"
output_directory = "images"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
memory = 2048
disk_size = "88064M"
format = "qcow2"
accelerator = "kvm"
http_directory = "http"
ssh_username = "root"
ssh_password = "password1234"
ssh_timeout = "30m"
vm_name = "ubuntu2004"
disk_interface = "virtio"
disk_compression = true
boot_wait = "2s"
use_pflash = true
boot_command = [
" <wait>",
" <wait>",
" <wait>",
" <wait>",
" <wait>",
"<esc><wait>",
"<f6><wait>",
"<esc><wait>",
"<bs><bs><bs><bs><wait>",
" autoinstall<wait>",
" ds=nocloud-net<wait>",
";s=http://<wait>{{.HTTPIP}}<wait>:{{.HTTPPort}}/<wait>",
" ---<wait>",
"<enter><wait2m>"
]
pause_before_connecting = "3m"
}
build {
name = "ubuntu2004"
sources = [
"source.qemu.ubuntu2004"
]
}
My http/user-data
:
#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu2004
password: `$6$rounds=4000$oe480h2nrouhr03n$5Ohz4fZcVnCN407JE.5oC0aWxG1ppdvXsV17wSNcZBEKwzKKrinz2vC1ji62OYOhUcXwNye6lEC9Ro69/Qovo.`
username: ubuntu