I was recently trying to upgrade a Windows 7 PC to Windows 10 but after several reboots the windows 10 installation was failing with an error “The installation failed in the SAFE_OS phase with an error during REPLACE_OC operation” with code 0x8007001f — 0×20006.
I’ll start with the eventual fix that worked, but below I will also include the instructions for repairing Windows 7 system files as these may also be useful in other circumstances, although they I didn’t manage to fix my problem with them on this occasion.
The actual “fix” was simple. I did an “upgrade” install of the existing Windows 7 SP1 to.… Windows 7 SP1! This is basically a repair install. You need a Windows 7 SP1 ISO which matches the version of windows installed. Extract it to a folder and then run setup. You will get the option to keep all existing files which you must select. Once the repair install is successful you can run the windows 10 upgrade and if you’re lucky like I was it will then complete successfully.
The Windows 7 ISO can still be downloaded from Microsoft (which is obviously much safer than from 3rd party sites) but you will need a legitimate retail key (not an OEM key sadly) to do so. If you are forced to resort to unofficial sources please make sure you check the hash of the file to ensure it hasn’t been altered.
Fixing Windows 7 system files
Note: Before starting make sure you have run a disk scan with
chkdsk /f /r
I tried running the SURT tool (aka the System Update Readiness Tool KB947821) but gave up with it after several hours as there was clearly significant corruption somewhere. Instead I installed KB2966583 which installed quickly and allowed me to use the DISM tool to log and repair any corruption of system files. SURT is basically just a wrapper for DISM with no visual feedback so using DISM manually is preferable.
After using the CheckSUR log (%WINDIR%\Logs\CBS\CheckSUR.log) I was able to identify a large number of corrupt update files that needed to be repaired. This is easier to do via a bit of manipulation in notepad and then excel…
- open the file in notepad
- delete everything at the top of the file down to and inc “Checking Packages”
- delete everything at the bottom of the file from “Checking Component Store” and downwards
- do a search replace of the following
(f)CBS MUM Missing0x00000002servicing\Packages\Package_” -> “” (i.e. blank)
_” -> “
,” (underscore to comma)
~” -> “
,” (tilde to comma)
- Save the file as a CSV
- Open in excel
- Sort by column A
- Delete all rows starting with (fix)
- Re-sort by column C (which is the only column of interest now)
- There may be lots of repeat entries in column C. simply remove all duplicates so there is just 1 entry for each KB number
- That is the list of updates you need to download
Once you’ve got the list of needed updates…
- Check which version of windows you are running — x64 or x86
- Download the packages from the microsoft update catalog or use google for the few that aren’t listed on the update catalog. Make sure you download the updates for the correct OS: windows 7, 64bit or 32bit.
- Browse to
%SYSTEMROOT%\CheckSUR\and create a folder called “packages” if it doesn’t already exist
- copy the .msu files into
- Open an elevated command prompt
DISM /Online /Cleanup-Image /Scanhealth
- When it has finished check the CheckSUR log again
- repeat the process with additional updates if needed
- when DISM is happy, run
Once this is complete your windows 7 should be fully fixed, but as my example shows, there can clearly still be some issues in some cases. If I had to guess the issue at this point is likely to be with permissions or possibly with the registry. This process should at least fix windows updates.
Found this useful? Please do let us know by dropping a comment below. If you would like to subscribe please use the subscribe link on the menu at the top right. You can also share this with your friends by using the social links below. Cheers.
Leave a Reply