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 3.0k 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.
    • F Offline
      fatek @mtcoffee
      last edited by

      @mtcoffee It seems like getting Packer involved would be the way to go but I have zero idea on what is involved.

      Looking at vSphere ISO docs, there is the option to create cdrom configs and also another option to use cd_files (list of files to place on to a CD that is attached when the VM is booted).

      I don't see that option in the XenServer-iso docs.

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO @fatek
        last edited by

        @fatek To be clear, absolutely nobody on the market has an equivalent to VMware. Nobody. We never told we could replace entirely all the VMware product.

        Obviously, we'd like to close the gap as fast as possible, but the fact Vates is entirely privately bootstrapped and privately owned means we cannot burn VC's money at the pace of Nutanix for example.

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

          @fatek said in Packer Created VMs Failing to Boot:

          they offer VMware type/like value

          @olivierlambert Yes, I am aware & not suggesting you spend money like a drunk sailor!
          That is why I said "vmware like value"

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

            @mtcoffee said in Packer Created VMs Failing to Boot:

            Not sure if this is best solved at the Packer level or if it should be intercepted and corrected XCP-ng level?

            @olivierlambert Just curious if this is more of a Packer issue or does the solution have to come from the Vates side?

            1 Reply Last reply Reply Quote 0
            • olivierlambertO Offline
              olivierlambert Vates 🪐 Co-Founder CEO
              last edited by

              I don't know because I didn't have time to take a deeper look 🙂

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

                Any updates on this uefi issue?

                1 Reply Last reply Reply Quote 0
                • olivierlambertO Offline
                  olivierlambert Vates 🪐 Co-Founder CEO
                  last edited by olivierlambert

                  Maybe @AtaxyaNetwork has a clue, otherwise it will have to wait for William arrival in the next weeks 🙂

                  @ddelnano is probably ultra busy now

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

                    Edit: Just had a thought, no idea if it's another potential workaround. In the builder you specify a template to clone that is used to create the VM. I'm on Xenserver 8, and there is no way through the GUI, but I think it might be possible to add an extra DVD-drive to a template? If that gets brought over to the packer vm, then that might be an option. Might need to do an eject from within the vm in order to dismount the dvd in order to not have it be part of the artifact though.

                    @olivierlambert Sounds like the best way forward would be to add the equivalent of the Hyper-V builder's secondary_iso that mounts a second iso-file, or even better cd_files which creates a temporary iso for you and mounts it.

                    For anyone who wants to test building eufi machines until this is solved, I have a Powershell script that takes a Windows ISO and generates a new one with files added (in my case autounattend.xml, bootstrap.ps1 and the management agent msi. Though I should change it to just download the msi instead to avoid rebuilding it.)

                    Since I was building a new ISO anyway, I also changed the boot loader to the noprompt one in order to avoid the timing issues with boot_commands and "Press any key to boot from DVD...."

                    The script uses oscdimg.exe that's included in the Windows ADK, which can be found here:
                    https://learn.microsoft.com/en-us/windows-hardware/get-started/adk-install

                    # Settings
                    $Architecture    = "amd64" # Or x86
                    $InputISOfile    = "D:\Deploy\ISO\Windows Server 2022 Eval.iso"
                    $OutputISOfile   = "D:\Deploy\ISO\Windows Server 2022 Eval XenServer.iso"
                    $TempFolder      = "E:\Temp\Win2022XenServer"
                    $AdditionalFiles = @(
                    	"C:\files\Autounattend.xml",
                    	"C:\files\bootstrap.ps1",
                    	"C:\\managementagentx64.msi"
                    )
                    
                    $OSCDIMG_Path = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools" + "\$Architecture\Oscdimg"
                    
                    # Check environment
                    If (!(Test-path $InputISOfile)){ Write-Warning "Input ISO file not found. Exiting";Break}
                    If (!(Test-path $OSCDIMG_Path)){ Write-Warning "OSCDIMG Path not found. Exiting";Break}
                    if((Test-Path $TempFolder)){ Write-Warning "Temp folder $TempFolder exists. Exiting.";Break}
                    foreach($file in $AdditionalFiles) {
                    	if(!(Test-Path $$file)){ Write-Warning "Additional file $file does not exists. Exiting.";Break}
                    }
                    
                    # Mount the original Windows ISO and figure out the drive-letter
                    Mount-DiskImage -ImagePath $InputISOfile
                    $ISOImage = Get-DiskImage -ImagePath $InputISOfile | Get-Volume
                    $ISODrive = [string]$ISOImage.DriveLetter+":"
                    
                    # Copy ISO contents to temp dir and add additional files
                    New-Item -Path $TempFolder -ItemType Directory -Force
                    Copy-Item "$ISODrive\*" $TempFolder -Recurse
                    if(($AdditionalFiles) -and $AdditionalFiles.Length -gt 0) {
                    	Copy-Item $AdditionalFiles $TempFolder
                    }
                    
                    # Dismount the Original ISO
                    Dismount-DiskImage -ImagePath $InputISOfile
                    
                    # Create a new bootable Windows ISO file, based on the Original ISO, but using efisys_noprompt.bin instead
                    $BootData='2#p0,e,b"{0}"#pEF,e,b"{1}"' -f "$TempFolder\boot\etfsboot.com","$TempFolder\efi\microsoft\boot\efisys_noprompt.bin"
                      
                    $Proc = Start-Process -FilePath "$OSCDIMG_Path\oscdimg.exe" -ArgumentList @("-m","-o","-bootdata:$BootData",'-u2','-udfver102',"$TempFolder\","`"$OutputISOfile`"") -PassThru -Wait -NoNewWindow
                    if($Proc.ExitCode -ne 0)
                    {
                        Throw "Failed to generate ISO with exitcode: $($Proc.ExitCode)"
                    }
                    Get-FileHash -Path $OutputISOfile -Algorithm SHA256
                    Remove-Item $TempFolder -recurse -force
                    
                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post