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

98,365

Solution 1

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)

Solution 2

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.

Share:
98,365

Related videos on Youtube

Samir
Author by

Samir

Tell me and I forget. Teach me and I remember. Engage me and I learn.

Updated on September 18, 2022

Comments

  • Samir
    Samir almost 2 years

    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
    Samir about 11 years
    In HKLM (local machine)?...
  • Samir
    Samir about 11 years
    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
    Samir about 11 years
    "Cannot delete RebootPending: Error while deleting key."
  • magicandre1981
    magicandre1981 about 11 years
    take ownership of the key: winaero.com/comment.php?comment.news.210 and now delete it.
  • Samir
    Samir about 11 years
    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.
  • BlueRaja - Danny Pflughoeft
    BlueRaja - Danny Pflughoeft almost 9 years
    When I run this command from the repair prompt, I just get Error 0x80029c4a - The request is not supported :(
  • Samir
    Samir almost 9 years
    What version of Windows is it?
  • BlueRaja - Danny Pflughoeft
    BlueRaja - Danny Pflughoeft almost 9 years
    Windows 7 Professional Edition (obtained legally through MSDN)
  • Samir
    Samir almost 9 years
    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.
  • Ramhound
    Ramhound almost 9 years
    @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
    Ramhound almost 9 years
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
  • BlueRaja - Danny Pflughoeft
    BlueRaja - Danny Pflughoeft almost 9 years
    @Ramhound: What confusion? The command is found (and my computer is fully updated), it just errors out.
  • Ramhound
    Ramhound almost 9 years
    @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 ).
  • BlueRaja - Danny Pflughoeft
    BlueRaja - Danny Pflughoeft almost 9 years
    @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.
  • Ramhound
    Ramhound almost 9 years
    @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.
  • user250343
    user250343 about 6 years
    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?
  • Jpepper
    Jpepper almost 5 years
    This question allowed me to get past being stuck on sfc /scannow /offbootdir=c:\ /offwindir=c:\windows issues. It kept saying pending repair