Packer: Hyper-V ISO builder fails with message: "The boot loader failed - Time out" inside the virtual machine

Created on 27 Apr 2018  ยท  5Comments  ยท  Source: hashicorp/packer

  • Packer version: 1.2.3
  • Host platform: Windows Server 2016 with April 2018 Cumulative Update

I am building images for Windows Server 2012 R2, 2016 and 2019 Insider Preview.
During the last few months the build has been failing a lot with the error message "The boot loader failed - Time out".

Everything works as normal for the build process in Packer.
==> hyperv-iso: Creating temporary directory...
==> hyperv-iso: Downloading or copying ISO
hyperv-iso: Downloading or copying: file:///C:/Packer/iso/SW_DVD9_Win_Svr_STD_Core_and_DataCtr_Core_2016_64Bit_English_-3_MLF_X21-30350.ISO
==> hyperv-iso: Creating switch 'Hyper-V Logical SET Switch' if required...
==> hyperv-iso: switch 'Hyper-V Logical SET Switch' already exists. Will not delete on cleanup...
==> hyperv-iso: Creating virtual machine...
==> hyperv-iso: Enabling Integration Service...
==> hyperv-iso: Setting boot drive to os dvd drive C:/Packer/iso/SW_DVD9_Win_Svr_STD_Core_and_DataCtr_Core_2016_64Bit_English_-3_MLF_X21-30350.ISO ...
==> hyperv-iso: Mounting os dvd drive C:/Packer/iso/SW_DVD9_Win_Svr_STD_Core_and_DataCtr_Core_2016_64Bit_English_-3_MLF_X21-30350.ISO ...
==> hyperv-iso: Skipping mounting Integration Services Setup Disk...
==> hyperv-iso: Mounting secondary DVD images...
==> hyperv-iso: Mounting secondary dvd drive ./answer_files/win2016VL/Autounattend.iso ...
==> hyperv-iso: Configuring vlan...
==> hyperv-iso: Starting the virtual machine...
==> hyperv-iso: Host IP for the HyperV machine: False
==> hyperv-iso: Typing the boot command...
==> hyperv-iso: Waiting for WinRM to become available...

The issue occurs inside the virtual machines. A screenshot is available here.

The Packer build template file is available in this Gist.

If I manually press Ctrl+Alt+Del, the VM boots into the OS ISO and all of the remaining process works as it should. The issue is the initial boot from ISO.

Any idea what might cause this?

Update: It seems like this is a timing issue. After changing boot_wait from 0 to 2 seconds it seems to be working more stable. I'll leave the issue open until next week when the automated builds has run again to verify the whole pipeline is working stable.

bug buildehyperv

All 5 comments

I was just setting up the same Packer build configuration in a different environment (lab - slower hardware).
The issue in that environment seems to be the opposite: While Packer is in the "Starting the virtual machine..." state, the VM has already started and the "Press any key to start installation" screen is gone when Packer gets to the waiting state. Even when setting the boot wait to 0 seconds, Packer is too slow to type the boot commands.
However, I suppose that`s another issue so I'll create one after some more testing.

I've also found this issue, but in my case I can confirm it comes from different ISO versions. For example 2 different revisions of MS2016 Partner ISO gave me different results:

The config that works for them both is (in my case) :

 "boot_wait": "0s",
      "boot_command": [
        "a<enter><wait>"
      ],

I experienced the same thing: 2012 R2 VL ISO worked fine, but 2016 VL ISO failed with the same settings.

I ended up using the following which seems to work for both:
"boot_wait": "0s", "boot_command": [ "a<wait>a<wait>a<wait>a<wait>a<wait>a<wait>a" ]

It looks like you managed to dial in the right wait; I'm going to close this but if I'm wrong in thinking the issue is resolved, let me know.

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.

Was this page helpful?
0 / 5 - 0 ratings