cloudbase / windows-imaging-tools

Tools to automate the creation of a Windows image for OpenStack, supporting KVM, Hyper-V, ESXi and more.
Apache License 2.0
675 stars 227 forks source link

Windows Server 2019 sysprep fails #283

Closed mafischer closed 4 years ago

mafischer commented 5 years ago

The process hangs waiting for sysprep to finish.

8/7/2019 9:49:46 AM - Windows online image generation started.
8/7/2019 9:49:49 AM - Cloud image generation started.
8/7/2019 9:49:50 AM - Found already existing image file. Removing it...
8/7/2019 9:49:50 AM - Already existent image file has been removed.
8/7/2019 9:49:50 AM - Creating Virtual Disk Image: C:\Users\Michael\AppData\Local\Temp\win-image.vhdx...
8/7/2019 9:49:55 AM - Successfuly created disk: C:\Users\Michael\AppData\Local\Temp\win-image.vhdx
8/7/2019 9:49:55 AM - Generate Unattend Xml :E:\Unattend.xml...
8/7/2019 9:49:55 AM - Xml was generated.
8/7/2019 9:49:55 AM - Copy Unattend Resources: Server...
8/7/2019 9:49:55 AM - Copying: C:\Users\Michael\Dev\windows-openstack-imaging-tools\UnattendResources E:\UnattendResources
8/7/2019 9:49:55 AM - Resources have been copied.
8/7/2019 9:49:55 AM - Copy Custom Resources: ...
8/7/2019 9:49:55 AM - Custom Resources at: E:\UnattendResources.
8/7/2019 9:49:55 AM - Setting wallpaper...
8/7/2019 9:49:55 AM - Wallpaper GPO copied to the image.
8/7/2019 9:49:55 AM - Wallpaper was set.
8/7/2019 9:49:55 AM - Downloading Cloudbase-Init...
8/7/2019 9:51:04 AM - Applying Windows image "D:\Sources\install.wim" in "E:\"

Deployment Image Servicing and Management tool
Version: 10.0.17763.1

Applying image
[==========================100.0%==========================]
The operation completed successfully.
8/7/2019 9:58:34 AM - Create BCDBoot Config for Windows Server 2019 SERVERSTANDARD
The operation completed successfully.
The operation completed successfully.
The operation completed successfully.
8/7/2019 9:58:37 AM - BCDBoot config has been created.
8/7/2019 9:58:39 AM - Cloud image generation finished.
8/7/2019 9:58:39 AM - Creating VM WindowsOnlineImage-Sysprep2078383705 attached to external
8/7/2019 9:58:41 AM - Starting WindowsOnlineImage-Sysprep2078383705

at this point i rdp into the virtual machine and see this in an open powershell script:

Exception from HRESULT: 0x8024402C at System.Management.Automation.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, ComMethodDesc method, Object[] args, UInt32 argErr) at CallSite.Target(Closure , CallSite , ComObject , String ) at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

The device has no internet access, not sure if that is a result of sysprep removing drivers before this step.

mafischer commented 5 years ago

This issue is caused by the virtual machine not having network access. My host machine has a static ip based on it's mac address. When the dhcp server see's a dhcp request coming from the virtual machine, it tries to configure it with same ip as the host machine...

ader1990 commented 5 years ago

I saw this issue on Windows 10 hosts with HyperV installed. The virtual machine IP is the same as the host machine, although the virtual machine has another MAC address. Try setting a bridged virtual switch or a static IP in the virtual machine using the hooks for the imaging tools: https://github.com/cloudbase/windows-openstack-imaging-tools/blob/master/Config.psm1#L74

Kuanlin-Chen commented 4 years ago

@mafischer How did you solve it? My problem is very similar to yours, the script stuck on Waiting WindowsOnlineImage-Sysprep2078383705, if I open the vm (while stuck on waiting) through Hyper-V Manager, it will move on and finish its jobs, why?

mafischer commented 4 years ago

I logged into the vm and changed the ip address manually.

ader1990 commented 4 years ago

Closing the issue, as there was no recent response / activity.