Windows Server 2012 R2 randomly hangs, error code 0xc000021a [boot loop]

Copper Contributor

Operations carried out:

* Boot to Safe Made [just reboots with 0xc000021a]
* Boot to Safe Made with networking [just reboots with 0xc000021a]
* Boot to Safe Made with Command Prompt [just reboots with 0xc000021a]
• Disable Automatic Restart after Error [just reboots with 0xc000021a]
• Boot to Last Known Good Configuration [just reboots with 0xc000021a]
* Disable driver signature enforcement

• I deleted C:\windows\winsxs\pending.xml [GOOD]
• Ran dism.exe /image:C:\ /cleanup-image /revertpendingactions [GOOD]
• Ran sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows [GOOD]
* Ran chkdsk c: /r [GOOD]
* Boot [just reboots with 0xc000021a]

* Ran: bootrec /fixmbr [GOOD]
* Ran: bootrec /fixboot [GOOD]
* Ran: bootrec /RebuildBcd with attrib bcd -s -h -r // ren c:\boot\bcd bcd.old // bcdedit /export C:\BCD_Backup [GOOD]
* Restart server with 0xc000021a

Sometimes I get the screen (Preparing Automatic Repair) but it does nothing.

I can't perform an "over-install" because it gives me this error: The Computer Started using the Windows Installation Media

I restore C:\Windows\System32\config\RegBack to C:\Windows\System32\config but reboots with 0xc000021a

Can you think of something to raise the server?

1 Reply



Hello ThorElPoderoso,



The Error code 0xc000021a is because of the boot loop of the server, and your machine can run into a reboot loop with a "We couldn't complete the updates" message after the update.


Before fixing the issue, we will go through the factors responsible for the Windows Server 2012 boot loop,

  • Update failure.
  • The Corrupted RAM sticks.
  • Obsolete drivers.
  • Bad Registry entries.
  • Hard drive issues.


The above could be a reason for the server to hang and give error code 0xc000021a [boot loop].


In order to fir this issue, you have to unplug all peripheral devices, roll back drivers or disable Automatic Restart at first. In addition, if boot failure still exists, you may need to access Command Prompt and then revert pending updates, restore the system registry, scan system files, and rebuild BCD.


Run the DISM command to revert all pending updates:


mkdir c:\scratch (The command helps to create a new directory called Scratch)

dism /image:c:\ /scratchdir:c:\scratch /cleanup-image /revertpendingactions


After reverting the changes, exit from Command Prompt and restart your machine from the system hard drive.


Restore bad registry from Regback:


If the boot issue is related to missing or corrupted system registry files, you can follow the steps below to restore system registry files from backup.


Firstly, confirm your system drive whether there are Progam Files, Users is present or not.


Then, in the command prompt, type 

copy c:windowssystem32configRegBack*d:windowssystem32config and press Enter. 


Note:  If your system's drive is not c, replace "c" with the corresponding drive letter.


Scan and replace corrupted system files:


You should consider scanning the integrity of all protected system files and repairing the corrupted by typing the following command "sfc/scannow" and pressing Enter.


Check boot volume and fix the error:


There are possibilities that Server 2012 not booting smoothly with BOSD can be caused by corrupted boot volume.

Firstly, you will have to type "chkdsk c:/f/r," and press Enter key to fix errors on the boot volume.

Nextly, you will be prompted to message that "Chkdsk cannot run because the volume is in use." Finally, you should type "Y" and hit Enter key to force a dismount on this volume.


Run Bootrec.exes to repair MBR:


Sometimes, the boot failure occurs due to corrupted MBR. You will have to scan and run the below commands to repair it.

  • bootrec.exe /fixmbr (This command will fix MBR by writing a new Windows-compatible MBR but not overwrite existing partitions)
  • bootrec.exe /fixboot (This command is used to write a new boot sector on the hard disk if Windows detect damage)
  • bootrec.exe /scanos (scans your operating system)
  • bootrec.exe /rebuildbcd (This command rebuilds BCD that contains boot information and partition parameters)


I hope this information helps you to deal with Windows Server 2012 R2 boot loop problem.


Note: I recommend you to clone the Windows Server 2012 R2 disk as a backup or backup operating system in advance.