WSL: WSL --install Failing on Fresh Windows 11 Install

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

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

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 9
  • Comments: 26

Most upvoted comments

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

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.

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.

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.

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.

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 !!

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!

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

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: https://github.com/microsoft/WSL/issues/11275?ysclid=lu7cnswu3b494546470 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: https://github.com/microsoft/WSL/issues/9453#issuecomment-1851032020 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 💖

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

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: https://github.com/microsoft/WSL/issues/6405#issuecomment-1297311116

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

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!

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.