Skip to main content
Solved

Packer Windows 2022 Boot Loop

  • April 24, 2025
  • 18 replies
  • 561 views

  • Adventurer
  • 3 replies

We are new to Nutanix coming over from vSphere and are experiencing the same issues that is discussed but not resolved on this thread:

https://next.nutanix.com/ahv-virtualization-27/packer-press-any-key-to-boot-from-cd-dvd-issue-43213

We are using Packer to build a Window 2022 image.  We have customised the ISO to remove the "Press any key to boot..." prompt.  However, we are now in a situation where Packer/AHV doesn't allow us to specify a boot order so the CD is constantly booting, installing and rebooting.

We can continue the Packer build if we manually dismount the CD, however, we want to be in a position where this is a hands off build and orchestrated by a pipeline like our vSphere builds are.

Has anyone managed to get around this?

 

 

Best answer by crisj

Hello ​@gael01 , ​@seanpmassey13 ​@JeroenTielen ​@LDH 

 

There was a recent change that now allows using boot_order also for UEFI, but there was an internal issue in the API doc.
Thanks for the PR, i will merge it quickly and make a new release.

I’m also working on the boot_command feature, which will also fix the other issue ​@gael01 mentioned above

There is a tech-preview here https://github.com/nutanix-cloud-native/packer-plugin-nutanix/releases/tag/0.13.0-dev if you want to test it

For now, I’m the main occasional contributor for this project, so don’t hesitate to contact me directly

++

This topic has been closed for replies.

18 replies

JeroenTielen
Forum|alt.badge.img+8
  • Vanguard
  • 1788 replies
  • April 24, 2025

You can change the boot order after the installation with:

acli vm.update_boot_device <vm_name> boot_device_order=kDisk,kCdrom,kNetwork


  • Author
  • Adventurer
  • 3 replies
  • April 29, 2025

Hello,

Thank you for your reply.  We would be looking to re-run the packer jobs automatically I.e. monthly just after Patch Tuesday.  I assume we would need a parallel pipeline job/task to run this command whilst the build VM is in the loop?

 

Do we think this quirk is likely to be fixed by either Nutanix or Hashicorp?


  • Author
  • Adventurer
  • 3 replies
  • May 9, 2025

Hello - We don’t seem to be able to automate this packer build end-to-end.  SSH into the CVM to set the boot order doesn’t fit into the pipeline especially as it needs the machine to be full power cycled to take the settings.  We can’t be the only people seeing this, right?!?


Forum|alt.badge.img+1
  • Trailblazer
  • 12 replies
  • May 16, 2025

Hello - We don’t seem to be able to automate this packer build end-to-end.  SSH into the CVM to set the boot order doesn’t fit into the pipeline especially as it needs the machine to be full power cycled to take the settings.  We can’t be the only people seeing this, right?!?

I’m also seeing the issue as I start to migrate my Windows build jobs to Nutanix.

The Nutanix Packer plugin is managed by Nutanix, and it is open-source and accepting contributions.  If you’re comfortable with Golang, you could update the plugin to allow you to set the UEFI boot priority and then submit a pull request.


Forum|alt.badge.img+3
  • Trendsetter
  • 53 replies
  • May 16, 2025

Hi ​@Idh , i’m using Packer frequently and doesn’t have any issue on CDROM order and/or booting for years.

Could you share your .pkr.hcl file ?


Forum|alt.badge.img+1
  • Trailblazer
  • 12 replies
  • May 16, 2025

Hi ​@Idh , i’m using Packer frequently and doesn’t have any issue on CDROM order and/or booting for years.

Could you share your .pkr.hcl file ?

This is an issue with the current version of the Packer plugin.  If you set the boot type to UEFI and try to change the boot priority, you get the following error message when running your Packer HCL file:

UEFI does not support boot priority

This will require an update to the Packer plugin.  I looked at the code last night, and this should be a pretty easy change to make.  At least easier than adding Serial Port support to the Packer plugin.


Forum|alt.badge.img+3
  • Trendsetter
  • 53 replies
  • May 16, 2025

Hi ​@Idh , i’m using Packer frequently and doesn’t have any issue on CDROM order and/or booting for years.

Could you share your .pkr.hcl file ?

This is an issue with the current version of the Packer plugin.  If you set the boot type to UEFI and try to change the boot priority, you get the following error message when running your Packer HCL file:

UEFI does not support boot priority

This will require an update to the Packer plugin.  I looked at the code last night, and this should be a pretty easy change to make.  At least easier than adding Serial Port support to the Packer plugin.

 

Alright, but there’s still a workaround by not using boot_priority in my opinion.

I mean, from a gold image perspective, what’s the use case to set the boot_priority ?

In my case, i don’t use it and every Windows template I make correctly boot and it automates every of its steps with unattend files (used by cdrom).

So maybe i’m missing something and/or something behaves differentes between ESXi and AHV ?

 

That’s why i’d like to watch his Packer file to 100% understand the use case :)

 


Forum|alt.badge.img+1
  • Trailblazer
  • 12 replies
  • May 16, 2025

Hi ​@Idh , i’m using Packer frequently and doesn’t have any issue on CDROM order and/or booting for years.

Could you share your .pkr.hcl file ?

This is an issue with the current version of the Packer plugin.  If you set the boot type to UEFI and try to change the boot priority, you get the following error message when running your Packer HCL file:

UEFI does not support boot priority

This will require an update to the Packer plugin.  I looked at the code last night, and this should be a pretty easy change to make.  At least easier than adding Serial Port support to the Packer plugin.

 

Alright, but there’s still a workaround by not using boot_priority in my opinion.

I mean, from a gold image perspective, what’s the use case to set the boot_priority ?

In my case, i don’t use it and every Windows template I make correctly boot and it automates every of its steps with unattend files (used by cdrom).

So maybe i’m missing something and/or something behaves differentes between ESXi and AHV ?

 

What I’m seeing in my lab is that without setting boot priority to disk, the AHV VM will keep booting to the Windows ISO and automatically running through the Windows installer.

 

According to the documentation, the default boot priority when using Packer is CD-ROM.  We can’t change that to disk when using UEFI, and so we’re kind of stuck in this loop.


Forum|alt.badge.img+3
  • Trendsetter
  • 53 replies
  • May 16, 2025

What I’m seeing in my lab is that without setting boot priority to disk, the AHV VM will keep booting to the Windows ISO and automatically running through the Windows installer.

=> I agree with this statement, I didn’t get it first. 😉however, in that case, the most simple workaround (even if you run Packer template few times a day) is to open console of temp Packer VM template, just press a button, and everything goes well until Packer finishes the image.

I mean, ok that’s 99% automation instead of 100%, but it saves you a lot of time about configuration cause just after typing a key, everything goes well.

 

According to the documentation, the default boot priority when using Packer is CD-ROM.  We can’t change that to disk when using UEFI, and so we’re kind of stuck in this loop.

=> I also agree with that, i’m using UEFI too, but this bug last since years unfortunately… so yeah the only “workaround” is the previous I wrote.

 

Note : I share the feeling about this topic, issue was there since years but probably not the “most important” to solve unfortunately...

 


Forum|alt.badge.img+1
  • Trailblazer
  • 12 replies
  • May 16, 2025

Note : I share the feeling about this topic, issue was there since years but probably not the “most important” to solve unfortunately...

 

After looking at the relevant parts of the code, this should be a pretty simple fix.  I just to find the time to patch it, test it, and submit a pull request.


Forum|alt.badge.img+3
  • Trendsetter
  • 53 replies
  • May 16, 2025

Note : I share the feeling about this topic, issue was there since years but probably not the “most important” to solve unfortunately...

 

After looking at the relevant parts of the code, this should be a pretty simple fix.  I just to find the time to patch it, test it, and submit a pull request.

If you need beta tester, let me know when you make PR :D


Forum|alt.badge.img+1
  • Trailblazer
  • 12 replies
  • May 18, 2025

Forum|alt.badge.img+3
  • Trendsetter
  • 53 replies
  • May 19, 2025

I’ll clone and give a try soon :) ! thanks ​@seanpmassey13 


crisj
Nutanix Employee
Forum|alt.badge.img+2
  • Nutanix Employee
  • 3 replies
  • Answer
  • May 19, 2025

Hello ​@gael01 , ​@seanpmassey13 ​@JeroenTielen ​@LDH 

 

There was a recent change that now allows using boot_order also for UEFI, but there was an internal issue in the API doc.
Thanks for the PR, i will merge it quickly and make a new release.

I’m also working on the boot_command feature, which will also fix the other issue ​@gael01 mentioned above

There is a tech-preview here https://github.com/nutanix-cloud-native/packer-plugin-nutanix/releases/tag/0.13.0-dev if you want to test it

For now, I’m the main occasional contributor for this project, so don’t hesitate to contact me directly

++


JeroenTielen
Forum|alt.badge.img+8
  • Vanguard
  • 1788 replies
  • May 20, 2025

What I should do is the following: 

  1. Create a VM and set the boot order to first boot hdd and second cdrom. 
    1. vm.update_boot_device <vm_name> boot_device_order=kDisk,kCdrom,kNetwork
  2. Mount Windows iso (where the "press any key to boot blablabl” is removed
  3. Turn on vm and it will skipp hdd and boots cdrom (as there is no OS on the disk)
  4. VM reboots after Windows is installed, rebooting from hdd now.

And yes, this works ;) 


crisj
Nutanix Employee
Forum|alt.badge.img+2
  • Nutanix Employee
  • 3 replies
  • May 20, 2025

With Packer Nutanix plugin v0.12.2 (just released) you will be able to set the order directly in your packer file

With the next Packer Nutanix plugin (early June, I think, tech preview in progress, see above ), no need to modify the Windows image; you can just press the key with Packer


  • Author
  • Adventurer
  • 3 replies
  • June 11, 2025

Just an update on this chain.

 

Firstly, apologies for the late repiy.  Following the great work above, we have successfully created a UEFI Windows Packer build end-to-end.

 

Thank you so much for all your help!


crisj
Nutanix Employee
Forum|alt.badge.img+2
  • Nutanix Employee
  • 3 replies
  • June 11, 2025

Thanks for the feedback ldh