hashicorp / packer-plugin-qemu

Packer plugin for QEMU Builder
https://www.packer.io/docs/builders/qemu
Mozilla Public License 2.0
61 stars 44 forks source link

Set boolean to keep or not efivars.fd #140

Closed Fabiosilvero closed 1 year ago

Fabiosilvero commented 1 year ago

Description

Hello ! I think that it would be nice to be able to choose to keep efivars.fd or not. The code seems to be here](https://github.com/hashicorp/packer-plugin-qemu/blob/f367d10c2f38d4581cd411d3cb1fcd39b2f1db11/builder/qemu/step_prepare_efivars.go#LL70C1-L79C2).

Use Case(s)

I want to build GCE image and use post-processor compress and googlecompute_import. I can achieve an upload to GCS, but the image is rejected by GCE because of the efivars.fd file that the post-processor compress added as part of the artificat to the .tar.gz archive, with the disk.raw image file.

In this case, removing the efivars.fd will permit to upload GCE image.

I use the version 1.0.8 and it works as intended.

Potential configuration

Maybe a boolean to remove the file :

source "qemu" "ubuntu" {
#[...]
  efi_boot = true
  efi_firmware_code = "/usr/share/OVMF/x64/OVMF_CODE.fd"
  efi_firmware_vars = "/usr/share/OVMF/x64/OVMF_VARS.fd"
  efi_keep_vars_file = false

Maybe I failed to see the feature documented somewhere, but to be fair, I searched for a while before opening this issue.

Thanks in advance !

lbajolet-hashicorp commented 1 year ago

Hi @Fabiosilvero,

Right now we don't have such an option defined, so the issue is valid indeed! I wonder however, since efivars.fd contains all the information for booting with UEFI, so I wonder how that'll work once booting up an instance from this image.

That being said, since this is a valid use-case, we can probably add this option to the EFI section, I'll get to work on that and open a PR ASAP.