Server 2012: Stuck at “Updating your System 8%”

Server 2012: Stuck at “Updating your System 0%”

The Scenario:

One of my Windows Server 2012 R2 Standard servers installed a large number of updates +200 all at once (so unfortunately I’ve no idea which one caused this problem).

The Problem:

After the reboot the server was stuck on the start-up splash screen stating “Updating your system 8%”. I tried the following

  • Waiting several hours
  • Rebooting
  • Rebooting in Safe Mode (press F8 immediately as the server boots to access this boot option)
  • Rebooting using Last Known Good Configuration (press F8 immediately as the server boots to access this boot option)

None of the above worked.

The Solution:

  1. Reboot the server, press F8 to access advanced boot options
  2. Select the Option “Repair Your Computer”
  3. In the Options screen select Troubleshoot > Command Prompt
  4. The server boots into a limited command prompt at the X drive.
  5. Get a list of all the available drives, type “wmic logicaldisk get name“. This is important as whilst in the repair environment the drive mappings often get changed around i.e. I was panicking when I changed to the C drive only to find it was empty. In fact the system drive was mapped to the D drive. There’s no obvious way to tell, you just have to change to each drive mapping a run a Dir command.
  6. Navigate to the <System Drive>\Windows\Winsxs folder. Once here you need to find all the files called pending.xml* and rename them all by adding .OLD to the end of the file name. (In my server I had two pending.xml and pending.xml.random_number – I added .OLD to the end of both of these). The reason for this is it’s in one of these there is a corruption that’s the cause of the problem.
  7. Create a new blank pending.xml file in the <System Drive>\Windows\Winsxs folder; echo > pending.xml
  8. Next up is to run a DISM command to remove/revert all pending actions from the image, in our case these updates attempting to install. However before doing so you must create a scratch folder for the temporary files to be stored in. If you don’t complete this step you will get a 3017 error, which complains the default temporary location for the scratch folder is too small. Create the scratch folder in the <System Drive>\Windows directory; mkdir <System Drive>\windows\scratch
  9. Run the following command (NB my system drive was mapped to the D drive);    DISM /Image:D:\ /Cleanup-Image /RevertPendingActions /scratchdir:D:\Windows\Scratch
  10. Once complete rename the <System Drive>\windows\SoftwareDistribution to SoftwareDistributionOLD; ren D:\windows\SoftwareDistribution SoftwareDistributionOLD
  11. Finally, run sfc /scannow – the System File Checker tool to repair missing or corrupted system files
  12. Reboot the server. The start-up splash screen should show spinning dots for a minute or two then boot normally. In my instance it then reported updates couldn’t be installed and so reverted those that had been installed. It then forced another reboot.
  13. At this stage the server is ready to have updates installed, but this time only do a few at a time to locate the faulty update.