microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.54k stars 823 forks source link

WSL --update fails with unknown error code (0x80240066) #9039

Open TheFehr opened 2 years ago

TheFehr commented 2 years ago

Version

Microsoft Windows [Version 10.0.22621.674]

WSL Version

Kernel Version

5.10.102.1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

wsl --update in powershell or opening the store for wsl and press install

Expected Behavior

wsl updates / install newest version

Actual Behavior

Installing: Windows Subsystem for Linux Error: 0x80240066==========90.0%===================== ]

same error number reported by windows store

Diagnostic Logs

WslLogs-2022-10-19_13-36-09.zip

OneBlue commented 2 years ago

Thanks for reporting this @TheFehr. Looking at the logs it looks like an elevation issue. Does your user account have Administrator access ?

TheFehr commented 2 years ago

No but I get an authorization request, where I use administrator credentials.

lo-w commented 2 years ago

the same issue here, already running PowerShell as administrator, then failed with this Error: 0x80240066 error. BR//lo

TheFehr commented 2 years ago

If I use a administrator PoweShell I get this: Installation: Windows-Subsystem für Linux Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet.

The administrators account language is set to german, that is why the error message shows in german too.

lo-w commented 2 years ago

just update we using "wsl --update --web-download" to update the wsl successfully without any issues.

C:\Users\{USER}>wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

BR//lo

TheFehr commented 2 years ago

I tried that too, but it does not seem to update to the newest version for me.

TheFehr commented 2 years ago

Okay I did that from a administrator powershell. As this does not ask for elevated permissions when running in a non administrator shell. It seems to have done something, but still does not seem to be up to date as wsl --version is not available.

And now I get a new error message when trying to run wsl --update from an administrator user shell: Error code: Wsl/UpdatePackage/0x80070520

And a new one from normal user shell too: The provided package is already installed, and reinstallation of the package was blocked. Check the AppXDeployment-Server event log for details.

fscheuMoba commented 2 years ago

I think had the same issue:

I tried to upgrade my very old WSL installation (10.0.XX, where wsl --version is not working) to the Windows Subsystem for Linux Preview from the Microsoft store (that has a version like 0.70.XX.X). But every time I tried to install, the error message 0x80240066 appeared. I even tried to install with the winget package installer, but the same error appears. Even if I call it from an elevated prompt.

winget command: winget install "Windows Subsystem for Linux Preview" --verbose-logs

So my next try was to install it manually by downloading a release from the releases github page of WSL (in my case release 0.70.4). At first I tried to install it by double clicking on the .msixbundle file. The App installer opened, but the installation did not work. Even when I called it with administrator rights.

After that I disabled the Windows Subsystem for Linux Windows feature. But that did not change anything.

So in the next attempt I tried to install the .msixbundle file with the Add-AppPackage powershell command in an elevated prompt:

Add-AppPackage .\Microsoft.WSL_0.70.4.0_x64_ARM64.msixbundle

That command also displayed a error message that said something like "A newer version is already installed". So I checked with the Get_AppxPackage command which version is installed and it outputs a version like 10.0.XX. So yeah, theoretically if you look on the numbers this version is newer as the 0.70.4.0 that we want to install 😆

Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemForLinux

So i tried to remove the package with

Remove-AppxPackage -package MicrosoftCorporationII.WindowsSubsystemForLinux

And after that I reinstalled it with the Add-AppPackage command. That worked partly. As it only updates the version of the administrator user account. So if I tiped wsl --version in the admin prompt it displayed the version 0.70.4.0, but if I type it in my own user account, it still used the old version, even after a reboot. After more googling I discovered the ps command Add-AppxProvisionedPackage that provides installing a package for all users:

Add-AppxProvisionedPackage -Online -PackagePath ".\Microsoft.WSL_0.70.4.0_x64_ARM64.msixbundle"

After a reboot I was finally able to call wsl --version from my user account! And even the Microsoft Store somehow realized the new installation, as it displays an "Open" button, instead of an "install" button on the Windows Subsystem for Linux Preview App page.

So in short if someone has the same problem, you can try the following steps:

(I created a backup tar of my currently used distro with the wsl --export ... command before I tried the upgrade. I would recommend doing this, in case anything goes wrong)

  1. Disable the "Windows Subsystem for Linux" Feature in the Windows Features and reboot
  2. Download the newest WSL release from https://github.com/microsoft/WSL/releases
  3. Open a PowerShell prompt with administrator rights
  4. You can check which version is installed with: Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemForLinux
  5. Remove the old version: Remove-AppxPackage -package MicrosoftCorporationII.WindowsSubsystemForLinux
  6. Install the new version for the admin account (you need to modify the path to the .msixbundle file): Add-AppPackage .\Microsoft.WSL_0.70.4.0_x64_ARM64.msixbundle
  7. Add it to all users: Add-AppxProvisionedPackage -Online -PackagePath ".\Microsoft.WSL_0.70.4.0_x64_ARM64.msixbundle"
  8. Reboot
  9. Check again if everything worked: Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemForLinux
  10. Now if you type wsl --version it should display the new version

The output of Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemForLinux should be something like image

And the output from wsl --version: image

I hope this helps someone and I did not forget any step, as I cannot reproduce the whole procedure with the new installed version again.

p1-ra commented 1 year ago

My current user is not a local administrator:

My 2ct.

guihehans commented 1 year ago

When I use wsl --update to v1.1.6, my docker desktop failed to start with this error code. By installing the latest wsl release v1.2.5, issue solved!

rodrigues-rui-jorge commented 1 year ago

wsl --update --web-download This had solve the problem to me. Evidences, sometimes --update doesn't even start, Microsoft Store doesn't download wsl versions. Various commands errors. At least "wsl --update --web-download" solve my problem

RiccardoGMoschetti commented 1 year ago

commenting to make this issue possibly more visible

wsl --update --web-download solved the same issue

EmilHaldan commented 1 year ago

I had the same issue as well... I tried (almost everything).

What worked for me was to follow this manual installation guide: https://learn.microsoft.com/en-gb/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

And specifically download the .msi package here in this link: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

After this i still couldn't launch ubuntu, but that was just due to WSL not being enabled. To Enable it Press Windows + R keys, type optionalfeatures and press Enter. Then navigate to the bottom where an option for WSL is most likely disabled.

Adarsh-Raj-Jaiswal commented 1 year ago

I was having Updating wsl: update failed: wsl.exe --update --web-download not supported this issue while installing Docker. Fixed it by running command promt as administrator and then running this command wsl --update. This will download and install the latest version. Just run your docker desktop it will be running fine :). Don't forget to run command promt as administrator other wise it will give this error The requested operation requires elevation. Happy journery :)

androniychuk commented 11 months ago

I'm facing the same issue and running as admin in powershell did not fix it.

PS C:\Users\piandro> wsl --version
WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2861
PS C:\Users\piandro> wsl --update
Checking for updates.
Forbidden (403).
Error code: Wsl/UpdatePackage/0x80190193
PS C:\Users\piandro> wsl --update --web-download
Checking for updates.
Forbidden (403).
Error code: Wsl/UpdatePackage/0x80190193

its interesting that wsl --version is reporting the kernel as 5.15, because the kernel I am running in wsl is 6.1, I've been running this kernel since its release here https://github.com/microsoft/WSL2-Linux-Kernel/releases

uname -sr
Linux 6.1.21.1-microsoft-standard-WSL2
androniychuk commented 11 months ago

After looking into the issue, it appears as though this has to do with powershell versions. fails on 5.1

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

works on command prompt and powershell 7.4

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
OneBlue commented 10 months ago

Does the output change based on the powershell version ?

Also, are you using a proxy ?

androniychuk commented 10 months ago

yes, it succeeds and says everything is up to date. I am behind a proxy

{code} wsl --update --web-download Checking for updates. The most recent version of Windows Subsystem for Linux is already installed. {code}

OneBlue commented 10 months ago

@androniychuk: Most likely you received an update through the store.

The previous error your were seeing was probably related to the proxy server blocking WSL's update URL.

OneBlue commented 10 months ago

@TheFehr: This issue should probably be fixed by WSL 2.1.0. Can you confirm if you're still seeing it ?

androniychuk commented 10 months ago

@androniychuk: Most likely you received an update through the store.

The previous error your were seeing was probably related to the proxy server blocking WSL's update URL.

I doubt, the updates were coming in and working before, and proxy is configure same across the whole system

TheFehr commented 10 months ago

@TheFehr: This issue should probably be fixed by WSL 2.1.0. Can you confirm if you're still seeing it ?

I can not remember what my final solution was. I think I completely wiped WSL from my system and started anew as I needed it for work.

Running wsl --update does now properly ask for administrator privileges and performs an update, so this can be closed from my end.

jmmeijer commented 9 months ago

This error may (also) occur when trying to update WSL while connected trough a VPN.

When running the command: wsl --update I received the error message: Forbidden (403). Error code: Wsl/UpdatePackage/0x80190193

After disconnecting my VPN the update ran without problems.

KineticTheory commented 9 months ago

This error may (also) occur when trying to update WSL while connected trough a VPN.

When running the command: wsl --update I received the error message: Forbidden (403). Error code: Wsl/UpdatePackage/0x80190193

After disconnecting my VPN the update ran without problems.

I am not on a VPN, but this ⏫ is the error I'm seeing.

C:\>wsl --version
WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3930

C:\>wsl --update
Checking for updates.
Forbidden (403).
Error code: Wsl/UpdatePackage/0x80190193

I am in a corporate environment (behind a proxy).

yangxiangyou commented 9 months ago

在通过 VPN 连接时尝试更新 WSL 时,也可能(也)发生此错误。

运行命令时:我收到错误消息: wsl --update Forbidden (403). Error code: Wsl/UpdatePackage/0x80190193

断开我的 VPN 连接后,更新运行没有问题。

tanks,bro

jmcp commented 8 months ago

I've had the most frustrating 2 weeks trying to fix this problem (and while travelling OS, too).

My laptop has Windows 10 Enterprise, and after installing KB5026037 WSL was slammed back to WSL1, and there were a heap of other problems, chiefly that I could not get the Windows Update application or App Store to recognise that there were any updates available - for any application.

The symptom was that both wsl --update and the Windows settings app would report "no updates available" and give a failure code of 0x8024002e.

I couldn't installed the WSL 2.1.5 msixbundle, or the wsl update MSI, because the packaging system reported that a newer version of the update was installed. But the linux kernel package was still stuck at 5.10.102.1 - 18 months old! (https://github.com/microsoft/WSL2-Linux-Kernel/releases/tag/linux-msft-wsl-5.10.102.1)

What I did to fix this was muck around in the registry. Firstly, I changed

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\DisableWindowsUpdateAccess

from 1 to 0

Then I removed the entire folder _HKEY_LOCALMACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU and ran (elevated)

net stop bits
net stop sysmain
net stop cryptsvc
net stop wuauserv

followed by 

net start wuauserv
net start cryptsvc
net start sysmain
net start bits

After that I went back to the Windows Update -> Advanced Options and selected "Receive updates for other Microsoft products when you update Windows", went back to the Windows Update panel and boom there were plenty of updates available - including the Feature Update to 10 v22H2 and 2023-10 Update KB2023057.

After installing all the updates (I think it was 5 reboots, too), I finally have WSL2 properly updated.

PS C:\Users\jmcpherson> wsl --version
WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.4170
VAllens commented 2 months ago

@TheFehr: This issue should probably be fixed by WSL 2.1.0. Can you confirm if you're still seeing it ?

I ran the wsl update command in a cmd window with normal privileges and in a cmd window running as administrator, respectively, and the following is the output:

C:\Users\Administrator> wsl --update
Checking for updates.
Forbidden (403).
Error code: Wsl/UpdatePackage/0x80190193

C:\Users\Administrator> wsl --update --web-download
Checking for updates.
Forbidden (403).
Error code: Wsl/UpdatePackage/0x80190193

C:\Users\Administrator> wsl --version
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22631.4112
LassiHeikkila commented 3 weeks ago

@TheFehr: This issue should probably be fixed by WSL 2.1.0. Can you confirm if you're still seeing it ?

I ran the wsl update command in a cmd window with normal privileges and in a cmd window running as administrator, respectively, and the following is the output:

C:\Users\Administrator> wsl --update Checking for updates. Forbidden (403). Error code: Wsl/UpdatePackage/0x80190193

C:\Users\Administrator> wsl --update --web-download Checking for updates. Forbidden (403). Error code: Wsl/UpdatePackage/0x80190193

C:\Users\Administrator> wsl --version WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.22631.4112

I was getting same error with exactly same WSL & Kernel versions. What worked for me was first uninstalling WSL (wsl --uninstall) and then reinstalling/updating it (wsl --update). Seems to not have destroyed any data in the distros themselves.

androniychuk commented 3 weeks ago

@TheFehr: This issue should probably be fixed by WSL 2.1.0. Can you confirm if you're still seeing it ?

I ran the wsl update command in a cmd window with normal privileges and in a cmd window running as administrator, respectively, and the following is the output: C:\Users\Administrator> wsl --update Checking for updates. Forbidden (403). Error code: Wsl/UpdatePackage/0x80190193 C:\Users\Administrator> wsl --update --web-download Checking for updates. Forbidden (403). Error code: Wsl/UpdatePackage/0x80190193 C:\Users\Administrator> wsl --version WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.22631.4112

I was getting same error with exactly same WSL & Kernel versions. What worked for me was first uninstalling WSL (wsl --uninstall) and then reinstalling/updating it (wsl --update). Seems to not have destroyed any data in the distros themselves.

I got this same issue with "Error code: Wsl/UpdatePackage/0x80190193" Even with running powershell as administrator

wsl --version
WSL version: 2.3.24.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.4317