Skip to content

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

Open
@PrashantRaj18198

Description

@PrashantRaj18198

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions