[Win11] How to fix the infinite loop update crash with error 0x800f0806! Force cancel pending operations

Every time I shut down or restart Windows 11, the installation of updates starts, and it always crashes and goes back to the original state... Furthermore, I can't use the DISM command to clean up components (/startcomponentcleanup) but gets rejected with the message "Error: 0x800f0806 This operation could not be completed because there is a pending operation."

This time, we will explain the official Microsoft troubleshooting steps to get out of the "Windows Update infinite crash loop." To avoid typing errors on the black screen (command prompt),A surefire way to create an autorun file (batch file) in advanceI will introduce you.

table of contents

What causes the error 0x800f0806 and crash loop?

This error occurs when the system is locked with a "process (pending.xml) that must be restarted to be completed." Even if you restart the system, the process fails and crashes, so the system remains "pending" and falls into an infinite loop where no new operations are accepted.

[Warning] Do not forcibly change access rights from a running Windows

If there is a pending process listed, run it from a normally running Windows C:\Windows\WinSxS You might be thinking, "Why not just open the folder and edit it directly?" However, this folder is strongly protected by a system permission called "TrustedInstaller." In the past, when I tried to forcibly change the permissions in my experiments, the system crashed completely and would not start up.

▼Click here for the record of the tragic experiment

Therefore, be sure to perform offline operations safely from the Windows Recovery Environment (WinRE).

[Preparation] Create a command autoexecution file (batch file)

The black screen of the recovery environment (WinRE) requires you to manually type long commands, and there is also the risk of encountering the error "Error: 0x800f082f" due to insufficient working space. To avoid this, create an automatic program that can be executed by double-clicking while Windows is running normally.

1. Open Notepad.

2. Copy the entire code below and paste it into Notepad.
(This code is a program that automatically finds the misaligned Windows drive, creates a working area to prevent errors, and then executes repair commands.)

@echo off
echo 実行中のドライブを取得しています...
set "WinDrive=%~d0"

echo Windowsドライブは [%WinDrive%] です。
echo.
echo スクラッチ領域を作成し、DISMコマンドを実行します...

mkdir %WinDrive%\Scratch
DISM /Image:%WinDrive%\ /Cleanup-Image /RevertPendingActions /ScratchDir:%WinDrive%\Scratch

echo.
echo 処理が完了しました。ウィンドウを閉じてPCを再起動してください。
pause

3. Click "File" > "Save As" from the menu.

4. Change "Files of type" to "All files (.)"

5. Enter the file name repair.bat I will.

6.[Important] Change "Encoding" next to the Save button to "ANSI". (Note: The default setting for Windows 11 Notepad is "UTF-8." If you do not change it to "ANSI," the Japanese characters will be garbled and a black screen will appear when you run the program.)

7. First, for ease of understanding, select "Desktop" from the menu on the left, save it, and close Notepad.

8. It's on your desktop repair.bat Right-click and "Copy".

9. Open File Explorer and open "This PC" > "Local Disk (C:)".

10. Right-click on an empty space on the C drive and select "Paste."

11. "Access to the target folder is denied" or "Administrator privileges are required to copy to this folder"If a warning screen appears,Click Continue.

対象のフォルダーへのアクセスは拒否されました
対象のフォルダーへのアクセスは拒否されました

12.The batch file is now located directly under the C drive.

Undo pending actions from the recovery environment

First, use the official Microsoft DISM command to cleanly roll back (cancel) any pending tasks.

1. From the Windows Start menu, hold down the Shift key on your keyboard and click Restart on the power icon.

2. When the blue screen (recovery environment) appears, open "Troubleshoot" > "Advanced options" > "Command Prompt".

①Select options
①Select options
2. Troubleshooting
2. Troubleshooting
③Advanced options
③Advanced options

3. When the black screen opens, find the drive letter of the drive containing Windows.

This is because the recovery environment may deviate from "C". dir C:\ (\is a half-width yen symbol) and press Enter. If "repair.bat" is there, that is the Windows drive. If you get the message "File not found,"dir D:\ , dir E:\ Please search by entering the following in order. (Here, we will assume that it is on the C drive.)

command prompt
command prompt

4.repair.bat Using the drive letter where you found it, type the following and press Enter:

C:\repair.bat

5. When the message "The operation completed successfully" appears, close the command prompt by clicking the × button in the upper right corner.

command prompt
command prompt

6. The "Choose an option" screen will appear, so select "Continue".

Option selection
Option selection

7. The message "Update in progress. Please keep your computer turned on" will be displayed, and after a while Windows will start up.

Update in progress, please leave your computer powered on.
Update in progress, please leave your computer powered on.

8. If there are no other issues, the "pending operations" will be canceled and the issue of updates starting to install every time you shut down or restart your computer will be resolved.

Solution 2: Manually reset the registry and pending.xml (last resort)

If Solution 1 still does not start (crashes), try the last resort officially recommended by Microsoft: manually deleting the flag and stopping the service.

① Rename pending.xml

  1. Open the recovery environment command prompt again and check the Windows drive (e.g. C drive).
  2. Run the following commands to rename and disable the pending file:
ren C:\Windows\WinSxS\pending.xml pending.old

② Delete the "pending flag" in the registry

1. In the command prompt regedit Type and press Enter to open the Registry Editor.

command prompt
command prompt

2.From the tree on the left HKEY_LOCAL_MACHINE Click to select it.

レジストリエディター
レジストリエディター

3. Click "File" > "Load Hive" from the menu.C:\Windows\System32\config\COMPONENTS Open.

Hive Loading
Hive Loading
Select C:\Windows\System32\config\COMPONENTS
C:\Windows\System32\config\COMPONENTSSelect

4. You will be asked for the key name, so enter "Test" and click OK.

Enter the key name
Enter the key name

5.HKEY_LOCAL_MACHINE\Test Expand and click on the right pendingxmlidentifier If there is a value like this, right-click it and select "Delete."

Expand HKEY_LOCAL_MACHINE\Test
HKEY_LOCAL_MACHINE\Test Expand

6.HKEY_LOCAL_MACHINE\TestWith the selected item selected, click "File" > "Unload Hive" from the menu to close Test.

Hive Unload
Hive Unload

7. When asked "Do you want to unload this key and all subkeys?" click "Yes".

③ Disable automatic startup of TrustedInstaller

1.From the tree on the left HKEY_LOCAL_MACHINE Click to select it.

2. Click "File" > "Load Hive" and this time C:\Windows\System32\config\SYSTEM Open.

3. Enter "Test" again as the key name.

4.HKEY_LOCAL_MACHINE\Test\ControlSet001\Services\TrustedInstaller Expands to.

5. On the right Start Double-click the value, change the value data to "4" (Disabled), and click OK.

Expand to HKEY_LOCAL_MACHINE\Test\ControlSet001\Services\TrustedInstaller
HKEY_LOCAL_MACHINE\Test\ControlSet001\Services\TrustedInstaller Expanded to
Edit DWORD (32-bit) Value
Edit DWORD (32-bit) Value
The value data was changed to "4" (disabled)
The value data was changed to "4" (disabled)

6.HKEY_LOCAL_MACHINE\TestWith the selected item selected, click "File" > "Unload Hive" from the menu to close Test.

7. When asked "Do you want to unload this key and all subkeys?" click "Yes".

8. After closing the Registry Editor and Command Prompt, the "Choose an option" screen will appear. Select "Continue".

Post-processing after exiting the loop

Once you have resolved the issue of updates starting to install every time Windows starts up, shuts down, or restarts, you will need to restore the "TrustedInstaller" service (Windows Modules Installer) that you temporarily stopped.

  1. Press the Windows key + R on your keyboard.services.msc and run it.
  2. Find "Windows Modules Installer" in the list of services.
  3. Check the "Startup type"If it is set to "Disabled," double-click it to open it, change it to "Manual," and press "OK."(If it has already returned to "Manual", you can close the screen without doing anything.)
  4. To prevent the error from recurring, we recommend clearing the update cache and resetting the component just to be safe.
If you found this article helpful, please share it on social media.

Person who wrote this article

Driven by questions arising from my daily PC use and the desire to "do more," I have been pursuing self-study in Windows since around 2008. I am sharing the "aha!" techniques and solutions I discovered through trial and error with the sole purpose of helping you in your PC life.

View profile

Comment:

To comment

[About submissions]
We welcome any questions or information regarding the content of the article.
However, please note that content unrelated to the purpose of the article, criticism of specific individuals or organizations, offensive language,Inappropriate wordsComments containing the above may be deleted or made private without notice at the discretion of the administrator.
Please note that spam may be automatically deleted by anti-spam measures.

CAPTCHA


table of contents