XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Packer Created VMs Failing to Boot

    Scheduled Pinned Locked Moved Infrastructure as Code
    28 Posts 6 Posters 8.9k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dan89
      last edited by

      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/main

      Things tested/checked so far:

      1. If the VM is switched from UEFI to BIOS it boots but then fails to boot if switched back to UEFI.
      2. If a VM is manually created in XOA from the same template it boots with no issue
      3. 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
      4. Using Packer to create a UEFI CentOS VM works as expected
      5. 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
      
      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates πŸͺ Co-Founder CEO
        last edited by

        You are probably not using the right template in the first place πŸ™‚

        D 1 Reply Last reply Reply Quote 0
        • olivierlambertO olivierlambert moved this topic from Compute on
        • D Offline
          dan89 @olivierlambert
          last edited by

          @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.

          πŸ€”

          1 Reply Last reply Reply Quote 0
          • olivierlambertO Offline
            olivierlambert Vates πŸͺ Co-Founder CEO
            last edited by

            @AtaxyaNetwork or @ddelnano might tell you how to select the right template

            D AtaxyaNetworkA 2 Replies Last reply Reply Quote 0
            • D Offline
              dan89 @olivierlambert
              last edited by

              @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.

              AtaxyaNetworkA M 2 Replies Last reply Reply Quote 0
              • AtaxyaNetworkA Offline
                AtaxyaNetwork Ambassador @olivierlambert
                last edited by

                Hi @dan89 !

                I'm not a windows expert, but I can do some testing.

                Can you show us your pkr.hcl file ?

                1 Reply Last reply Reply Quote 0
                • AtaxyaNetworkA Offline
                  AtaxyaNetwork Ambassador @dan89
                  last edited by

                  We posted at the same time πŸ˜„

                  @dan89 Glad you figured it out !

                  Maybe it can be documented in the packer repo. What do you think @ddelnano ?

                  1 Reply Last reply Reply Quote 1
                  • M Offline
                    mtcoffee @dan89
                    last edited by

                    @dan89

                    Do you have a pkr.hcl for windows that you can share?

                    I am curious how your handling winrm and autounattend.xml?

                    1 Reply Last reply Reply Quote 0
                    • F Offline
                      fatek
                      last edited by

                      @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?

                      M 1 Reply Last reply Reply Quote 0
                      • M Offline
                        mtcoffee @fatek
                        last edited by

                        @fatek

                        After posting this I ended up building out a sample project and shared on github.
                        https://github.com/mtcoffee/xcp-ng-packer-examples

                        F 2 Replies Last reply Reply Quote 1
                        • F Offline
                          fatek @mtcoffee
                          last edited by

                          @mtcoffee talk about great timing?
                          About 25 minutes ago, I git cloned your repo!
                          Thanks.

                          1 Reply Last reply Reply Quote 0
                          • F Offline
                            fatek @mtcoffee
                            last edited by

                            @mtcoffee Any luck getting autounattend.xml - UEFI to work?

                            M 1 Reply Last reply Reply Quote 0
                            • M Offline
                              mtcoffee @fatek
                              last edited by

                              @fatek

                              I noted that in the packer file. I was not able to get packers floppy_files working in uefi mode.

                              @ddelnano might have some insight?

                              1 Reply Last reply Reply Quote 1
                              • F Offline
                                fatek
                                last edited by

                                Anyone know where the @ddelnano Discord channel is?

                                1 Reply Last reply Reply Quote 0
                                • olivierlambertO Offline
                                  olivierlambert Vates πŸͺ Co-Founder CEO
                                  last edited by

                                  https://discord.gg/Cp2CDhqd

                                  F 1 Reply Last reply Reply Quote 0
                                  • F Offline
                                    fatek @olivierlambert
                                    last edited by

                                    @olivierlambert thank you

                                    1 Reply Last reply Reply Quote 0
                                    • F Offline
                                      fatek
                                      last edited by

                                      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!

                                      1 Reply Last reply Reply Quote 0
                                      • olivierlambertO Offline
                                        olivierlambert Vates πŸͺ Co-Founder CEO
                                        last edited by olivierlambert

                                        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 πŸ˜‰

                                        M 1 Reply Last reply Reply Quote 0
                                        • M Offline
                                          mtcoffee @olivierlambert
                                          last edited by

                                          @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:

                                          1. There is a disk added as "fda"
                                          2. 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?

                                          F 2 Replies Last reply Reply Quote 1
                                          • F Offline
                                            fatek
                                            last edited by

                                            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!

                                            olivierlambertO F 2 Replies Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better πŸ’—

                                            Register Login
                                            • First post
                                              Last post