Monday, March 10, 2014

Windows System File Checker in Repair Mode - and Fixing the Pending Repair Error

If you're just looking for how to fix the "Pending Repair" error, scroll straight down.

The System File Checker (SFC) feature in Windows is an automated utility that scans Windows system files for possible corruption, and replaces damaged or missing files. Malware or even power outages can damage such files, and running the following code in the command line can sometimes be a quick remedy for BSODs (Blue Screen of Death) and other crashes.
sfc /scannow
If your machine is all good, it should display the following. If not, it should fix the problems and create a status report.
Windows Resource Protection did not find any integrity violations.
Now, that's all good if only you could actually boot into Windows or Safe Mode. I couldn't (it crashed every time at "Starting Windows"), so I had to use Repair Mode. That in itself is quite simple - continously tap F8 when the BIOS image loads up, then choose "Repair Your Computer". Log in, and then click on "Command Prompt" in the System Recovery Options menu.

System Recovery Options

Once you've opened the prompt, you may have noticed that the drive letter is not set at C:\ like it normally is in Windows, but rather at X:\. That is the virtual drive Windows creates when booting in recovery. We need to find out our "real" drive by entering the following commands:
list volume
You should then see something similar to this:
Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
----------  ---  -----------  -----  ----------  -------  ---------  --------
Volume 0     E                       DVD-ROM         0 B  No Media
Volume 1     C   HDD          NTFS   Partition   1397 GB  Healthy    
Volume 2     D   Primary SSD  NTFS   Partition     55 GB  Healthy
By looking at the drive label and size, we can distinguish the letter of our system drive. In my case, my "Primary SSD" was switched from its original letter (C) to (D). Once you've found your drive, enter the following code (replace D: with your drive letter):
sfc /scannow /offbootdir=D:\ /offwindir=D:\windows
If you just ran sfc /scannow directly, it would scan the virtual drive and not your real drive for errors. Using offbootdir and offwindir aims the scanner towards the true directory, where your corrupted files are.

That's all good - unless you get the following error.
There is a system repair pending which requires reboot to complete. Restart Windows and run sfc again.
Of course, I rebooted and got the same message. Other sources told me to rename the files pending.xml  and reboot.xml from C:\Windows\winsxs, but I didn't have the pending.xml file (and getting rid of reboot.xml did absolutely nothing).

The trick here is to not rename the pending.xml file on the real system drive, but rather take care of the one in the "virtual" X:\ drive used in Repair Mode. Try the following code, and run SFC again. It should then work.
cd X:\Windows\winsxs
ren pending.xml pending.xml.old
I think this works since the problem lies in the virtual system itself. If you run a regular sfc /scannow (without the offbootdir flag, meaning that it's scanning the virtual drive) the problem persists. Renaming pending.xml fixes the problem for all drives, and allows you to scan the files for possible corruption. SFC can't solve everything, but it's worth a try. It's way faster and easier than a full reinstall.
Back To Top