Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't update WSL2 #10527

Closed
1 of 2 tasks
ealjkl opened this issue Sep 22, 2023 · 32 comments
Closed
1 of 2 tasks

Can't update WSL2 #10527

ealjkl opened this issue Sep 22, 2023 · 32 comments
Assignees

Comments

@ealjkl
Copy link

ealjkl commented Sep 22, 2023

Windows Version

Microsoft Windows [Versión 10.0.22623.1325]

WSL Version

unkown

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

unknown

Distro Version

any distro

Other Software

No response

Repro Steps

I try to run any wsl command in Power Shell or CMD.

E.g.
$ wsl
$ wsl --version
$ wsl --update
$ wsl --update --rollback
etc.

Expected Behavior

It should perform the corresponding operation

Actual Behavior

I get in the terminal:

"
WSL is finishing an upgrade...
Update failed (exit code: 1603).
Error code: Wsl/CallMsi/E_ABORT
"

Diagnostic Logs

WslLogs-2023-09-21_18-15-02 (2).zip

WSL2 was working perfectly fine yesterday.

Today I got the error described in Actual Behavior. The odd thing is that I can create a new Windows account and run wsl --install and everything is fine; but as soon as I run wsl --update, I get the above error, and furthermore, I cannot use any wsl command.

The last build I had is: 22623.1 (gotten from running (gcm wsl).Version in Power Shell)
The last kernel I had is: Linux 5.10.16.3-microsoft-standard-WSL2 (gotten from running wslfetch in my Ubuntu 20.24 instance)

Also I do have the wsl component turned on and the virtual machine features. And just in case I ran again:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
from the wsl install manual

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 22, 2023

This is a known issue if you run wsl --update in a non elevated terminal. This will be fixed in the next release.

In the mean time, running this command as administrator should fix the issue.

@ealjkl
Copy link
Author

ealjkl commented Sep 22, 2023

I tried running the terminal as an administrator, and from that terminal I ran the command does that count as running as administrator? or is there a command like sudo in Windows?

Anyhow, the problem was solved by itself after a day. Thank you a lot for your time!

@NotConspicuous
Copy link

NotConspicuous commented Sep 22, 2023

I am also experiencing this, even on an administrative terminal, But I have the cause!

Product: Windows Subsystem for Linux -- Error 1406. 
Could not write value Name to key \SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE.  System error .  
Verify that you have sufficient access to that key, or contact your 
support personnel.

Ok, I didn't expect to make the world's most stubborn registry key. Took me about 30 minutes to regain ownership.

@NotConspicuous
Copy link

I have discovered a fix for you administrative issue in this regards, go into regedit and navigate to \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\ then select the DEFAULT key and take ownership via setting permissions, then delete it and re-create it.

WSL should proceed to allow you to install and update. This has not bricked my PC but please do note that playing with registry values is very risky and can brick your machine. I only do this because I have specific recovery software I can use. So please be cautious.

Have a nice day! 😄

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 22, 2023

I am also experiencing this, even on an administrative terminal, But I have the cause!

Product: Windows Subsystem for Linux -- Error 1406. 
Could not write value Name to key \SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE.  System error .  
Verify that you have sufficient access to that key, or contact your 
support personnel.

Oh that's interesting. @NotConspicuous could you share the complete install log file ?

@NotConspicuous
Copy link

I am also experiencing this, even on an administrative terminal, But I have the cause!

Product: Windows Subsystem for Linux -- Error 1406. 
Could not write value Name to key \SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE.  System error .  
Verify that you have sufficient access to that key, or contact your 
support personnel.

Oh that's interesting. @NotConspicuous could you share the complete install log file ?

Not really, this error originates on the event logger and no installer logs are left behind. This is as much as I can get. Some details here, It occurs because the user nor the system cannot edit the key \SOFTWARE\Microsoft\Terminal Server Client\Default due to some error reading it; not even regedit can add or view values inside the key (Possibly corruption? Cannot confirm.)

The error originates from the MSInstaller Service.

@NotConspicuous
Copy link

At least, no logs are left behind to what I can see.

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 22, 2023

Ok I see. You'd need to collect MSI logs manually.

Could try to downloading the MSI and install it via (elevated cmd.exe):

msiexec.exe /i <path-to-msi> /L*V C:\wsllogs.txt

and then share C:\wsllogs.txt

@NotConspicuous
Copy link

Ok I see. You'd need to collect MSI logs manually.

Could try to downloading the MSI and install it via (elevated cmd.exe):

msiexec.exe /i <path-to-msi> /L*V C:\wsllogs.txt

and then share C:\wsllogs.txt

This may be harder to reproduce since I have fixed the registry key, so I'd need to find a way to reproduce it again. Also, I doubt it's in control of the WSL project since it's more windows related.

I'll reproduce the settings by removing the permissions for TrustedInstaller to see it.

@NotConspicuous
Copy link

Here's the best I can give you, now I need to forcefully delete this key. AGAIN.
wsllogs.txt

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 22, 2023

Unfortunately based on the logs it looked like the MSI was already installed so the logs don't actually show the registry error.

Can you try to completely remove the WSL from the control panel (there might be two installed packages, remove all of them), and collect logs again ?

@NotConspicuous
Copy link

NotConspicuous commented Sep 22, 2023

Unfortunately based on the logs it looked like the MSI was already installed so the logs don't actually show the registry error.

Can you try to completely remove the WSL from the control panel (there might be two installed packages, remove all of them), and collect logs again ?

Right, I'll create a windows VM to recreate the issue. I don't feel like repeating safe mode... again.

@NotConspicuous
Copy link

@OneBlue Successfully reproduced perfectly on a clean VM.
wsllogs.txt

This is reproducing a lack of permissions error I described by removing all perms to the key, also may be known as error 1603. Notice the identical Event Viewer Log.

image

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 23, 2023

Thanks a lot @NotConspicuous. I see the permission issue indeed:

MSI (s) (50:10) [02:49:37:851]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE,,BinaryType=1,ControlRegistryReflection=0,)
MSI (s) (50:10) [02:49:37:851]: Executing op: RegAddValue(Name=Name,Value=C:\Program Files\WSL\WSLDVCPlugin.dll,)
MSI (s) (50:10) [02:49:37:851]: Note: 1: 1401 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE 3: 5 

Can you share a screenshot of the current permissions of that key ? The thing I'm trying to figure out is why this hits on your machine specifically.

@NotConspicuous
Copy link

Thanks a lot @NotConspicuous. I see the permission issue indeed:

MSI (s) (50:10) [02:49:37:851]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE,,BinaryType=1,ControlRegistryReflection=0,)
MSI (s) (50:10) [02:49:37:851]: Executing op: RegAddValue(Name=Name,Value=C:\Program Files\WSL\WSLDVCPlugin.dll,)
MSI (s) (50:10) [02:49:37:851]: Note: 1: 1401 2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE 3: 5 

Can you share a screenshot of the current permissions of that key ? The thing I'm trying to figure out is why this hits on your machine specifically.

Sadly I cannot reproduce the specific key's permissions or state beforehand for I don't know what they were in the first place. I'd assume Administrator not having the perms would cause this.

@roskatom
Copy link

I've had the same issues as above, relating to the same key. Interestingly, the key doesn't actually exist on my machine. I can't create it either, as I get a 'Cannot create a stable subkey under a volatile parent key.' error.

@roskatom
Copy link

roskatom commented Sep 23, 2023

Okay so it turns out that 'have you tried turning it off and back on again' really is the right answer sometimes! 😄 After posting the above comment, I rebooted my system. Post-reboot, the WSL upgrade completed successfully, and the previously missing registry key now exists.

@NotConspicuous
Copy link

Okay so it turns out that 'have you tried turning it off and back on again' really is the right answer sometimes! 😄 After posting the above comment, I rebooted my system. Post-reboot, the WSL upgrade completed successfully, and the previously missing registry key now exists.

Sadly, that wasn't the solution for me, but it does seem that there is a general issue with the key for some reason.

@sarim
Copy link

sarim commented Sep 25, 2023

I have the same issue. Note that I upgraded wsl with wsl --update --pre-release many times before from normal pwsh without issue. But somehow this time it didn't work. The log "C:\Users\thegi\AppData\Local\Temp\wsl-install-logs.txt" here:
wsl-install-logs.txt

Then From a administrator pwsh, I tried the same command. It says updated successfully, but afterwards wsl --version still shows 2.0.0.0. Tried twice, same issue.

Then run downloaded the msi from github release and run

msiexec.exe /i C:\Users\thegi\Downloads\wsl.2.0.1.0.x64.msi /L*V C:\wsllogs.txt

It showed a warning regarding WSL.lnk, but installed succesfully. And wsl --version now shows 2.0.1.0.
Heres: wsllogs.txt

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 26, 2023

Thank you for reporting this @sarim. I could reproduce the issue and find its root cause. This will be fixed in the next release ! (although you will only see the fix in two releases, since the code that's "upgrading" needs to be fixed)

@sarim
Copy link

sarim commented Sep 26, 2023

Thanks, glad to hear the issue has been identified :) So I need to download msi file manually and install it that way for next two releases?

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 26, 2023

Thanks, glad to hear the issue has been identified :) So I need to download msi file manually and install it that way for next two releases?

Either that, or installing via the store should work starting with the next release

@obriat
Copy link

obriat commented Sep 29, 2023

I had trouble with 2.0.1.0 & 2.0.2.0: this comment fixes the problem #10560 (comment)

@OneBlue
Copy link
Collaborator

OneBlue commented Oct 3, 2023

Fixed with 2.0.3

@nykbocks
Copy link

im getting a bunch of problems with wsl2,so much that im planning to change to a live usb with puppy linux on it ...

@heitormbonfim
Copy link

heitormbonfim commented Dec 13, 2023

Hi, I was having the same problem on my windows 10 pro.
What worked for me was installing the WSL without a distribution
wsl --install --no-distribution
It installed the WSL, after that, I rebooted my computer
As soon as I logged in, it was already installing ubuntu and it worked fine.

@soutzis
Copy link

soutzis commented Dec 17, 2023

Fixed with 2.0.3

No you didn't. Idk wtf is going on, not even 2.0.14 fixes anything

@simonfontana
Copy link

There is still an issue. Tried to install WSL yesterday and I received the 1603 error:

> wsl.exe  --install --no-distribution
WSL is finishing an upgrade... 
Update failed (exit code: 1603).
Error code: Wsl/CallMsi/E_ABORT

This is the log message I could find (Windows is not my primary system, I found this in Computer Management -> ... -> Windows Logs -> Application; let me know if that's incorrect):

Product: Windows Subsystem for Linux -- This application requires the Windows Subsystem for Linux Optional Component.
Install it by running: wsl.exe --install --no-distribution
The system may need to be restarted so the changes can take effect.

I have rebooted my system. Same issue and I can find no solution.

@tilkinsc
Copy link

tilkinsc commented Jan 6, 2024

My issue was that I didn't have have the lastest 21H2 and 22H2 patches. At some point microsoft threw in windows 11 upgrade as an option. This actively blocks you from updating windows to the later patches. More information on versions: https://learn.microsoft.com/en-us/windows/release-health/release-information

This following reg script will set your max upgrade level to 22H2. (To undo, its as simple as deleting/reverting the two values)

  • Note: This does mean you won't get any updates past.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
"TargetReleaseVersion"=dword:00000001
"TargetReleaseVersionInfo"="22H2"

Open windows update (reopen if its already) it should look like this, notice the asterisk, except and it will want to update to windows 11.
image

Pause and resume windows updates. This will trigger an update search and windows 11 will not come back. Simply update as normal. It took me through a couple of update restarts. I already had the latest wsl2 installed and could use it as normal.

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.3803

@sarim
Copy link

sarim commented Jan 6, 2024

I had 2.0.1. Tried to update to latest just now several times from elevated powershell. Didn't work. wsl --version still shows the old one. Then I removed Windows subsystem for linux from add remove programs. then tried to wsl --install --no-distribution --web-download. It shows error. Later I just downloaded latest msi from github release and installed it. From changelog I see fixes related to upgrade, those will affect future upgrades I guess.

@github-actions github-actions bot mentioned this issue Apr 1, 2024
2 tasks
@antgustech
Copy link

antgustech commented Apr 30, 2024

PowerShell 7.4.2
PS C:\Users\xxxx> wsl --update
Checking for updates.
Updating Windows Subsystem for Linux to version: 2.1.5.
The handle is invalid.
Error code: Wsl/UpdatePackage/0x80070006

Running from elevated pwsh prompt.

@proxseas
Copy link

Fixed with 2.0.3

I tried various fixes and running the installed for "2.0.3.0" is the only one that worked. Manually installing the latest version (2.2.4.0 as of today) or running wsl --update breaks things. So I guess I will try to stay with this version as long as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests