microsoft / MSLab

Azure Stack HCI, Windows 10 and Windows Server rapid lab deployment scripts
MIT License
1.17k stars 280 forks source link

Updating from Server 2022 to Server 2025 fails due to limited RAM #580

Open michbern-ms opened 3 months ago

michbern-ms commented 3 months ago

This issue originally came as: ISSUE - Hyper-V VM In-Place Upgrade (IPU) WS 2022 to WS 2025 b26063 fails - Microsoft Community Hub

My developed repro steps are:

EXPECTED: Upgrade should work.

ACTUAL: It rolls back to Server 2022.


#basic config for Windows Server 2022, that creates VMs for S2D Hyperconverged scenario https://github.com/Microsoft/MSLab/tree/master/Scenarios/S2D%20Hyperconverged

$LabConfig=@{AllowedVLANs="1-10,711-719" ; DomainAdminName='LabAdmin'; AdminPassword='LS1setup!' ; DCEdition='4'; Internet=$true ; TelemetryLevel='Full' ; TelemetryNickname='' ; AdditionalNetworksConfig=@() ; SecureBoot=$true ; VMs=@() ; CustomDnsForwarders=@("1.1.1.1","1.0.0.1")}

#Azure Stack HCI 22H2
#1..2 | ForEach-Object {$LABConfig.VMs += @{ VMName="AzSHCI$_" ; Configuration='S2D' ; ParentVHD='AzSHCI22H2_G2.vhdx' ; HDDNumber=4 ; HDDSize=1TB ; MemoryStartupBytes=1GB; VMProcessorCount=4 ; vTPM=$true}}

#Azure Stack HCI 22H2 with nested virtualization
#1..2 | ForEach-Object {$LABConfig.VMs += @{ VMName="AzSHCI$_" ; Configuration='S2D' ; ParentVHD='AzSHCI22H2_G2.vhdx' ; HDDNumber=4 ; HDDSize=1TB ; MemoryStartupBytes=32GB ; VMProcessorCount=8 ; vTPM=$true ; NestedVirt=$true}}

#Windows Admin Center in GW mode
$LabConfig.VMs += @{ VMName = 'WACGW' ; ParentVHD = 'Win2022Core_G2.vhdx'; MGMTNICs=1}

#Management machine
$LabConfig.VMs += @{ VMName = 'Management' ; ParentVHD = 'Win2022_G2.vhdx'; MGMTNICs=1}
michbern-ms commented 3 months ago

My investigation found that the update failed because the in-place upgrade is failing to allocate a large enough block of RAM (about 500MB) to set up the ramdisk needed to do the upgrade.

Setting the minimum RAM for the VM to 2048 MB solved the problem.

This is consistent with the minimum RAM documented here: https://learn.microsoft.com/en-us/windows-server/get-started/hardware-requirements?tabs=cpu

Karl-WE commented 3 months ago

Appreciate your investigation and all the time spent! the specific one to change is the startup RAM from 512MB to 2048 MB (or 2GB). I will try out if this also works with startup RAM of 1GB and if there is any change between 2019 > 2022 IPU behaviour and 2022 > 2025 IPU behaviour.

Karl-WE commented 2 months ago

Checking with mslab24.04, the startup ram and minimum RAM is ok for the hydrated Domain Controller. @jaromirk I would like to suggest to review the 3_Deploy.ps1 to raise the bar for additional VMs by default.

If not specified in Labconfig, it defaults to 512 MB which is too low for Windows Server with Desktop Experience. 2048 MB is required to avoid issues.

I have no tried if 512MB is enough for Core. Adding the distinguished Edition Core or GUI into the code would require "loosy" checks on the filename of the parentdisk specified in labconfig. This could be prone for failures if users choose different naming for parent files.

MemoryStartupBytes= 512MB; # Startup memory size

proposed fix: https://github.com/microsoft/MSLab/pull/590

Reference, see information box: https://learn.microsoft.com/en-us/windows-server/get-started/hardware-requirements?tabs=ram

Thank you for your investigation and assistance @michbern-ms!