hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.04k stars 3.32k forks source link

VirtualBox Optical Drive not created as master in EFI mode #7081

Closed koaps closed 4 years ago

koaps commented 5 years ago

When creating an EFI enabled VM, the optical drive isn't set to master (primary or secondary), this prevents the mounted ISO from being loaded and failing into the EFI shell.

The Optical drive should be an IDE secondary master, VirtualBox does this by default when creating a VM manually.

breisig commented 4 years ago

Getting the same issue. Virtualbox ISO cd does not load unless it was set to IDE secondary master for me in EFI mode.

SwampDragons commented 4 years ago

Do either of you have a template for reproducing? It'll be way faster for me to get a patch in if I know how you're configuring this.

breisig commented 4 years ago

I got abit closer now to make Virtualbox in EFI mode boot an ISO. Since I didn't know how to modify the existing "IDE Controller" that the ISO file used to change the port, I had to modify my packer file to add a new IDE controller as type IDE primary master and manually attach the ISO that way under "vboxmanage" .

    "vboxmanage": [
        [ "modifyvm", "{{.Name}}", "--firmware", "EFI" ],
        [ "storageattach", "{{.Name}}", "--storagectl", "IDE Controller", "--port", "0", "--device", "0", "--type", "dvddrive", "--medium", "C:\centos8.iso"],
    ]

Of course, It would be better to be able to modify the port/device of the IDE Controller from within packer instead of me creating a new device.

SwampDragons commented 4 years ago

Definitely. We have a fairly primitive driver for attaching disks; I won't get a chance to before the 1.4.5 release but adding more direct ability to control the storagectl commands could be something we aim for in the 1.5 release.

breisig commented 4 years ago

ok, I finally got an ISO working in EFI mode without having to modify/attach another IDE device. All I had to do is force the iso_interface to be setup as a SATA drive instead of the default IDE mode by adding the following to my packer config.

      "iso_interface": "sata",
      "vboxmanage": [
        [ "modifyvm", "{{.Name}}", "--firmware", "EFI" ]
      ]

This will allow the ISO to be bootable.

SwampDragons commented 4 years ago

Awesome. So sounds like we have some work to do around making sure we set reasonable defaults, and add lots of documentation.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.