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

If guest_additions_mode is attach and device gets lower "ID" on the IDE/SATA bus than ISO, VM fails to boot #39

Open
dragon788 opened this issue Sep 2, 2021 · 0 comments
Labels

Comments

@dragon788
Copy link
Contributor

Overview of the Issue

Trying to create a Windows 10 VM fails with "FATAL: Could not read from the boot medium! System halted." When looking at the hardware configuration in the Virtualbox UI, it appears the VboxAdditions ISO gets added with a lower ID than the Windows ISO which results in a higher "boot priority" in the DVD category, and so Virtualbox tries to boot from a non-OS ISO and fails, hanging the build.

Switching the type to upload allows it to proceed but takes FOREVER and I've had it intermittently fail for no apparent reason.

I wondered if perhaps setting the tools interface to IDE could work around the issue, or enabling EFI boot instead. I tried both, and it turns out the "fix" is to set the iso_interface to ide and leave the guest_additions_interface as the default (which the docs say is ide, but actually appears to be sata), because IDE apparently gets priority over sata in the boot order evaluation so the Windows ISO boots successfully. This fix also allows EFI to boot properly, where without the workaround you got a slightly less scary EFI prompt instead of the FATAL error message, but if you watched closely, it does actually prompt to "press any key to boot from DVD" where for non-EFI aka BIOS mode you never get that prompt, but interacting with the VM to launch the boot defeats the purpose of Packer's automated process.

Recorded this issue and this workaround in the chef/bento repository I was using when I discovered the issue.
chef/bento#1370

Reproduction Steps

git clone https://github.com/chef/bento chef-bento-packer-templates
cd chef-bento-packer-templates/packer_templates/windows
packer build --only virtualbox-iso windows-10.json

Functional workaround

https://github.com/chef/bento/blob/252830cfe3a38ed5ba217464c1209625b9a3691c/packer_templates/windows/windows-10.json#L32-L40

Changed
iso_interface: ide

Added
guest_additions_interface: sata
It appears that the guest additions gets added as a "secondary device" if left to the default IDE, whether that is an additional IDE bus or just as a slave while the OS ISO is master, it fails to boot in EFI mode but oddly not BIOS mode because it is "port 0" and the OS ISO is "port 1" and Virtualbox's BIOS/EFI implementation doesn't attempt additional devices automatically (or in EFI requires a user keypress).

Plugin and Packer version

1.7.4

Simplified Packer Buildfile

https://github.com/chef/bento/blob/252830cfe3a38ed5ba217464c1209625b9a3691c/packer_templates/windows/windows-10.json

Operating system and Environment details

macOS 11.5.1 host
Virtualbox 6.1.26

Log Fragments and crash.log files

BIOS with guest as IDE and OS ISO as ide
Succeeds (usually)

OS ISO as sata, guest additions as sata, FAILS.
image

OS ISO as sata, guest additions as default IDE FAILS.
Screen Shot 2021-09-02 at 10 59 29 AM

EFI with guest as IDE and OS ISO as ide or sata, FAILS.
Screen Shot 2021-09-02 at 10 53 05 AM

@dragon788 dragon788 added the bug label Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant