How do I recover from "repair pending" error in SFC?

10

4

I am trying to fix an issue with Windows registry and services. I tried running sfc command but this is the error message I get?

C:\Windows>sfc /scannow

Beginning system scan.  This process will take some time.    

There is a system repair pending which requires reboot to complete.  Restart
Windows and run sfc again.

C:\Windows>

But I have rebooted several times since this message first appeared, and I even tried running the command in safe mode and in console mode but I still get the same message. How do I get rid of it?

There is this file in winsxs folder: C:\Windows\winsxs\cleanup.xml

This is it's content:

<?xml version='1.0' encoding='utf-16'?>
<PendingTransaction >
    <POQ postAction="NoReboot">
        <DeleteFile path="\??\D:\$$DeleteMe.CbsMsg.dll.01c85bd2f5893b40.0000"/>
    </POQ>
</PendingTransaction>

Could this be something? Is this the cause? Is it safe to delete this file?

Update

I tried renaming it but the operation failed.

I ran the explorer.exe with elevated privileges and navigated to the location. I got the UAC confirmation prompt and then the error below.

Destination Folder Access Denied
You need permission to perform this action

How do I rename or delete this file? Do I need to use cmd or be in safe mode to do it?

Update 2

I started safe mode with command prompt and tried taking ownership of the file and then renaming it. Rename failed.

C:\Windows\winsxs>ren cleanup.xml cleanup.xml.old
Access is denied.

C:\Windows\winsxs>takeown /f "cleanup.xml"

SUCCESS: The file (or folder): "C:\Windows\winsxs\cleanup.xml" now owned by user
 "mycomputername\username".

C:\Windows\winsxs>ren cleanup.xml cleanup.xml.old
Access is denied.

C:\Windows\winsxs>

I also issued following command.

C:\Windows\system32>icacls "C:\Windows\winsxs\cleanup.xml" /grant username:F
processed file: C:\Windows\winsxs\cleanup.xml
Successfully processed 1 files; Failed processing 0 files

C:\Windows\system32>cd ..\winsxs

C:\Windows\winsxs>ren cleanup.xml cleanup.xml.old
Access is denied.

C:\Windows\winsxs>

It still won't allow me to rename it. I issued these last two commands in normal Windows mode. Does it matter?... I will try a reboot.

Samir

Posted 2013-06-16T19:55:17.873

Reputation: 17 919

I am having the same issue, but I do not have a cleanup.xml file, so I don't think that is the cause. – BlueRaja - Danny Pflughoeft – 2015-07-08T07:56:18.240

@BlueRaja As I recall, it did have something to do with cleanup, but you may not need to have this file to know that you have this problem. Have a look at the second answer. The registry trick may work for you. I ended up doing a repair install if I remember correctly. So I didn't get to try that. – Samir – 2015-07-08T10:48:57.873

Problem solved, by performing a repair install.

– Samir – 2013-06-18T10:25:28.303

Answers

12

I have the same issue in Windows 7. I finally got sfc to run using the following commands from the repair console (for some reason, it assigned D: to my main disk, rather than C:)

del d:\windows\winsxs\pending.xml
del x:\windows\winsxs\pending.xml
sfc /scannow /offbootdir=D:\ offwindir=D:\Windows

(However, sfc now tells me

Windows Resource Protection found corrupt files but was unable to fix some of them.

so this did not fix my startup issues)

BlueRaja - Danny Pflughoeft

Posted 2013-06-16T19:55:17.873

Reputation: 7 183

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question.

– CharlieRB – 2015-07-10T17:02:35.017

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Ramhound – 2015-07-10T18:09:40.117

1@CharlieRB and Ramhound: huh? Yes, it absolutely does answer the question. The question is "How do you force SFC to run when it gives this error?" I provided the solution I used to force SFC to run when that same thing happened to me. It did not in fact solve my underlying problem, but that is tangential to the question, which is why I only mentioned it at the end (and provided a link to another thread, to help others like me) – BlueRaja - Danny Pflughoeft – 2015-07-10T18:11:47.143

@BlueRaja - You having issues is irrelevant to the author's question though. In other words the second part of the answer is sort of irrelevant to sammyg's problem. How is linking to your own question relevant to how you delete pending.xml ( it isn't ). – Ramhound – 2015-07-10T19:01:36.747

1@Ramhound: Yes, I already said that. However, since there are likely others on the Internet with my same issue, who will find this page through Googling like I did, I added extra related information to point them in the right direction (which is an extremely common courtesy on this site). I don't understand how you could possibly take fault with that. Regardless, I've parenthesized it now, so there's no way someone could confuse it as a necessary part of the answer. – BlueRaja - Danny Pflughoeft – 2015-07-10T19:13:57.613

@BlueRaja - There are multiple votes on this answer that agree with the reason, I am not alone, I just explained myself. I still maintain your related information has no business being in an answer, and until its removed, I won't vote on the answer. Personally, I am moving on from this answer, I honestly have nothing else to say about the matter. – Ramhound – 2015-07-10T21:16:45.180

This question allowed me to get past being stuck on sfc /scannow /offbootdir=c:\ /offwindir=c:\windows issues. It kept saying pending repair – Jpepper – 2019-08-16T23:29:20.960

4

This command is supposed to do it.

dism.exe /image:C:\ /cleanup-image /revertpendingactions

But this only works in Windows 7 or newer. I don't have the dism.exe tool in Windows Vista. I just thought I would share it with those who find this question and who do have Windows 7. I was of course unable to test this myself, but this guy says he was able to remove this annoying error message out of the world. So it might be worth a try.

Samir

Posted 2013-06-16T19:55:17.873

Reputation: 17 919

When I run this command from the repair prompt, I just get Error 0x80029c4a - The request is not supported :( – BlueRaja - Danny Pflughoeft – 2015-07-08T07:47:13.087

What version of Windows is it? – Samir – 2015-07-08T10:42:28.963

Windows 7 Professional Edition (obtained legally through MSDN) – BlueRaja - Danny Pflughoeft – 2015-07-08T20:30:26.597

I am not too sure this is the same issue then. I was using Windows Vista. As I recall, my original problem was with the Windows Audio service. It was not starting for reasons I cannot recall now. So I had no sound. I was attempting to repair it, but this gave me a new problem. This question describes that new problem. So I do not know what led you to this problem. All solutions found on this site are on "as is" basis. Don't follow every step blinedly without adapting them to your specific problem. – Samir – 2015-07-09T07:47:49.150

@sammyg - This particular command requires a specific Windows 7 update. Might be useful to specify which one it is, since, the lack of that information has led to confusion 2 years later. – Ramhound – 2015-07-10T18:08:35.487

@Ramhound: What confusion? The command is found (and my computer is fully updated), it just errors out. – BlueRaja - Danny Pflughoeft – 2015-07-10T18:26:09.783

From my Windows 7 installation boot CD I can only get to a command prompt after "Repair your computer" which re-creates the condition that we want to get rid of. How to get out of this stupid cycle? – user250343 – 2018-05-19T16:05:17.267

0

look in the registry under SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing if you see a key called RebootPending. This is the place where Windows also checks if there is a pending reboot.

magicandre1981

Posted 2013-06-16T19:55:17.873

Reputation: 86 560

In HKLM (local machine)?... – Samir – 2013-06-17T09:46:05.130

Yeah, I have HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending and it contains only the default string value, and it's not set to anything. Should I set it to 0 or something? Or maybe remove the key? – Samir – 2013-06-17T09:49:09.847

"Cannot delete RebootPending: Error while deleting key." – Samir – 2013-06-17T10:18:38.867

1

take ownership of the key: http://winaero.com/comment.php?comment.news.210 and now delete it.

– magicandre1981 – 2013-06-17T14:40:32.817

Thanks! I will download that reg tool, I'm sure it will come in handy sometime. So it's probably good to have it in the toolbox. – Samir – 2013-06-18T10:23:59.393

-1

This worked for me:

sfc /SCANNOW /OFFBOOTDIR=c:\ /OFFWINDIR=d:\Windows

Source: http://blog.crosbydrive.com/?p=339

davidh

Posted 2013-06-16T19:55:17.873

Reputation: 1