packer-plugin-qemu icon indicating copy to clipboard operation
packer-plugin-qemu copied to clipboard

sata disk_interface is unable to build

Open nick123pig opened this issue 2 years ago • 4 comments

Overview of the Issue

When building an image, the disk_interface doesn't seem to be able to build with sata (there's an "unsupported bus type" error from underlying qemu).

In #54, support for sata as a disk_interface option was added, but I have been unable to get it to work. I am able to use sata from virt-install or virt-manager.

Reproduction Steps

packer build with the packer buildfile specified in the example

Plugin and Packer version

$ packer version
Packer v1.9.1
$ packer plugins required example.pkr.hcl 
qemu github.com/hashicorp/qemu ">= 1.0.9" ....../packer-plugin-qemu_v1.0.9_x5.0_linux_amd64

Simplified Packer Buildfile

source "qemu" "example" {
  iso_url           = "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso" 
  iso_checksum      = "513dfc3c0c516b803095cd829df72cea956757316247584f0f2ddde7e5b0262f" 
  shutdown_command  = "echo 'packer' | sudo -S shutdown -P now"
  disk_size         = "5000M"
  format            = "qcow2"
  accelerator       = "kvm"
  ssh_username      = "root"
  ssh_password      = "root"
  ssh_timeout       = "20m"
  disk_interface    = "sata"
}

build {
  sources = ["source.qemu.example"]
}

Operating system and Environment details

I've tried this on both Fedora 37 and Ubuntu 22.04 with the standard libvirt/qemu/kvm packages installed.

Log Fragments and crash.log files

==> qemu.example: Starting VM, booting from CD-ROM
2023/06/27 16:44:42 packer-plugin-qemu_v1.0.9_x5.0_linux_amd64 plugin: 2023/06/27 16:44:42 Qemu Builder has no floppy files, not attaching a floppy.
2023/06/27 16:44:42 packer-plugin-qemu_v1.0.9_x5.0_linux_amd64 plugin: 2023/06/27 16:44:42 Executing /bin/qemu-system-x86_64: []string{"-drive", "file=output-example/tdhtest,if=sata,cache=writeback,discard=ignore,format=qcow2", "-drive", "file=/home/n/.cache/packer/4af7c4fabb48017f58facd0b86ad6c9f9befbec0.iso,media=cdrom", "-m", "512M", "-device", "virtio-net,netdev=user.0", "-vnc", "127.0.0.1:90", "-smp", "1", "-display", "gtk", "-boot", "once=d", "-name", "tdhtest", "-machine", "type=pc,accel=kvm", "-netdev", "user,id=user.0,hostfwd=tcp::3063-:22"}
2023/06/27 16:44:42 packer-plugin-qemu_v1.0.9_x5.0_linux_amd64 plugin: 2023/06/27 16:44:42 Started Qemu. Pid: 979602
2023/06/27 16:44:42 packer-plugin-qemu_v1.0.9_x5.0_linux_amd64 plugin: 2023/06/27 16:44:42 Qemu stderr: qemu-system-x86_64: -drive file=output-example/tdhtest,if=sata,cache=writeback,discard=ignore,format=qcow2: unsupported bus type 'sata'
==> qemu.example: Error launching VM: Qemu failed to start. Please run with PACKER_LOG=1 to get more info.

nick123pig avatar Jun 27 '23 20:06 nick123pig

Hi,

Yes, that happens to me too: I've tried this plugin: v1.0.9, along with all the minor releases from QEMU 8.0.x

chris-david-taylor avatar Jul 21 '23 09:07 chris-david-taylor

Hi @nick123pig , did you get anywhere with this? I'm happy to take a look at the code next week or something, but a follow up to this issue might be nice. @mitchellh ?

chris-david-taylor avatar Jul 24 '23 10:07 chris-david-taylor

I ended up changing to scsi, as that seems like the more supported disk interface across the entire libvirt landscape.

nick123pig avatar Aug 14 '23 21:08 nick123pig

Hi, I originaly opened the issue back in 2016 regard SATA support: https://github.com/hashicorp/packer/issues/3983

I need the SATA interface today in order to build and boot a Windows 11 image, and I confirm it doesn't work out of the box:

qemu-system-x86_64: -drive file=output-windows/win11.qcow2,if=sata,cache=writeback,discard=ignore,format=qcow2: unsupported bus type 'sata'

Is it possible to play with the qemu_args to make it work in the meantime ?

Wenzel avatar Sep 25 '24 20:09 Wenzel