setup-packer icon indicating copy to clipboard operation
setup-packer copied to clipboard

Failed creating VirtualBox driver: exec: "VBoxManage": executable file not found in $PATH

Open Neudrino opened this issue 2 years ago • 1 comments

Expected Behavior

A Virtualbox image is build on a given ISO image.

Current Behavior

Build 'virtualbox-iso' errored after 4 milliseconds 350 microseconds: Failed creating VirtualBox driver: exec: "VBoxManage": executable file not found in $PATH

Steps to Reproduce

Configure and run the following Github action .github/workflows/packer.yml:

on:
  push: null

jobs:
  packer-action:
    runs-on: ubuntu-latest
    steps:
      - name: Minimal packer configuration
        run: |
          tee packer.json << EOF
          {
            "builders": [
              {
              "type": "virtualbox-iso",
              "guest_os_type": "Ubuntu_64",
              "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso",
              "iso_checksum": "md5:769474248a3897f4865817446f9a4a53",
              "ssh_username": "packer",
              "ssh_password": "packer",
              "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
              "post_shutdown_delay": "2m",
              "headless": true,
              "vboxmanage": [
                  [ "startvm", "{{.Name}}", "--type", "headless" ]
                ]
              }
            ]
          }

      - name: Validate Template
        uses: hashicorp/packer-github-actions@master
        with:
          command: validate
          arguments: -syntax-only
          target: packer.json
      - name: Build Artifact
        uses: hashicorp/packer-github-actions@master
        with:
          command: build
          arguments: "-on-error=abort"
          target: packer.json
        env:
          PACKER_LOG: 1

Environment

  • Github runner
  • Code see: https://github.com/Neudrino/magma/blob/e5066cb59483d080dd72fc1da337c4cd9acee21d/.github/workflows/build-vm-dev.yml#L50-L88
  • Run see: https://github.com/Neudrino/magma/actions/runs/3091259346/jobs/5001109136

Neudrino avatar Sep 20 '22 15:09 Neudrino

There is a job configured at https://github.com/hashicorp/packer-plugin-virtualbox/actions/workflows/test-plugin-example.yml, however it was never run. It would be good, if this job could be run at least once (better regularly) to verify that the workflow and plugin is actually working as expected.

Neudrino avatar Oct 06 '22 08:10 Neudrino

Thank you for reporting this, @Neudrino!

You should be able to use the latest version of this Action to run this builder.

Please let me know if you run into any issues with it.

ksatirli avatar Jan 02 '23 12:01 ksatirli