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

WSL --install Failing on Fresh Windows 11 Install #9453

Open
1 of 2 tasks
John-P opened this issue Jan 7, 2023 · 26 comments
Open
1 of 2 tasks

WSL --install Failing on Fresh Windows 11 Install #9453

John-P opened this issue Jan 7, 2023 · 26 comments

Comments

@John-P
Copy link

John-P commented Jan 7, 2023

Version

Windows 11 Home Build 22621.963

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

No response

Distro Version

No response

Other Software

No response

Repro Steps

  1. Install windows 11.
  2. Open terminal app.
  3. Run wsl --install

Expected Behavior

wsl --install on a (almost completely) clean Windows 11 install to install WSL2 and Ubuntu.

Actual Behavior

Produces an error even though Storage Settings for new content are the system drive (C).

Diagnostic Logs

"The deployment operation was blocked due to a per-package-family policy restricting deployments on a non-system volume. Per policy, this app must be installed to the system drive, but that's not set as the default. In Storage Settings, make the system drive the default location to save new content, then retry the install."

@John-P
Copy link
Author

John-P commented Jan 7, 2023

The only things modified since OS install are:

  1. Install one game via Xbox app (to D drive).
  2. Install discord via windows store (to C drive).
  3. Change default terminal to "Windows Terminal".

I simply followed the steps in this support article: https://learn.microsoft.com/en-us/windows/wsl/install. I am not used to Windows (I usually use macOS/Linux) and simply followed the steps.

The guide says "This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux.". However, do I need to enable "developer mode"? This is not mentioned.

@John-P
Copy link
Author

John-P commented Jan 9, 2023

I have investigated further. There appears to be a bug with syncing the settings between windows settings and the xbox app / wsl install. When I run wsl --install I hear the spinning disk spin up. However, the windows settings have the SSD (C drive) selected for new content in all options. The xbox app is set to use the spinning HDD (D drive). Something is inconsistent here.

Toggling the "New apps will save to" setting from C to D and back again fixed this!

However, this also changes the setting in the xbox app. These should probably be separate settings. There is also a clear UI synching bug here. Perhaps the user should also be notified that these are linked somehow as that is not clear.

Windows Storage Settings

storage settings new content

Xbox Settings

xbox settings

@j-melling
Copy link

Toggling the "New apps will save to" setting from C to D and back again fixed this!

Your workaround worked for me as well, thanks! My Xbox settings were set to another drive to save space on my OS drive.

@inoukt
Copy link

inoukt commented Apr 2, 2023

Toggling the "New apps will save to" setting from C to D and back again fixed this!

Your workaround worked for me as well, thanks! My Xbox settings were set to another drive to save space on my OS drive.

I confirm !!

@Dunc4n1dah0
Copy link

Thanks!

Toggling the "New apps will save to" setting from C to D and back again fixed this!

Your workaround worked for me as well, thanks! My Xbox settings were set to another drive to save space on my OS drive.

Worked for me too, thanks!

@gabriel8fm
Copy link

gabriel8fm commented May 25, 2023

I'm facing the same issue. I just got a new fresh installation of Windows 11 Pro. I just followed the same steps as @John-P did, and WSL is not working for me. Here are some screenshots:

As you can see in the below image, it shows that Ubuntu was installed, but it hangs on Launching Ubuntu...
image

Docker Desktop also hangs on this looping Starting Docker Engine...
image
image

I can't even run wsl --shutdown as it suggests because the command hangs.

Also, the LxssManager service is permanently stopped, even if I set the startup type as automatic. Every time I reboot/shut down the system, when Windows starts, the service is stopped.
image

I don't know what is going on if I am doing something wrong, but I've been using macOS/Linux as a DevOps Engineer, and now I give Windows a chance, and I can't use it.

Windows version I'm running:
image

FYI, that's not true for Windows 10. I was using it until today seamlessly. WSL working fine, Docker, and Kubernetes also. If there is any log information I could provide, please guide me and I will provide as much information as possible.

I will try ultimately reinstalling WSL on my current Windows 11 environment and provide more information if I get progress.

@gabriel8fm
Copy link

I'm facing the same issue. I just got a new fresh installation of Windows 11 Pro. I just followed the same steps as @John-P did, and WSL is not working for me. Here are some screenshots:

As you can see in the below image, it shows that Ubuntu was installed, but it hangs on Launching Ubuntu...

image

Docker Desktop also hangs on this looping Starting Docker Engine...

image image

I can't even run wsl --shutdown as it suggests because the command hangs.

Also, the LxssManager service is permanently stopped, even if I set the startup type as automatic. Every time I reboot/shut down the system, when Windows starts, the service is stopped.

image

I don't know what is going on if I am doing something wrong, but I've been using macOS/Linux as a DevOps Engineer, and now I give Windows a chance, and I can't use it.

FYI, that's not true for Windows 10. I was using it until today seamlessly. WSL working fine, Docker, and Kubernetes also. If there is any log information I could provide, please guide me and I will provide as much information as possible.

I will try ultimately reinstalling WSL on my current Windows 11 environment and provide more information if I get progress.

Quick update here @John-P and for anyone looking for a solution. I did some research over the internet and found this workaround that worked for me: #6405 (comment)

Now I am able to install Ubuntu and Debian distros, run Docker Desktop, enable the Kubernetes feature inside of it, etc.

@fkamp
Copy link

fkamp commented Sep 26, 2023

Same as the original poster; worked with same workaround
Edition Windows 11 Pro
Version 22H2
Installed on ‎22.‎09.‎2023
OS build 22621.2361
Experience Windows Feature Experience Pack 1000.22674.1000.0

@GamerJD75
Copy link

GamerJD75 commented Dec 2, 2023

Windows 11 Pro
Version 10.0.22635 Build 22635

My Ubuntu shell suddenly started giving "file not found" errors. I removed WSL & the needed files to try & start over from scratch.
When I went to reinstall I got the warning about it needing to be installed to my system drive, which was the selected choice.
Changing the app location from D & back to C doesn't resolve this.

Even Windows Store gives the "you must install to the system drive" when it attempts to pull down the WSL updates.

EDIT: I even checked the registry for where app installs are configured. It shows that the C drive is the volume to be used.
However, the "MediaId" and "Name" keys have somehow been blanked out.

I know how to get the "Name" value, but don't know where to find the proper "MediaId" value to see if correcting those fixes the issue...

Also confirmed that using the XBOX App to default installs to the D drive changes the following Registry value for default install volume.
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\PackageVolumes\DefaultVolumeKey

That was being changed to "2" every time I launched the XBOX App. So now I have to have it configured for C (which I don't want) and to prompt for the install location every time.

EDIT 2: Added feedback for the XBOX App itself, since this issue has been reported for so long here on github.
https://aka.ms/AAnyhxu

@novafluxx
Copy link

I'm also now having this problem as of earlier this week.

@lusky3
Copy link

lusky3 commented Dec 11, 2023

OS Name Microsoft Windows 11 Pro
Version 10.0.22631 Build 22631

Had a working Ubuntu WSL environment.
Ran wsl --update --pre-release
After the update installed, tried to launch Ubuntu, the default wsl help came up. Soon discovered it doesn't think Ubuntu is there (checked the AppData, the vhdx is still there).
Tried to run wsl --install -d Ubuntu or wsl --install and get the error noted in this report.

Installing: Windows Subsystem for Linux
The deployment operation was blocked due to a per-package-family policy restricting deployments on a non-system volume. Per policy, this app must be installed to the system drive, but that's not set as the default. In Storage Settings, make
 the system drive the default location to save new content, then retry the install.

My Settings > Storage all have the default drive to C:\. My Xbox App uses E:\.
I tried changing the Xbox default back to C:\ and toggling the "New apps will save to" setting from C:\ to D:\, saved it, and changed back to C:\ but this did not resolve it.

@novafluxx
Copy link

OS Name Microsoft Windows 11 Pro Version 10.0.22631 Build 22631

Had a working Ubuntu WSL environment. Ran wsl --update --pre-release After the update installed, tried to launch Ubuntu, the default wsl help came up. Soon discovered it doesn't think Ubuntu is there (checked the AppData, the vhdx is still there). Tried to run wsl --install -d Ubuntu or wsl --install and get the error noted in this report.

Installing: Windows Subsystem for Linux
The deployment operation was blocked due to a per-package-family policy restricting deployments on a non-system volume. Per policy, this app must be installed to the system drive, but that's not set as the default. In Storage Settings, make
 the system drive the default location to save new content, then retry the install.

My Settings > Storage all have the default drive to C:\. My Xbox App uses E:\. I tried changing the Xbox default back to C:\ and toggling the "New apps will save to" setting from C:\ to D:\, saved it, and changed back to C:\ but this did not resolve it.

This is the exact same thing that is happening for me.

@meowzhin
Copy link

meowzhin commented Jan 2, 2024

Did anyone else managed to fix this? It simply stopped working and I can't understand what's going on. I tried everything but formatting the pc.

@KeaCluster
Copy link

OS Name Microsoft Windows 11 Home
Version 10.0.22631 Build 22631

I might've found a secondary fix to implement alongside switching the default drive.

After running wsl --update --pre-release my installation was also bricked.
So I uninstalled with wsl --unregister and decided to run wsl --install again
This didn't work:

Installing: Windows Subsystem for Linux
The deployment operation was blocked due to a per-package-family policy restricting deployments on a non-system volume. Per policy, this app must be installed to the system drive, but that's not set as the default. In Storage Settings, make the system drive the default location to save new content, then retry the install.

I disabled and then enabled Windows Subsystem for Linux directly from Windows Features and then restarted.

By this point any --online distro should work tbh

I tried installing Arch but got an error:

WslRegisterDistribution failed with error: 0x800701bc WSL 2 requires an update to its kernel component

So I then installed the Kernel from the given url: aka.ms/wsl2kernel

And Arch is now working properly

@elkwood
Copy link

elkwood commented Jan 6, 2024

So I then installed the Kernel from the given url: aka.ms/wsl2kernel

This fixed it for me

@novafluxx
Copy link

I managed to fix this by running wsl --install --inbox and then running wsl --install --web-download

@tomzazo
Copy link

tomzazo commented Jan 11, 2024

Toggling the "New apps will save to" setting from C to D and back again fixed this!

Can confirm, changing and reverting the default Windows storage locations fixed the issue.

For some reason it didn't work just by changing the location for the new apps though, I had to do this with all of the default locations listed. I also made sure the Xbox App had the same default installation location set as in the Windows storage settings. Only then did the wsl --install start working as expected.

@nannerpusser
Copy link

Same issue just happened to me after I had to do a System Restore and then reinstalled a game using the Xbox PC App/Windows Store. I set the download location to my secondary large D: drive, which had worked fine before and caused no problems with WSL, but this time I got "Could not access specified file" or something similar if I ran wsl from a Terminal. So I reinstalled and got OP's error.

The issue is 100% a problem using the Xbox App to install games to non-system partitions. No idea why it affects WSL, but it is still happening on Win 11 Pro in 2024.

@armanatz
Copy link

armanatz commented Jan 23, 2024

Just wanted to say that none of the fixes here worked for me. So I had to dig deeper to check what's going on for my specific case.

In my situation, I had run wsl --update on a pre-existing WSL install and that completely bricked my installation. Tried reinstalling WSL but to no avail.

On one of the reinstall instances, I opened up and looked inside the Event Viewer logs and it turns out that WSL was trying to install itself to my E:\ drive even though both Windows and Xbox app settings pointed to my C:\ drive as the default location.

I disabled that drive in my BIOS and brute-forced the installation to then occur on the C:\ drive. However, I hit another issue where it said "The system cannot find the path specified" after running wsl --install.

More digging in Event Viewer revealed that the Appx Package Manager was trying to find a file called AppxManifest.xml in the WSL package and failing.

Opened up an admin Powershell, navigated to the default C:\Program Files\WindowsApps folder and tried to run ls on the WSL package folder. Got an error. Seems like it was corrupted somehow.

Used Get-AppxPackage -allusers in the same Powershell session to get the list of all packages installed and found the offending WSL package that was causing an issue.

Ran Remove-AppxPackage -Package 'MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.14.0_x64__8wekyb3d8bbwe' (this is the package on my system giving an issue, yours may be different).

I then checked to see if, in the Optional Features of Windows, all of the required dependencies for WSL were enabled. I saw that "Windows Subsystem For Linux" was disabled so I enabled it and restarted my PC.

Finally, ran wsl --update again and voila, everything worked beautifully.

For where to look in Event Viewer to find out the necessary info, follow the "Get Diagnostic Information" section of this doc from Microsoft. It specifies two areas that pertains to AppxPackage troubleshooting.

Hopefully this helps someone out there who faces the same niche issue as me.

@rhonivanpareja
Copy link

Just wanted to say that none of the fixes here worked for me. So I had to dig deeper to check what's going on for my specific case.

In my situation, I had run wsl --update on a pre-existing WSL install and that completely bricked my installation. Tried reinstalling WSL but to no avail.

On one of the reinstall instances, I opened up and looked inside the Event Viewer logs and it turns out that WSL was trying to install itself to my E:\ drive even though both Windows and Xbox app settings pointed to my C:\ drive as the default location.

I disabled that drive in my BIOS and brute-forced the installation to then occur on the C:\ drive. However, I hit another issue where it said "The system cannot find the path specified" after running wsl --install.

More digging in Event Viewer revealed that the Appx Package Manager was trying to find a file called AppxManifest.xml in the WSL package and failing.

Opened up an admin Powershell, navigated to the default C:\Program Files\WindowsApps folder and tried to run ls on the WSL package folder. Got an error. Seems like it was corrupted somehow.

Used Get-AppxPackage -allusers in the same Powershell session to get the list of all packages installed and found the offending WSL package that was causing an issue.

Ran Remove-AppxPackage -Package 'MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.14.0_x64__8wekyb3d8bbwe' (this is the package on my system giving an issue, yours may be different).

I then checked to see if, in the Optional Features of Windows, all of the required dependencies for WSL were enabled. I saw that "Windows Subsystem For Linux" was disabled so I enabled it and restarted my PC.

Finally, ran wsl --update again and voila, everything worked beautifully.

For where to look in Event Viewer to find out the necessary info, follow the "Get Diagnostic Information" section of this doc from Microsoft. It specifies two areas that pertains to AppxPackage troubleshooting.

Hopefully this helps someone out there who faces the same niche issue as me.

This solution worked wonderfully on my machine as i have a very old WSL2 installation. thanks a lot!

@christopher-r-doucet
Copy link

Just wanted to say that none of the fixes here worked for me. So I had to dig deeper to check what's going on for my specific case.

In my situation, I had run wsl --update on a pre-existing WSL install and that completely bricked my installation. Tried reinstalling WSL but to no avail.

On one of the reinstall instances, I opened up and looked inside the Event Viewer logs and it turns out that WSL was trying to install itself to my E:\ drive even though both Windows and Xbox app settings pointed to my C:\ drive as the default location.

I disabled that drive in my BIOS and brute-forced the installation to then occur on the C:\ drive. However, I hit another issue where it said "The system cannot find the path specified" after running wsl --install.

More digging in Event Viewer revealed that the Appx Package Manager was trying to find a file called AppxManifest.xml in the WSL package and failing.

Opened up an admin Powershell, navigated to the default C:\Program Files\WindowsApps folder and tried to run ls on the WSL package folder. Got an error. Seems like it was corrupted somehow.

Used Get-AppxPackage -allusers in the same Powershell session to get the list of all packages installed and found the offending WSL package that was causing an issue.

Ran Remove-AppxPackage -Package 'MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.14.0_x64__8wekyb3d8bbwe' (this is the package on my system giving an issue, yours may be different).

I then checked to see if, in the Optional Features of Windows, all of the required dependencies for WSL were enabled. I saw that "Windows Subsystem For Linux" was disabled so I enabled it and restarted my PC.

Finally, ran wsl --update again and voila, everything worked beautifully.

For where to look in Event Viewer to find out the necessary info, follow the "Get Diagnostic Information" section of this doc from Microsoft. It specifies two areas that pertains to AppxPackage troubleshooting.

Hopefully this helps someone out there who faces the same niche issue as me.

Just wanted to say this worked for me as well when toggling C: and D: drives in storage settings failed.

@lusky3
Copy link

lusky3 commented Mar 7, 2024

I then checked to see if, in the Optional Features of Windows, all of the required dependencies for WSL were enabled. I saw that "Windows Subsystem For Linux" was disabled so I enabled it and restarted my PC.

Just a note here, Windows Subsystem For Linux from Optional Features should not be enabled for WSL2.

As far as I recall, that is only for Legacy use. For WSL2, it was moved to the Microsoft Store so it could be updated independently from the OS. The command "wsl --install" also pulls from the Microsoft Store. I don't know personally if it will "break" anything or give you limited functionality, but it's not supposed to be enabled.

@MaxNadeev
Copy link

Hey, guys. it's my way to solve this problem:

1/
First I set storage to C:
I found this idea here:https://learn.microsoft.com/en-us/windows/wsl/troubleshooting?source=recommendations

2024-03-25_230248

2/
and downloaded and tried to install wsl.2.1.4.0.x64.msi from here: https://github.com/microsoft/WSL/releases/download/2.1.4/wsl.2.1.4.0.x64.msi in the middle of installation I've got an error and installation wasn't finish but I think it was useful operation
I found this idea here: #11275
Here is result screenshot
2024-03-25_230623

3/
I used command wsl --shutdown and wsl --update from Command prompt with admin rights. As I have got shutdown worked, but update no.
I have got this idea here https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
Here you are result screenshot:
2024-03-25_230729

4/
Maybe here I reboot my machine or maybe not yet I don't remember for sure.

5/
I installed ubuntu with command wsl --install -d Ubuntu
I've got this idea here: #9453 (comment)
Here is screenshot with a result
2024-03-25_231337

6/
After some time when progress bar in console was filled on 100% terminal with Linux appeared where linux asked me to create new user and password for it. I did it.
Here you are result screenshot
2024-03-25_231614
I tried to start my docker desktop, but it still couldn't start its engine
2024-03-25_231714

7/
after some docker desktop quit with an error
Docker desktop - unexpected WSL error.
An unexpected error was encountered while executing a WSL command. Common causes include excess rights issues, which occur after waking the computer or not being connected to your domain/active directory.
Please try shooting WSL down (wsl --shutdown) and/or rebooting your computer. If not sufficient WSL may need to be reinstalled fully. Bla bla bla...
Screenshot:
2024-03-25_231928

8/
Here I reboot my machine.
Idea from intuition

9/
I started my docker, and it's again quit with an error, but error was already different.

Docker desktop - WSL drive missing.
The Docker desktop WSL data destroy drive is missing.
The Docker desktop WSL data distro is registered with WSL, but its drive seems to be missing. If this issue persists, run "wsl --unregister docker-desktop-data" before restarting Docker Desktop. Note that unregistering the data destroy will delete any previously created containers.

As it's not difficult to understand docker wants me to run command wsl --unregister docker-desktop-data from terminal. I didn't close error message and opened terminal with administrator previledges and type there wsl --unregister docker-desktop-data
It successfully unregistered what he needed.
Screenshot, here you are
2024-03-25_232607

10/
Finally docker's engine started!
2024-03-25_232646

I hope this was useful for you, if this was useful push reaction below.
With love from Russia 💖

@ghost ghost self-assigned this Mar 29, 2024
@mars2nico
Copy link

mars2nico commented Mar 30, 2024

almost same.

the command wsl returns an error "Class not registered", althoug wsl --install was successfully finished.

the command Remove-AppxPackage -Package 'MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.14.0_x64__8wekyb3d8bbwe' has been helpful for me.

Version

Windows 11 Build 22631

@ghost
Copy link

ghost commented Apr 10, 2024

This looks the same as what I'm addressing in other bugs. If you're willing to try the below I'd appreciate it.

This is not an official build, if you still see issues when trying this build, please get back to me with more logs from this post, in addition to our logs. #11319 (comment)
https://1drv.ms/u/s!ApJY8OVsSSJ-gQn_I1D8e4y45kJq?e=yJEOlc

@docdann
Copy link

docdann commented Oct 20, 2024

Install from https://github.com/microsoft/WSL/releases. This fixed it for me

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

No branches or pull requests