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

WSL2: Virtual hard disk files must be uncompressed and unencrypted and must not be sparse #4103

Open
squeaky-pl opened this issue Jun 13, 2019 · 13 comments

Comments

Projects
None yet
8 participants
@squeaky-pl
Copy link

commented Jun 13, 2019

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:

Screenshot_205

  • What's wrong / what should be happening instead:

I should get a brand new distro under WSL2.

@squeaky-pl

This comment has been minimized.

Copy link
Author

commented Jun 13, 2019

Attaching logs.

logs.zip

@squeaky-pl

This comment has been minimized.

Copy link
Author

commented Jun 13, 2019

OK, I managed to resolve it by myself after some intensive Googling by running those two commands:

fsutil behavior set disableencryption 1
fsutil behavior set disablecompression 1

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?

@benhillis

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

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.

@caffme

This comment has been minimized.

Copy link

commented Jun 13, 2019

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.

shot_190613_171648

wsllogs.zip

@caffme

This comment has been minimized.

Copy link

commented Jun 13, 2019

Also, after hitting the error subsequent attempts give a different error: "The operation timed out because a response was not received from the virtual machine or container." unless I use hcsdiag to kill the wsl container.

shot_190613_181110

@dmchurch

This comment has been minimized.

Copy link

commented Jun 13, 2019

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.

@dmchurch

This comment has been minimized.

Copy link

commented Jun 13, 2019

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 wsl --set-version command should work.

@illera88

This comment has been minimized.

Copy link

commented Jun 13, 2019

I had the same error. Fixed with a combination of @squeaky-pl and @dmchurch solutions

@caffme

This comment has been minimized.

Copy link

commented Jun 14, 2019

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

@krzys-h

This comment has been minimized.

Copy link

commented Jun 22, 2019

Thanks, the workaround of manually disabling compression on %localappdata%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc worked for me. My guess is that the compression was enabled by the update that started doing that automatically a while ago to free up space for more updates (except from my experience it never actually decompresses them afterwards, unlike what the official website says)

@jsbarrett

This comment has been minimized.

Copy link

commented Jul 2, 2019

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.

@WSLUser

This comment has been minimized.

Copy link

commented Jul 3, 2019

When creating the VHD's I'll make sure that compression and encryption are both disabled on them.

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.

@benhillis

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

@WSLUser - Indeed, we are looking into better solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.