microsoft / WSL

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

An error occurred during installation. Error Code: 0x80070422 #8694

Open Duy-Thanh opened 2 years ago

Duy-Thanh commented 2 years ago

Version Information

Description of this error

I'm trying to install an Ubuntu distro to WSL. My CPU is Core i8, has virtualization support enabled, and followed the manual installation instructions at: https://docs.microsoft.com/en-us/windows/wsl/install-manual

When I run the command wsl --install -d Ubuntu, I get the following error: An error occurred during installation. Distribution Name: 'Ubuntu' Error Code: 0x80070422

Soon after, a search took place and I learned that the disabled LxssManagerservice was causing this error (Link to article: https://github.com/Microsoft/WSL/issues/3815)

So I ran the following commands in order:

And this is what I get:

[SC] StartService FAILED 1056:

An instance of the service is already running.

It says the service is already running. And when I check in services.msc, it is indeed running. So I suspect that although the service is running, the WSL on my machine is not able to communicate with the service.

So I stopped the service, put it back to the DISABLED state, went into Windows Features to disable WSL, rebooted the machine, and turned WSL back on, then restarted the computer.

At this point, I tried running WSL, and it gave me error 0x80070422. This is understandable, since I'm leaving the LxssManager service in the DISABLED state.

Then I re-enable the service with the command: sc config LxssManager start=auto, and this is what I get:

C:\Users\Duy Thanh>sc config LxssManager start=auto
[SC] ChangeServiceConfig SUCCESS

C:\Users\Duy Thanh>

(Please note that I have disabled UAC on my computer, and run Windows Terminal as administrator. Windows Defender is also completely disabled using Group Policy and Registry, so there should be no conflict here)

I repeatedly run the following commands:

C:\Users\Duy Thanh>shutdown -r -t 00

And after reboot:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\Duy Thanh>cmd.exe
Microsoft Windows [Version 10.0.22621.232]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Duy Thanh>sc stop LxssManager

SERVICE_NAME: LxssManager
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 3  STOP_PENDING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\Users\Duy Thanh>sc query LxssManager

SERVICE_NAME: LxssManager
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\Users\Duy Thanh>sc start LxssManager

SERVICE_NAME: LxssManager
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 2  START_PENDING
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x7d0
        PID                : 4152
        FLAGS              :

C:\Users\Duy Thanh>sc query LxssManager

SERVICE_NAME: LxssManager
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\Users\Duy Thanh>

Now it's time for me to install my distro, and I verify the service is running, via the above commands:

C:\Users\Duy Thanh>wsl --install -d Ubuntu
Installing: Ubuntu
An error occurred during installation. Distribution Name: 'Ubuntu' Error Code: 0x80070422

C:\Users\Duy Thanh>

Still the error persists, I try again with the command:

C:\Users\Duy Thanh>wsl --update
Installing: Windows Subsystem for Linux
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

C:\Users\Duy Thanh>

Something went wrong, I decided to check the service again:

C:\Users\Duy Thanh>sc query LxssManager

SERVICE_NAME: LxssManager
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\Users\Duy Thanh>

I tried going back to PowerShell, but nothing worked (Because I was still in the Command Prompt):

C:\Users\Duy Thanh>exit
PS C:\Users\Duy Thanh> wsl --install -d Ubuntu
Installing: Ubuntu
An error occurred during installation. Distribution Name: 'Ubuntu' Error Code: 0x80070422
PS C:\Users\Duy Thanh> wsl --update
Installing: Windows Subsystem for Linux
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
PS C:\Users\Duy Thanh> cmd.exe
Microsoft Windows [Version 10.0.22621.232]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Duy Thanh>sc query LxssManager

SERVICE_NAME: LxssManager
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\Users\Duy Thanh>

So what's going on in the end? I appreciate any help

NickDeBeenSAE commented 2 years ago

Firstly, there is no such CPU as a Core i8, so I'm assuming you meant i9.

The Feature of WSL is not enabled.

Please search Features and open Turn Features On or Off.

Find WSL, and click enable.

Enable the Hyper-V service while your at it.

Reboot, then try the installation again, then get back to me once done.

Duy-Thanh commented 2 years ago

Firstly, there is no such CPU as a Core i8, so I'm assuming you meant i9.

The Feature of WSL is not enabled.

Please search Features and open Turn Features On or Off.

Find WSL, and click enable.

Enable the Hyper-V service while your at it.

Reboot, then try the installation again, then get back to me once done.

@NickDeBeenAIE Thank you for helping me. Maybe due to a typo, I mistyped 9 into 8. Sorry for the confusion.

Hyper-V enabled, WSL feature enabled, I also tried disabling and enabling them in Windows Features but still no effect

What's more, there are some additional details:

I manually installed Ubuntu using the Add-AppxPackagecommand via Powershell, all the setup went smoothly and the installation and setup for the first time ran without any errors.

Then I opened the Powershell command prompt (run as admin) and typed wsl, Ubuntu actually worked without any errors. Even all commands are perfectly executed in that Ubuntu WSL environment

However, statements where WSL takes arguments won't work, such as wsl --install -d Ubuntu or wsl --update and any other WSL command that takes arguments, will both return error 0x80070422 (with the command wsl --install -d Ubuntu) and the error message: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. (with the wsl --update command).

There is another version of WSL, the WSL Preview version available on the Microsoft Store. And since I'm in the Windows Insider program, I thought maybe the current WSL is not compatible so I installed the WSL Preview on the Store, but still the same error occurs. And when I remove WSL Preview and go to windows features turn off Hyper-V and WSL and turn it back on, the error persists.

But when I manually install the Ubuntu distribution using the Appx installation file, everything is back to normal as if nothing happened.

NickDeBeenSAE commented 2 years ago

This seems to be a very big problem with your operating system.

You'll need to leave the Windows Insider Program as the builds can have a lot of issues, some of which will corrupt your installation.

It appears such issue has happened, wherein, the registry item to do with WSL has been screwed with.

This means 2 things:

Leave the Insider Program, and wait fpr your system to return to normal;

Or;

Reinstall your entire Windows installation.

DavidLee528 commented 1 year ago

I occured similar problem when i wsl.exe --update in Powershell in Windows Terminal with same error code Wsl/UpdatePackage/0x80070422.

I found the reason: AppX Service is disabled by my self on my Windows 10 because of the high CPU usage.

After changing the Start type of Service AppXSvc from disable to automatic, everything become normal.

Hope it is helpful.

mehdiMj-ir commented 1 year ago

I occured similar problem when i wsl.exe --update in Powershell in Windows Terminal with same error code Wsl/UpdatePackage/0x80070422.

I found the reason: AppX Service is disabled by my self on my Windows 10 because of the high CPU usage.

After changing the Start type of Service AppXSvc from disable to automatic, everything become normal.

Hope it is helpful.

Same problem here!

I have a Windows Server 2022, I use techcommunity.microsoft and it says to update my Win server, enable WSL and install my desired distro:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
wsl --install

But after enable WLS and reboot I couldn't install and had these errors:

wsl --install -d Ubuntu
Installing: Ubuntu
An error occurred during installation. Distribution Name: 'Ubuntu' Error Code: 0x8000ffff
wsl --install -d Ubuntu-20.04
Installing: Ubuntu 20.04 LTS
An error occurred during installation. Distribution Name: 'Ubuntu 20.04 LTS' Error Code: 0x8000ffff

I tried your comment wsl --update and now it start installing.

Screenshot_20230118_094117

jkateva commented 1 year ago

I had the same problem and running this in an elevated command prompt fixed the issue:

sc config wlidsvc start= demand

alinpop commented 1 year ago

for me it worked by downloading it from the Microsoft Store. I think Windows expects that you are logged in even if you run the script from the terminal.

swingingsimian commented 1 year ago

I seem to be suffering from the same issue. In my case it was triggered by updating WSL after being prompted there was an update available.

Running cmd .exe as admin I got LxssManager running again and configured to auto start, but the problems persists.

I have also tried disabling the WSL feature restarting and renabling.

Please find logs attached as per https://github.com/Microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method

WslLogs-2023-03-01_10-26-44.zip

EDIT: Updating via the Microsoft Store also fixed this for me.

rdavies3 commented 1 year ago

I get to put my self on the list. I had a perfectly working installation that was working with separate installs on a couple of different user accounts on Windows 10. I had some configuration annoyances with a domain based user account, so I had been running everything important out of a local account. I prematurely ran a gui app before installing some of the visual libraries on Ubuntu, and ever since I've been getting the The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. Error code: Wsl/0x80070422 error. I've tired removing and re-enabling the WSL feature. I've verified that the LsxxManager service is running and is configured to run automatically. I've tried installing Ubuntu from the store, I've ensured that the HyperV and VirtualMachine Platform features are also enabled. I'm not sure what's gone wrong or what other troubleshooting steps I might try.

elvin-jatapp commented 1 year ago

fix/update via Microsoft Store helps for me

ahmedalzeer commented 1 year ago

for me i was disabled all my windows updates when i enabled it again it's works fine

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 1 year ago

for me it was the wlidsvc (Microsoft Account Sign-in Assistant). microsoft wants you to have an account so badly

egeres commented 1 year ago

I'm stuck at:

C:\WINDOWS\system32> wsl --install -d "Ubuntu-22.04"
Installing: Ubuntu 22.04 LTS
An error occurred during installation. Distribution Name: 'Ubuntu 22.04 LTS' Error Code: 0x80070422

I tried disabling and re-enabling WSL, but didn't work

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

And I can't use the store because I ran a debloater script to remove the unnecessary, when I click on the ubuntu product page it crases (thanks microsoft!)

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 1 year ago

check these required services running (able to run):

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 1 year ago

you can also install wsl and a distro without wlidsvc service running:

https://github.com/microsoft/WSL/releases -> get for eg. Microsoft.WSL_1.2.5.0_x64_ARM64.msixbundle https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL -> get for eg. Fedora-Remix-for-WSL-SL_38.0.0.0_x64_arm64.msixbundle

you can also install distros without wlidsvc service using wsl manager https://github.com/bostrot/wsl2-distro-manager

Salvia79 commented 10 months ago

I tried the solutions provided in issues #3386 and #3815 , but they did not work. In the end, I uninstalled related apps such as Windows Subsystem of Linux and Ubuntu, then restarted and installed wsl again by command wsl --install -d Ubuntu, still it showed the same error code, with a Microsoft link this time followed Step 4 - Download the Linux kernel update package. With the instruction on the page (just install the wsl2 kernel update package), ubuntu was successfully installed and worked. Notes:

  1. For LxSSManager service and Windows update, set their Startup Type to Automatic.
  2. Both the Windows subsystem of Linux and Virtual Machine Platform were turned off and then turned on again.
  3. My Windows version: Microsoft Windows [Version 10.0.22631.2792] (Windows 11 Home 64-bit)

Hope this may help.

jadczak-sibel commented 4 months ago

check these required services running (able to run):

Needing the "Microsoft Account Sign-In Assistant" to be enabled is mind boggling but solved my problem.

AlexeyKupershtokh commented 3 months ago

In my case the problem was that I don't have AppX installed. so when I run

wsl --install -d Ubuntu

I get

Error code: Wsl/InstallDistro/0x80070422

The workaround that helped: just use another way to download files that doesn't require AppX.

wsl --install -d Ubuntu --web-download

Hope this helps someone.

dod0lp commented 3 months ago

Potential new fix: I simply hadn't had enabled Microsoft Store Install Service, perhaps this will help someone who needs fix next. I hadn't seen this issue with services before, so I'm adding it here. Hope this helps someone.

Yongna-Xing commented 2 months ago

I manually installed Ubuntu using the Add-AppxPackagecommand via Powershell, all the setup went smoothly and the installation and setup for the first time ran without any errors.

Then I opened the Powershell command prompt (run as admin) and typed wsl, Ubuntu actually worked without any errors. Even all commands are perfectly executed in that Ubuntu WSL environment

However, statements where WSL takes arguments won't work, such as wsl --install -d Ubuntu or wsl --update and any other WSL command that takes arguments, will both return error 0x80070422 (with the command wsl --install -d Ubuntu) and the error message: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. (with the wsl --update command).

There is another version of WSL, the WSL Preview version available on the Microsoft Store. And since I'm in the Windows Insider program, I thought maybe the current WSL is not compatible so I installed the WSL Preview on the Store, but still the same error occurs. And when I remove WSL Preview and go to windows features turn off Hyper-V and WSL and turn it back on, the error persists.

But when I manually install the Ubuntu distribution using the Appx installation file, everything is back to normal as if nothing happened.

I ran into the same problem from wsl --install -d Ubuntu. Could you provide more information on how to install ubuntu using Add-AppxPackagecommand via Powershell?