How to Repair Corrupt System Files from a Installation Disc

I'm using Windows 8.1 x64, build 6.3.9600.16384, using the Command Prompt with administrator privileges.

sfc /scannow

returns:

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

and

dism /online /cleanup-image /restorehealth

returns:

Error: 0x800f0906
The source files could not be downloaded.

(and the Windows Update Service is not able to start because those files are missing.)

also tried

dism /online /cleanup-image /restorehealth /source:wim:F:\sources\install.wim:1 /limitaccess

and returned:

Version: 6.3.9600.16384
Image Version: 6.3.9600.16384
Error: 0x800f081f
The source files could not be found.

I mounted the image, and tried from there.

dism /mount-image /imagefile:F:\sources\install.wim /index:1 /mountdir:C:\offline

dism /online /cleanup-image /restoreHealth /source:c:\offline /limitaccess

also returning:

Error: 0x800f081f

How do I repair the Corrupt System Files?

Can I tell DISM to use the Windows installation disc as the source?


Filtering the details

Running the sfc /scannow will produce a CBS.log report file (usually found in C:\Windows\Logs\CBS) which contains a wealth of information. In order to get the juicy bits, open a command prompt, and execute this command:

findstr /i /c:"[SR]" "%windir%\Logs\CBS\CBS.log" | findstr /i /v /c:"verify" > "%userprofile%\Desktop\sfc.txt"

The above command will:

  1. Get all lines in the original file containing [SR], which are the ones that track the repair attempts.

  2. Remove all lines containing verify from what we got in the previous step in order to further reduce the clutter.

  3. Write the results in the sfc.txt file for later analysis.

In this case, this would be the resulting file:

2014-02-19 17:08:47, Info                  CSI    0000008b [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-Main, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:08:49, Info                  CSI    0000008c [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-Main, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:08:49, Info                  CSI    0000008d [SR] This component was referenced by [l:154{77}]"Package_1_for_KB2914218~31bf3856ad364e35~amd64~~6.3.1.3.2914218-1_neutral_GDR"
2014-02-19 17:08:51, Info                  CSI    00000091 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:08:53, Info                  CSI    00000092 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:08:53, Info                  CSI    00000093 [SR] This component was referenced by [l:154{77}]"Package_1_for_KB2914218~31bf3856ad364e35~amd64~~6.3.1.3.2914218-1_neutral_GDR"
2014-02-19 17:08:56, Info                  CSI    00000097 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-MediaViewerDistributed-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:08:57, Info                  CSI    00000098 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-MediaViewerDistributed-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:08:57, Info                  CSI    00000099 [SR] This component was referenced by [l:154{77}]"Package_1_for_KB2914218~31bf3856ad364e35~amd64~~6.3.1.3.2914218-1_neutral_GDR"
2014-02-19 17:23:00, Info                  CSI    00000975 [SR] Repairing 3 components
2014-02-19 17:23:00, Info                  CSI    00000977 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-Main, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    00000978 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    00000979 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-MediaViewerDistributed-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    0000097a [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    0000097b [SR] This component was referenced by [l:154{77}]"Package_1_for_KB2914218~31bf3856ad364e35~amd64~~6.3.1.3.2914218-1_neutral_GDR"
2014-02-19 17:23:00, Info                  CSI    0000097c [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-Main, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    0000097d [SR] This component was referenced by [l:154{77}]"Package_1_for_KB2914218~31bf3856ad364e35~amd64~~6.3.1.3.2914218-1_neutral_GDR"
2014-02-19 17:23:00, Info                  CSI    0000097e [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-MediaViewerDistributed-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    0000097f [SR] This component was referenced by [l:154{77}]"Package_1_for_KB2914218~31bf3856ad364e35~amd64~~6.3.1.3.2914218-1_neutral_GDR"
2014-02-19 17:23:00, Info                  CSI    00000980 [SR] Repair complete
2014-02-19 17:23:00, Info                  CSI    00000981 [SR] Committing transaction

Identifying the issues

Checking the file you can see the System File Checker tried to repair 3 components, but failed:

2014-02-19 17:23:00, Info                  CSI    00000975 [SR] Repairing 3 components
2014-02-19 17:23:00, Info                  CSI    00000977 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-Main, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    00000978 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-LockScreenCamera-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-02-19 17:23:00, Info                  CSI    00000979 [SR] Cannot repair member file [l:22{11}]"Generic.xbf" of Microsoft-Windows-Camera-MediaViewerDistributed-MediaShared, Version = 6.3.9600.16485, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing

Each entry follows this rough scheme:

  • Cannot repair member file [...]"Generic.xbf"
    The file that needs to be repaired.

  • of Microsoft-Windows-Camera-LockScreenCamera-Main,
    The name of the package which the file belongs to.

  • Version = 6.3.9600.16485,
    File version (major, minor, build and revision).

  • pA = PROCESSOR_ARCHITECTURE_AMD64 (9),
    The targeted processor architecture.

  • Culture neutral, [...],
    Either neutral or the related culture name if localized.

  • file is missing
    Reason the file need to be repaired.

There are three Generic.xbf files which are missing. Additionally, all of them share this bit of information:

2014-02-19 17:23:00, Info                  CSI    0000097b [SR] This component was referenced by [l:154{77}]"Package_1_for_KB2914218~31bf3856ad364e35~amd64~~6.3.1.3.2914218-1_neutral_GDR"

This means the file are included in the KB2914218 Windows update.

Manual repair

  1. Get the KB2914218 update package.

  2. Extract the downloaded .msu file using 7-Zip in a folder named after the original file (e.g. Windows8.1-KB2914218-x64).

  3. Open a command prompt as administrator, and navigate to the actual folder by using the following command:

    cd /d "X:\Whatever\Windows8.1-KB2914218-x64"
    
  4. Expand the cabinet archive containing the update files in the current directory:

    expand Windows8.1-KB2914218-x64.cab -f:* %cd%
    
  5. Each package has an associated .manifest file which lists the bundled files. In order to determine where each file is stored, run the following command by replacing packagaName and fileName.ext with the actual values:

    for /f "delims=" %A in ('"findstr /i /m /c:"packageName" *.manifest"') do @for /f "delims=" %B in ('"findstr /i /m /c:"fileName.ext" %A"') do @echo %~nB;fileName.ext>>fixes.txt
    

    For example:

    for /f "delims=" %A in ('"findstr /i /m /c:"Microsoft-Windows-Camera-LockScreenCamera-Main" *.manifest"') do @for /f "delims=" %B in ('"findstr /i /m /c:"Generic.xbf" %A"') do @echo %~nB;Generic.xbf>>fixes.txt
    
  6. Repeat step 5 for any other file that needs to be fixed.

  7. Take ownership and full control over the C:\Windows\winsxs folder:

    takeown /f "%windir%\winsxs" /a
    icacls "%windir%\winsxs" /grant:r *S-1-5-32-544:(OI)(CI)(F) /q
    
  8. Create any missing folder:

    for /f "tokens=1 delims=;" %G in (fixes.txt) do @if not exist "%windir%\winsxs\%~G\" @md "%windir%\winsxs\%~G"
    
  9. Take full control of the required folders:

    for /f "tokens=1 delims=;" %G in (fixes.txt) do takeown /f "%windir%\winsxs\%~G" /a >nul & icacls "%windir%\winsxs\%~G" /grant:r *S-1-5-32-544:(OI)(CI)(F) /q
    
  10. Restore the files:

    for /f "tokens=1,2 delims=;" %A in (fixes.txt) do copy /y ".\%A\%B" "%windir%\winsxs\%A\%B"
    
  11. Repeat the system file check-up to ensure the issues were fixed:

    sfc /scannow
    

References

  • Use the System File Checker tool to repair missing or corrupted system files
  • How to Run "SFC /SCANNOW" Command at Boot or in Windows 8 and 8.1

If Windows can't boot, you can run SFC from Windows recovery console:

sfc /scannow /offbootdir=d:\ /offwindir=d:\windows

Extracted from: http://www.sysadmit.com/2016/03/windows-reparar-archivos-del-sistema.html