-
Notifications
You must be signed in to change notification settings - Fork 823
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
WSL2: Virtual hard disk files must be uncompressed and unencrypted and must not be sparse #4103
Comments
Attaching logs. |
OK, I managed to resolve it by myself after some intensive Googling by running those two commands:
and rebooting. Now it just works™ Nonetheless I dont remember changing anything about NTFS behavior myself. Could it be that my laptop manufacturer (Dell) did it? Maybe this should be handled more gracefully by WSL2. Could WSL2 set those properties per virtual hard disk file to prevent others from hitting this? |
Thank you very much for filing this issue. It's interesting that I'm not seeing that error in the logs, I'll have to dig into why that isn't showing up. I am seeing an invalid parameter error when trying to mount the VHD, so I bet that's the inner error. When creating the VHD's I'll make sure that compression and encryption are both disabled on them. |
I can not update my existing distro, I am getting the same error in PS when trying to run the wsl --set-version. The workaround (set disableencryption and disablecompression, followed by reboot) did not help. I can install a different distro and that works. I only tried that after I tried the workaround. |
I'm encountering the same issue as @caffme. I assume this is because the folder the VHD is supposed to go into is marked as compressed or something, even though I've done the fsutil workaround. Where is the WSL2 VHD supposed to be located? I can't find any documentation on that, even though the "expand your VHD" documents mention putting in the path to it. |
Okay, after some lucky guesses I've confirmed it and I have an addendum to the workaround (cc @caffme in case this works for you as well) - go to the Ubuntu directory in your profile folder (something like %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited...), right click on "LocalState", Properties, Advanced, deselect "Compress contents" (and I suppose "Encrypt contents" as well if that's checked). When it asks whether you want to apply to just this folder or to all subfolders and files, you can say "just this folder", because all you're doing is clearing that "compress" flag. After that the |
I had the same error. Fixed with a combination of @squeaky-pl and @dmchurch solutions |
@dmchurch Thanks, yes that worked for me. I wondered about checking that but had no idea where WSL stored anything, good hunting! @benhillis I am fairly sure that I didn't set the compressed flag myself. C:\Users\James\AppData\Local\Packages was the highest folder in the tree that had the compressed flag and I would not have done that manually. |
Thanks, the workaround of manually disabling compression on |
Just wanted to drop in and say thanks to @dmchurch for the tip about uncompressing those folders (and everyone else in the discussion helping each other find answers) And afterwards I got the error about timing out ... so I just restarted the computer and tried again and it worked just fine. |
Shouldn't the more correct solution be to support compression/decompression and encryption/decryption like you would with any other VHD utility? I'd say disabling is a good hot fix, but will need revisiting. |
@WSLUser - Indeed, we are looking into better solutions. |
Here's what worked for me... Go to this link: https://docs.microsoft.com/en-us/windows/wsl/install-win10 When you're installing linux distro, do option 3: Download and manually unpack and install (for Windows Server - instructions here) |
I tried @dmchurch and @squeaky-pl solutions, and although I got rid of the "The requested operation could not be completed due to a virtual disk system limitation", now I am getting:
|
Just ran into this issue and had to restart the computer a few times before I saw my distro running under |
Based on my experience, because of this command, I cannot install windows terminal from windows store, so I set it back to zero, |
Decompressing the *.vhdx file won't work as you still won't be able to get the network connection from WSL2. Unless you don't plan to apt update ever again that is. |
Worked for me, thanks |
Please in the error message at least tell me which file is wrong! Yes, I have compressed I get a random error when starting Ubuntu, and I get a flash of a command line when starting bash. Please add some user facing error handling, compressing and encrypting disks nowadays is pretty commonplace, isn't it? |
I have been working on an issue which relates to this and so far I have not been able to reproduce this in windows 11. Does this issue occur when only the |
Should be either. My drive was not compressed, only a select few space-wasting files. I'm still on Windows 10 ("the last" 😅) though. |
Dropping in to say I had this issue and I couldn't solve it for the life of me until I realized the drive was set for "Compress this drive to save disk space" in Disk Management |
Ran into same error: 0xc03a0001a. Tried advice from @squeaky-pl Then advice from @dmchurch to locate Still encountered error. Then...tried checking the "compress contents" and applying the change. Received an error that compression couldn't be applied since the location was de-compressed (from executing the fsutil command previously). So unchecked the box and applied (to all subfolders). Did the same for the other folder in the Packages folder (there were two CanonicalGroupLimited Ubuntu folders), restarted and the install went through...finally! Wanted to let folks know in case it was helpful to someone who tried this advice already and was still running into the issue. Thanks @dmchurch and @squeaky-pl. After combining your advice and undoing/redoing the folder compression, it worked! |
this worked for me as well! |
Deselecting only the I didn't even have to restart anything before running Thank you. |
@krzys-h is spot on, that KB4023057 appears to compress that folder %USERPROFILE%\AppData\Local\Packages\ but the KB article says it will uncompress it when it's done, but that is false. It keeps everything compressed all the time, and thus this super long thread on why a simple command line "wsl --set-version ubuntu 2" doesn't work. |
WORKS for me . Thanks @dmchurch |
Works for me as of today. Difference was that I uncompressed all subfolders from the distro folder but finally got a "Conversion complete" message when setting version to 2. |
For me it's now works 😠 I have a problem with docker and to larg space for wsl (36 Gb). I tried to do something about it. I deleted all the docker containers, but only 3 GB freed up and they ran out after 2 weeks. I also came across this command that could help me: And when I try to remove encryption, I get this |
This error might also occur if you have manually set your WSL instance into sparse mode. |
I deleted the entire CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc folder and my Ubuntu no longer works at all. I've tried everything, the error that appears in the Ubuntu application is Installing, this may take a few minutes... |
For me, nothing above was working, I just kept getting the "must not be encrypted or compressed" error. Even
|
My situation was a little different than @leodagostino.
|
I solved this issue by runnig the following from here: |
The error "The requested operation could not be completed due to a virtual disk system limitation. Virtual hard disk files must be uncompressed and unencrypted and must not be sparse" could also appear if you are using Windows Subsystem for Android (WSA). Using these commands should do the trick:
+
(We don't have any --set-sparse option for WSA.) You might also need to manually untick "Compress contents to save disk space" (Properties -> Advanced) for userdata.vhdx and metadata.vhdx. Then, if you want to shrink the VHDX files, you should be able to run via PowerShell:
Another alternative for After you shrink the VHDX files, set sparse back:
And WSA will work afterward. I leave this comment since this topic is very popular among Google search results, and it might be useful for people using WSA. |
https://learn.microsoft.com/windows/wsl/wsl-config
[experimental] |
Been searching for a while how to recover a .vhdx drive that was made Windows-unmountable by nbd (in Linux). Thank you. |
Please fill out the below information:
Your Windows build number: Microsoft Windows [Version 10.0.18917.1000]
What you're doing and what's happening:
I am trying to launch new distro under WSL2. I did first
wsl --set-default-version 2
, went to the shop and downloaded Ubuntu. Then I went to Start and clicked Ubuntu. After couple of seconds I was greeted with following error:I should get a brand new distro under WSL2.
The text was updated successfully, but these errors were encountered: