Tuesday, May 24, 2016

The problem while uprgading Windows Server 2016 TP4 to TP5 (BCD is invalid or corrupted)

I've got an error while upgrading Windows Server 2016 Technical Preview 4 (TP4) to Tech Preview 5 (TP5):

Something happened. Windows Server 2016 Technical Preview 5 installation has failed


Advanced error description can be found in the file:
C:\$WINDOWS.~BT\Sources\Panther\setuperr.log

In my case the file setuperr.log has the following content:

...
Error                 IBSLIB OSRollbackService::CBootFilesRestoreCheckpoint::Finalize: Failed to backup BCD database from "G:\Boot\BCD" to "C:\$WINDOWS.~BT\Sources\Rollback\Boot\BCD".[gle=0x00000006]
Error      [0x064199] IBSLIB SetCheckpoint(WinPEBootFilesRestoreCheckpoint): threw exception.: class RollbackException: RollbackException: Error(6), CSystemVolumeSelectionCheckpoint: Failed to backup BCD database. void __cdecl OSRollbackService::CBootFilesRestoreCheckpoint::Finalize(const unsigned short *,struct OSRollbackService::ICheckpointParameters *)[gle=0x00000006]
Error      [0x06418a] IBSLIB RollbackSetCheckpoint(WinPEBootFilesRestoreCheckpoint): threw exception.: class RollbackException: RollbackException: Error(6), CSystemVolumeSelectionCheckpoint: Failed to backup BCD database. void __cdecl OSRollbackService::CCheckpointImpressario::SetCheckpoint(const unsigned short *,struct OSRollbackService::ICheckpointParameters *)
void __cdecl OSRollbackService::CBootFilesRestoreCheckpoint::Finalize(const unsigned short *,struct OSRollbackService::ICheckpointParameters *)[gle=0x00000006]
Error      [0x06414e] IBSLIB RollbackSetCheckpoint(WinPEBootFilesRestoreCheckpoint) failed. Disabling Rollback.[gle=0x00000006]
Error                 SP     Error setting OS Switch Rollback checkpoint[gle=0x00000006]
Error                 SP     Operation failed: Update Boot Code. Error: 0x80004005[gle=0x000000b7]
Error                 MOUPG  MoSetupPlatform: Finalize reported failure![gle=0x000000b7]
Error                 MOUPG  MoSetupPlatform: Using action error code: [0x80004005][gle=0x000000b7]
Error                 MOUPG  CDlpActionFinalize::ExecuteSetupPlatformFinalize(1314): Result = 0x80004005[gle=0x000000b7]
Error                 MOUPG  CDlpActionFinalize::ExecuteRoutine(479): Result = 0x80004005
Error                 MOUPG  CDlpActionImpl > > >::Execute(441): Result = 0x80004005
Error                 MOUPG  CDlpTask::ExecuteAction(3243): Result = 0x80004005
Error                 MOUPG  CDlpTask::ExecuteActions(3397): Result = 0x80004005
Error                 MOUPG  CDlpTask::Execute(1631): Result = 0x80004005
Error                 MOUPG  CSetupManager::ExecuteTask(2041): Result = 0x80004005
Error                 MOUPG  CSetupManager::ExecuteTask(2004): Result = 0x80004005
Error                 MOUPG  CSetupManager::ExecuteInstallMode(807): Result = 0x80004005
Error                 MOUPG  CSetupManager::ExecuteDownlevelMode(392): Result = 0x80004005
Error                 SP     CSetupPlatform::ResurrectNewSystem: Cannot resurrect new system.: Win32Exception: \\?\C:\$Windows.~BT\Sources\NewSystem.dat: The system cannot find the file specified. [0x00000002] __cdecl UnBCL::FileStream::FileStream(const class UnBCL::String *,enum UnBCL::FileMode,enum UnBCL::FileAccess,enum UnBCL::FileShare,unsigned long)[gle=0x00000002]
Error                 MOUPG  CSetupManager::Execute(236): Result = 0x80004005
Error                 MOUPG  CSetupHost::Execute(371): Result = 0x80004005

The main reason of upgrade failure is the corrupted file G:\Boot\BCD (where drive G: is primary partition with 'System Reserved' label).

BCDEdit /store g:\boot\BCD {bootmgr} device unknown
 Partition table - 'System Reserved' partition is active



The easiest solution to fix invalid or corrupted BCD file is to create new BCD file on any other primary partition or flash drive and try to run upgrade again. In my case partition C: is primary partition, so I can make it bootable and mark as active.
  • Step 1: creating new BCD file, making C: drive bootable
    - Open "Command Prompt (Admin)"
    - Run the command:
    bcdboot %windir% /s C: /f ALL
  • Step 2: marking C: partition as active
    - Run "Disk Management"
    - Select (C:) partition and choose "Mark Partition as Active" in context menu.
Partition table, marking C: partition as active

Now the system should be rebooted... And then everything is ready to run TP5 upgrade again. In my case upgrade was successful even though there were some other errors in setuperr.log file. So these errors do not cause setup/upgrade failure and can be ignored:

Error                 MOUPG  ProductKey: Valid product key found = [TRUE].
Error                 CONX   Failed to get inf path SYSTEM\CurrentControlSet\Control\Network\{4d36e975-e325-11ce-bfc1-08002be10318}\{53565350-564d-0000-5f3f-d83712cde83d}
Error                 CONX   Failed to add net component 80070002
Error                 CONX   Failed to get inf path SYSTEM\CurrentControlSet\Control\Network\{4d36e974-e325-11ce-bfc1-08002be10318}\{e9b59cfa-2be1-4b21-828f-b6fbdbddc017}
Error                 CONX   Failed to add net component 80070002
Error                 CONX   Failed to open inf key SYSTEM\CurrentControlSet\Control\Network\{6bdd1fc5-810f-11d0-bec7-08002be2092f}\{22a2abca-b9e0-406c-86df-18bdc2f853d2}
Error                 CONX   Failed to add net component 80070002
Error                 CONX   Windows::Compat::Appraiser::Utilities::SendRequest (1072):   Failed to connect to the internet or send request: [12002].[gle=0x80072ee2]
Error                 CONX   Windows::Compat::Appraiser::Utilities::ResolveForwardLink (1132):   Failed to send request using default proxy[gle=0x80072ee2]
Error                 CONX   Windows::Compat::Appraiser::Utilities::SendRequest (1072):   Failed to connect to the internet or send request: [12002].[gle=0x80072ee2]
Error                 CONX   Windows::Compat::Appraiser::Utilities::ResolveForwardLink (1138):   Failed to send request using auto proxy[gle=0x80072ee2]
Error                 CONX   Windows::Compat::Appraiser::Utilities::ExtractCosConnectionString (411):   Failed to resolve forward link: [0x80072ee2].[gle=0x80072ee2]
Error                 CONX   Windows::Compat::Appraiser::CosDeviceDataSource::PrefetchData (489):   Could not resolve COS FwLink: [0x80072ee2].[gle=0x80072ee2]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WriteProperty (598):   Could not write property value [gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WritePropertyList (550):   Could not write property in Inventory [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::GetAndWritePropertyList (716):   Failed to write asset property list for Inventory [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WriteAsset (679):   Could not get and write Inventory property list: [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WriteAssets (650):   Failed writing asset [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::OutputEverything::DoOutput (235):   Writing Assets failed: [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WriteProperty (598):   Could not write property value [gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WritePropertyList (550):   Could not write property in Inventory [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::GetAndWritePropertyList (716):   Failed to write asset property list for Inventory [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WriteAsset (679):   Could not get and write Inventory property list: [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::XmlUtils::WriteAssets (650):   Failed writing asset [0xc00cee2b].[gle=0xc00cee2b]
Error                 CONX   Windows::Compat::Appraiser::OutputEverything::DoOutput (235):   Writing Assets failed: [0xc00cee2b].[gle=0xc00cee2b]
Error      [0x080831] MIG    CSIAgent: Invalid xml format: FormatException: "id" attribute is mandatory. void __cdecl Mig::CMXEMigrationXml::LoadSupportedComponent(class UnBCL::XmlNode *,int,class Mig::CMXEMigrationXml *,class Mig::CMXEXmlComponent *)
Error                 CSI    00000001 (F) 80220008 [Error,Facility=FACILITY_STATE_MANAGEMENT,Code=8] #64443# from CWcmScalarInstanceCore::GetCurrentValue(options = 393216 (0x00060000), status = [6]"(null)", value = { type: 40972 (0x0000a00c), bytes ( 12 (0x0000000c) ): 65006e002d00550053000000 })
[gle=0x80004005]
Error                 CSI    00000002 (F) 80220008 [Error,Facility=FACILITY_STATE_MANAGEMENT,Code=8] #142487# from CWcmScalarInstanceCore::GetCurrentValue(options = 393216 (0x00060000), status = [6]"(null)", value = { type: 40972 (0x0000a00c), bytes ( 12 (0x0000000c) ): 65006e002d00550053000000 })
[gle=0x80004005]
Error                 CSI    00000003 (F) 80220008 [Error,Facility=FACILITY_STATE_MANAGEMENT,Code=8] #238311# from CWcmScalarInstanceCore::GetCurrentValue(options = 393216 (0x00060000), status = [6]"(null)", value = { type: 40972 (0x0000a00c), bytes ( 12 (0x0000000c) ): 65006e002d00550053000000 })
[gle=0x80004005]
Error      [0x080831] MIG    CSIAgent: Invalid xml format: FormatException: Component with display name: Plugin/{C939EC0F-2F56-4CE8-AF56-2336596A5FA7} already loaded __cdecl Mig::CMXEMigrationXml::CMXEMigrationXml(class Mig::CPlatform *,class UnBCL::String *,class UnBCL::XmlDocument *,class UnBCL::String *,class UnBCL::String *)
Error                        CSetupAutomation::Resurrect: File not found: C:\$WINDOWS.~BT\Sources\Panther\automation.dat[gle=0x00000002]
Error                 SP     CSetupPlatform::ResurrectAutomation: Failed to resurrect automation: 0x80070002[gle=0x00000002]

UPD1: There can be similar upgrade errors, which can be fixed using recommendations above:
Error                 SP     CAddSafeOSBootEntry::ConfigureImageForRAMBoot: Failed to open {bootmgr}. Status = -1073741772[gle=0x000000b7]
Error                 SP     CAddSafeOSBootEntry::DoExecute: Failed to configure image for RAM boot. Status = -1073741772[gle=0x000000b7]
Error                 SP     Operation failed: Add safe OS boot entry. Error: 0xD0000034[gle=0x000000b7]

UPD2: The second way to fix the issue is to repair BCD using Microsoft Recovery Environment. Look here: http://support.microsoft.com/kb/927392/en-us.
  • attrib c:\boot\bcd -s -h -r
  • ren c:\boot\bcd bcd.old
  • bootrec /RebuildBCD
Good luck.