hashicorp / packer-plugin-virtualbox

Packer plugin for VritualBox Builder
https://www.packer.io/docs/builders/virtualbox
Mozilla Public License 2.0
22 stars 36 forks source link

Switching to `--audio-driver` broke VirtualBox 6.1.x support #139

Closed grembo closed 3 weeks ago

grembo commented 1 month ago

Overview of the Issue

When trying to run packer using VirtualBox 6.1.50, this error is perceived:

VBoxManage: error: Unknown option: --audio-driver

Provisioning stops at that point.

This was introduced in: https://github.com/hashicorp/packer-plugin-virtualbox/commit/7aff1292c1e9586f1a4c87de1e12ff0ca245ff89

Background is that VirtualBox deprecated the --audio option, but only for 7.x, in this commit: https://www.virtualbox.org/changeset/98032/vbox

So following the deprecation notice that early means the plugin doesn't work for the still supported 6.1.x line of VirtualBox.

Maybe it would be possible to rollback the change or make behavior dependent on the version of VirtualBox.

Reproduction Steps

Install VirtualBox 6.50.1 and run packer build ...

Plugin and Packer version

Plugin: packer-plugin-virtualbox_v1.1.0_x5.0_freebsd_amd64 Packer: v1.10.1

Simplified Packer Buildfile

...

Operating system and Environment details

FreeBSD 13.3-RELEASE-p3, VirtualBox from official package builds.

Log Fragments and crash.log files

VBoxManage: error: Unknown option: --audio-driver

lamesjinden commented 1 month ago

The referenced change also breaks the Ubuntu/Jammy bundling of VirtualBox (6.1.50-dfsg-1~ubuntu1.22.04.1).

lorengordon commented 1 month ago

I pinned to v1.0 to workaround this issue.

packer {
  required_plugins {
    virtualbox = {
      source  = "github.com/hashicorp/virtualbox"
      version = "~> 1.0.0"
    }
  }
}
lorengordon commented 1 month ago

Oh, unfortunately, turns out 6.1 is not actually supported any longer. 😢 https://www.virtualbox.org/wiki/Download_Old_Builds

Irritating there seems to be no Ubuntu release that includes 7.0 yet.

grembo commented 1 month ago

Oh, unfortunately, turns out 6.1 is not actually supported any longer. 😢 https://www.virtualbox.org/wiki/Download_Old_Builds

Irritating there seems to be no Ubuntu release that includes 7.0 yet.

That’s kind of strange, as https://www.virtualbox.org/wiki/Changelog-6.1 doesn’t mention that (compare with what is shown for 6.0) - that’s where I checked first. Also, strange that the build page you linked to says it is not supported anymore in the same month it was released. So maybe an oversight by the virtualbox documentation team.

Still, it seems like 6.1.50 is the latest on various distributions, so not breaking it would be nice (especially since vbox 7 supports both syntaxes).

(Leaving a screenshot below of what I looked at)

IMG_0096

grembo commented 1 month ago

@lorengordon clicking around the download page I noticed that the license changed from GPLv2 in 6.1 to GPLv3 in 7.0. So 6.1 might be around for some application for a long time, even if not officially supported by the project.

nywilken commented 1 month ago

Apologies - seeing these bubble up now. This was a mistake on my end I was under the impression that the networking fix introduced for handling the breaking NAT gateway address (#122 ) for VirtualBox v7.0 removed support for older versions.

We can continue supporting both versions. I'll open a PR to support the audio flags for both versions.