Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-boot is not removed from QEMU args when efi_boot is false #184

Open
carlosonunez opened this issue Nov 17, 2024 · 1 comment
Open

-boot is not removed from QEMU args when efi_boot is false #184

carlosonunez opened this issue Nov 17, 2024 · 1 comment

Comments

@carlosonunez
Copy link

carlosonunez commented Nov 17, 2024

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

I'm using Packer on an M3 Pro MacBook Pro running macOS 14.3. The OVMF UEFI that ships with the qemu Homebrew package does not support the -boot flag; consequently, I provided my own qemuargs to work around this.

It seems that I cannot stop the qemu plugin from adding -boot once=d to my qemu args, even when I explicitly set efi_mode=false per the code I saw here and here.

Reproduction Steps

  1. Save the code below to test.hcl
packer {
  required_plugins {
    qemu = {
      version = "1.1.0"
      source = "github.com/hashicorp/qemu"
    }
    vagrant = {
      source = "github.com/hashicorp/vagrant"
      version = "~> 1"
    }
  }
}

source "qemu" "machine" {
  qemu_binary = "qemu-system-aarch64"
  vm_name = "test"
  iso_url = "https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/aarch64/alpine-standard-3.20.3-aarch64.iso"
  iso_checksum = "7d6f065d18af54c3686dceae51235661"
  output_directory = "out"
  shutdown_command = "halt -d 0"
  disk_size = "5G"
  cpus = 4
  sockets = 1
  cores = 4
  threads = 1
  format = "qcow2"
  accelerator = "hvf"
  use_default_display = true
  headless = true
  machine_type = "virt"
  boot_wait = "60s"
  ssh_username = "root"
  ssh_password = "alpine123!"
  efi_boot = false
  boot_command = [
    "root<enter><wait>",
    "passwd root<enter>",
    "alpine123!<enter>",
    "alpine123!<enter>"
  ]
  qemuargs = [
    [ "-bios", "/opt/homebrew/share/qemu/edk2-aarch64-code.fd" ],
    [ "-device", "virtio-gpu" ],
    [ "-device", "virtio-scsi-pci,id=scsi-bus" ],
  ]
}

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

Plugin and Packer version

From packer version

$: packer version
Packer v1.9.4

Your version of Packer is out of date! The latest version
is 1.11.2. You can update by downloading from www.packer.io/downloads

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.

See above.

Operating system and Environment details

macOS 14.3 (Sonoma).

Log Fragments and crash.log files

@lbajolet-hashicorp
Copy link
Contributor

Hey @carlosonunez,

Sorry I only look at your issue today, missed it beforehand.

From the code you linked, I think there's a misunderstanding, the -boot option is only set when you are NOT in UEFI mode, so in your case that is actually expected that -boot once=d is set (or boot c if using a disk image as the base instead of an ISO).

If you want to boot using EDK/OVMF, you need to set uefi_boot = true in your configs, which then will not add -boot to the command-line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants