Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

libvirt builds always use EFI, even on qemu_efi_boot=false #1641

Open
Open
libvirt builds always use EFI, even on qemu_efi_boot=false#1641
Labels
Status: UntriagedAn issue that has yet to be triaged.

Description

Version

git branch main (b576310), 5.0.0 (635483b)

Environment

Fedora Linux 42 Workstation. Packer is installed from hashicorps repo.
Packer v1.14.2

Scenario

running rockylinux build for qemu.vm

PACKER_LOG=1 bento build --only qemu.vm --vars qemu_efi_boot=false os_pkrvars/rockylinux/rockylinux-10-x86_64.pkrvars.hcl

Steps to Reproduce

PACKER_LOG=1 bento build --only qemu.vm --vars qemu_efi_boot=false os_pkrvars/rockylinux/rockylinux-10-x86_64.pkrvars.hcl

OR

PACKER_LOG=1 bento build --only qemu.vm os_pkrvars/rockylinux/rockylinux-10-x86_64.pkrvars.hcl

Expected Result

A box gets built.

Actual Result

Attempts to build and boot with EFI

On my system, where the EFI files aren't available, the box fails to build:

2025/10/29 02:36:54 packer-plugin-qemu_v1.1.4_x5.0_linux_amd64 plugin: 2025/10/29 02:36:54 Started Qemu. Pid: 265164
2025/10/29 02:36:54 packer-plugin-qemu_v1.1.4_x5.0_linux_amd64 plugin: 2025/10/29 02:36:54 Qemu stderr: qemu-system-x86_64: -drive file=/usr/local/share/qemu/edk2-x86_64-code.fd,if=pflash,uni t=0,format=raw,readonly=on: Could not open '/usr/local/share/qemu/edk2-x86_64-code.fd': No such file or directory

Additional notes

Looks like qemu_efi_firmware_code and qemu_efi_firmware_vars get set to /usr/local/share/... even if qemu_efi_boot is null or false.

I was able to get around this issue by changing the workflow setting the variables in pkr-sources.pkr.hcl:

diff --git a/packer_templates/pkr-sources.pkr.hcl b/packer_templates/pkr-sources.pkr.hcl
index e6356ab..e6375f1 100644
--- a/packer_templates/pkr-sources.pkr.hcl
+++ b/packer_templates/pkr-sources.pkr.hcl
@@ -68,14 +68,14 @@ locals {
qemu_efi_boot = var.qemu_efi_boot == null ? (
var.os_arch == "aarch64" ? true : false
) : var.qemu_efi_boot
- qemu_efi_firmware_code = var.qemu_efi_firmware_code == null ? (
+ qemu_efi_firmware_code = (var.qemu_efi_boot == null || var.qemu_efi_boot == false) ? null : (var.qemu_efi_firmware_code == null ? (
local.host_os == "Darwin" ? "/opt/homebrew/share/qemu/edk2-${var.os_arch}-code.fd" : "/usr/local/share/qemu/edk2-x86_64-code.fd"
- ) : var.qemu_efi_firmware_code
- qemu_efi_firmware_vars = var.qemu_efi_firmware_vars == null ? (
+ ) : var.qemu_efi_firmware_code)
+ qemu_efi_firmware_vars = (var.qemu_efi_boot == null || var.qemu_efi_boot == false) ? null : (var.qemu_efi_firmware_vars == null ? (
local.host_os == "Darwin" ? (
var.os_arch == "aarch64" ? "/opt/homebrew/share/qemu/edk2-arm-vars.fd" : "/usr/local/share/qemu/edk2-i386-vars.fd"
) : null
- ) : var.qemu_efi_firmware_vars
+ ) : var.qemu_efi_firmware_vars)
qemu_machine_type = var.qemu_machine_type == null ? (
var.os_arch == "aarch64" ? "virt" : "q35"
) : var.qemu_machine_type

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UntriagedAn issue that has yet to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions