Packer Created VMs Failing to Boot
-
When creating a Windows VM with Packer using UEFI boot firmware, the VM is failing to boot around 88% with no errors logged in XOA.
I am using the following Packer plugin:
https://github.com/ddelnano/packer-plugin-xenserver/tree/mainThings tested/checked so far:
- If the VM is switched from UEFI to BIOS it boots but then fails to boot if switched back to UEFI.
- If a VM is manually created in XOA from the same template it boots with no issue
- If the firmware="uefi" option is removed from Packer, the VM defaults to BIOS and boots fine. However, if the VM is switched to UEFI it fails to boot
- Using Packer to create a UEFI CentOS VM works as expected
- Re-created the cloned Windows template and issue persists
I checked the output of xe vm-list with all params, and the only major differences I noticed are:
Packer created VM:
platform (MRW): timeoffset: 0; device-model: qemu-upstream-uefi; viridian: true other-config (MRW): xo:03af740a: {"creation":{"date":"2023-11-06T20:16:30.631Z","template":"1c33af1c-e919-418c-ad45-85d7d6fb604a","user":"f8241546-6b58-484e-92d0-58817ea45b3f"}}; base_template_name: Windows Server 2022 (64-bit); import_task: OpaqueRef:55b37ba3-84a2-47ac-b8a6-41fb63a69ebc; mac_seed: ceaf53ff-f229-63d2-b586-5cb5aaea6686; install-methods: cdrom
XOA created VM:
platform (MRW): secureboot: false; device-model: qemu-upstream-uefi; timeoffset: 0; videoram: 8; hpet: true; viridian_apic_assist: true; apic: true; device_id: 0002; cores-per-socket: 2; viridian_crash_ctl: true; pae: true; vga: std; nx: true; viridian_time_ref_count: true; viridian_stimer: true; viridian: true; acpi: 1; viridian_reference_tsc: true other-config (MRW): xo:17504efc: {"creation":{"date":"2023-11-06T21:03:58.450Z","template":"03af740a-ca0d-4246-e64d-bab99b90f682","user":"f8241546-6b58-484e-92d0-58817ea45b3f"}}; xo:03af740a: {"creation":{"date":"2023-11-06T20:16:30.631Z","template":"1c33af1c-e919-418c-ad45-85d7d6fb604a","user":"f8241546-6b58-484e-92d0-58817ea45b3f"}}; base_template_name: Windows Server 2022 (64-bit); import_task: OpaqueRef:55b37ba3-84a2-47ac-b8a6-41fb63a69ebc; mac_seed: f5d234ad-6d5c-012b-a2f7-2c2ee9a61cca; install-methods: cdrom
-
You are probably not using the right template in the first place
-
-
@olivierlambert That is always a possibility
I created the Windows and CentOS templates the same way by creating a base VM without installing the OS and then capturing that as a Template. I also tried copying the default pre-defined Windows Server 2022 template.
-
@AtaxyaNetwork or @ddelnano might tell you how to select the right template
-
@olivierlambert - Figured it out for anyone else's future reference.
When setting platform_args you need to define all of them even if you only need to change one.
Since the defaults are
{ "viridian": "false", "nx": "true", "pae": "true", "apic": "true", "timeoffset": "0", "acpi": "1", "cores-per-socket": "1" }
I needed to include all of them even though I only needed
"viridian": "true"
. Once I added in the other options the VM booted and the build worked. -
Hi @dan89 !
I'm not a windows expert, but I can do some testing.
Can you show us your pkr.hcl file ?
-
-
Do you have a pkr.hcl for windows that you can share?
I am curious how your handling winrm and autounattend.xml?
-
@mtcoffee said in Packer Created VMs Failing to Boot:
Do you have a pkr.hcl for windows that you can share?
Follow up question: Do you have a pkr.hcl for windows that you can share?
-
After posting this I ended up building out a sample project and shared on github.
https://github.com/mtcoffee/xcp-ng-packer-examples -
@mtcoffee talk about great timing?
About 25 minutes ago, I git cloned your repo!
Thanks. -
@mtcoffee Any luck getting autounattend.xml - UEFI to work?
-
-
Anyone know where the @ddelnano Discord channel is?
-
-
@olivierlambert thank you
-
I would really love to get this working w XCP, no bios, I mean uefi only.
Packer was super easy to setup on ESXi + vCenter! -
Contributions are welcome, we are pretty busy here, and if we planned to have a fully dedicated "Devops" team, it will be in place in September. So please be patient, we do not have 5000 engineers
-
@olivierlambert is spot on. Manage expectations. The best thing we can do is contribute helpful information.
Here is what I was able to deduce when this issue came up.
When creating a Windows VM in uefi mode and using the floppy_file option in packer:
- There is a disk added as "fda"
- However the fda device is not available as the a: drive or any other drive letter. When booted using bios mode, you can find the fda device by settting drive letter to "a:".
This is likely because uefi typically does not support floppy disks. I believe in VMWare when the floppy_file option was used in UEFI mode, it added the ISO as a DVD drive instead of an FDA.
Not sure if this is best solved at the Packer level or if it should be intercepted and corrected XCP-ng level?
-
I hear you regarding "managing expectations".
If Vates (as a company) is going to claim they offer VMware type/like value then Windows can not be a 2nd class citizen in your ecosystem!