Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create azure VM for cloudbase sysprepped image. #161

Open
PrashantRaj18198 opened this issue Nov 13, 2024 · 1 comment
Open

Unable to create azure VM for cloudbase sysprepped image. #161

PrashantRaj18198 opened this issue Nov 13, 2024 · 1 comment

Comments

@PrashantRaj18198
Copy link

PrashantRaj18198 commented Nov 13, 2024

Hi,

I made an image including cloudbase init. And sysprepped the VM using the cloud init provided unattend.xml file
Here's how I'm doing the sysprep

# Use the unattend.xml provided by cloudbase-init
$unattendedXml = Join-Path $env:ProgramFiles "Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml"
& $env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /mode:vm /quit /quiet /unattend:$unattendedXml
if ($LASTEXITCODE) {
    Throw "Failed to run Sysprep.exe"
}

... # wait for image state to reach IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE

This is using packer btw.

The image made is able to bootup most of the time (this is different different instances, by bootup I mean new instance allocation). But some times it fails with the error

OS Provisioning for VM 'wb-wrkcsr44qg5t' did not finish in the allotted time. However, the VM guest agent was detected running. This suggests the guest OS has not been properly prepared to be used as a VM image (with CreateOption=FromImage). To resolve this issue, either use the VHD as is with CreateOption=Attach or prepare it properly for use as an image:
Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/
Instructions for Linux: https://azure.microsoft.com/documentation/articles/virtual-machines-linux-capture-image/
Deleting and recreating the virtual machine may resolve the issue

The machine however is okay when I restart it and it works. This flow is part of an automated process where I can't do a manual intervention to start up the VMs.

Let me know if I can provide any additional details on this.

@ader1990
Copy link
Member

Hello,

With packer is a little bit more different, but this might be useful: https://github.com/cloudbase/windows-imaging-tools/blob/master/UnattendResources/Logon.ps1#L720

I suggest creating images with this tool: https://github.com/cloudbase/windows-imaging-tools or maybe trying to reproduce the steps when creating such an image.

You have an example of working cloudbase-init configuration and steps here:
https://github.com/cloudbase/windows-imaging-tools/tree/master/Examples/config/azure

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants