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

virtualbox-ovf builder is not compatible with Ubuntu 22.04 cloud image mounting cd_files #108

Open
hc-github-team-packer opened this issue Apr 10, 2023 · 1 comment

Comments

@hc-github-team-packer
Copy link

This issue was originally opened by @Jamie- in hashicorp/packer#12340 and has been migrated to this repository. The original issue description is below.


Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Overview of the Issue

Packer's virtualbox-ovf is not compatible with the latest (today) Ubuntu 22.04 Jammy cloud image when mounting the cd_files ISO file. When the Ubuntu cloud image is imported into VirtualBox, the IDE controller name is just "IDE" and not "IDE Controller" which is hardcoded in the packer virtualbox-ovf plugin.

If I inspect the imported Ubuntu OVA with vboxmanage list vms -l you can see the storage controller name is just "IDE":

Storage Controller Name (0):            IDE
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on

Whereas packer hardcodes the storage controller name to "IDE Controller", which I think is here: https://github.com/hashicorp/packer-plugin-virtualbox/blob/main/builder/virtualbox/common/step_attach_isos.go#L107

I tried adding a vboxmanage command to rename the controller but the CD image ISO is mounted in an earlier step to vboxmanage so this doesn't help:

  vboxmanage = [
    ["storagectl", "{{ .Name }}", "--name", "IDE", "--rename", "IDE Controller"],
  ]

Reproduction Steps

Grab the template below, create a directory vm_data, create any random file in it, and start a packer build

PACKER_LOG=1 packer build ubuntu.pkr.hcl

Packer version

$ packer version
Packer v1.8.6

Simplified Packer Template

source "virtualbox-ovf" "jammy" {
  vm_name = "jammy"
  source_path = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.ova"
  checksum = "sha256:80decd92b39aad995bb1a7a01ae64680514f33d5ef4e117c5193f0eab376294c"
  headless = true
  cd_files = ["vm_data/*"]
  cd_label = "cidata"
  ssh_port = 22
  ssh_timeout = "30m"
  ssh_username = "ubuntu"
  shutdown_command = "sudo -S -E shutdown -P now"
}

build {
  sources = [
    "source.virtualbox-ovf.jammy"]
  provisioner "shell" {
    inline = ["echo foo"]
  }
 }

Operating system and Environment details

Host OS is Ubuntu 22.04 more details below:

$ vboxmanage -v
6.1.38_Ubuntur153438
$ lsb_release -d
Description:	Ubuntu 20.04.6 LTS
$ uname -r
5.4.0-135-generic

Log Fragments and crash.log files

==> virtualbox-ovf.jammy: Mounting ISOs...
    virtualbox-ovf.jammy: Mounting cd_files ISO...
2023/04/04 16:13:09 packer-builder-virtualbox-ovf plugin: Executing VBoxManage: []string{"storageattach", "jammy", "--storagectl", "IDE Controller", "--port", "1", "--device", "1", "--type", "dvddrive", "--medium", "/tmp/packer583214647.iso"}
2023/04/04 16:13:09 packer-builder-virtualbox-ovf plugin: stdout:
2023/04/04 16:13:09 packer-builder-virtualbox-ovf plugin: stderr: VBoxManage: error: Could not find a controller named 'IDE Controller'
==> virtualbox-ovf.jammy: Error attaching ISO: VBoxManage error: VBoxManage: error: Could not find a controller named 'IDE Controller'
==> virtualbox-ovf.jammy: Error attaching ISO: VBoxManage error: VBoxManage: error: Could not find a controller named 'IDE Controller'
==> virtualbox-ovf.jammy: Step "StepAttachISOs" failed

Set the env var PACKER_LOG=1 for maximum log detail.

@Marc3001
Copy link

Marc3001 commented Apr 9, 2024

Seems to be an issue since a while as this issue is the same as this one
#56

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

No branches or pull requests

2 participants