WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Failed to attach disk 'D:\WSL2Distros\ext4.vhdx' to WSL2: Access is denied. Error code: Wsl/Service/CreateInstance/MountDisk/HCS/E_ACCESSDENIED

Open kgeo opened this issue 1 month ago • 13 comments

After a wsl --manage Ubuntu --move D:\WSL2Distros\ when trying to start Ubuntu under Windows Terminal I get:

Failed to attach disk 'D:\WSL2Distros\ext4.vhdx' to WSL2: Access is denied.
Error code: Wsl/Service/CreateInstance/MountDisk/HCS/E_ACCESSDENIED

I tried to assign all permissions to my standard user. I also tried to change owner from my user to Administrator, and finally back again. Nothing helped.

kgeo avatar Nov 23 '25 17:11 kgeo

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions[bot] avatar Nov 23 '25 17:11 github-actions[bot]

Here are the logs:

WslLogs-2025-11-23_19-24-49.zip

kgeo avatar Nov 23 '25 17:11 kgeo

Diagnostic information
Detected appx version: 2.6.1.0
Detected user visible error: Wsl/Service/CreateInstance/MountDisk/HCS/E_ACCESSDENIED

github-actions[bot] avatar Nov 23 '25 17:11 github-actions[bot]

@kgeo: Interesting, could you share the permissions on that file ? (D:\WSL2Distros\ext4.vhdx)

OneBlue avatar Nov 25 '25 22:11 OneBlue

PS D:\WSL2Distros> Get-Acl .\ext4.vhdx
    Directory: D:\WSL2Distros
Path      Owner         Access
----      -----         ------
ext4.vhdx BIGBOY\Kostas NT AUTHORITY\Authenticated Users Allow  FullControl...

kgeo avatar Nov 26 '25 13:11 kgeo

Kostas is my account.

Then I thought, let's try to move it back. And you know what: it worked! Same permissions!

PS D:\WSL2Distros> Get-Acl C:\Users\Kostas\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx
    Directory: C:\Users\Kostas\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState
Path      Owner         Access
----      -----         ------
ext4.vhdx BIGBOY\Kostas NT AUTHORITY\Authenticated Users Allow  FullControl...

It gets curiouser and curiouser...

kgeo avatar Nov 26 '25 13:11 kgeo

There is however this:

Image

I assume you can see that dead Account. No idea what it could be. My Windows (10) installation is at least 7 or 8 years old. I only converted it to 11 a month or so ago.

kgeo avatar Nov 26 '25 13:11 kgeo

Interesting. That's probably the root cause of the issue you're seeing.

Does WSL start successfully if you manually give "Full Control" to your Windows account ?

OneBlue avatar Nov 26 '25 19:11 OneBlue

I've got the same issue, move WSL distro to another drive, access is denied.

Gave full control to my user account, still nothing. I did notice that I have an attribute of E on the vhdx, unable to turn off file encryption (parameter is incorrect)

EDIT: Heh, I can't even move it back now

wsl --manage "Ubuntu" --move "C:\Users\Domin\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState"
Access is denied.
Error code: Wsl/Service/MoveDistro/E_ACCESSDENIED

EDIT2:

Fixed on my end by moving Ubuntu to my T drive, then running the above move command (which gets redirected to T via a symlink I think), now works.

DominicMaas avatar Nov 26 '25 20:11 DominicMaas

I set all accounts to full access at the d: drive. And they are still there after the move back.

kgeo avatar Nov 26 '25 20:11 kgeo

That's surprising. Could you capture logs WSL failing to start after updating the file access ?

OneBlue avatar Nov 26 '25 20:11 OneBlue

The logs above are after I gave full access. And because I didn't know which user wsl was trying to use I gave full access to Kostas Administrator, AND the respective groups Administrators and Users.

On Wed, Nov 26, 2025, 22:31 Blue @.***> wrote:

OneBlue left a comment (microsoft/WSL#13775) https://github.com/microsoft/WSL/issues/13775#issuecomment-3583118474

That's surprising. Could you capture logs WSL failing to start after updating the file access ?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/WSL/issues/13775#issuecomment-3583118474, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANR3POG2AD7UJVKXS3GCXD36YE3NAVCNFSM6AAAAACM6SXJN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKOBTGEYTQNBXGQ . You are receiving this because you were mentioned.Message ID: @.***>

kgeo avatar Nov 26 '25 20:11 kgeo

Hmm OK then I can think of two other things that would cause this:

  1. Does your user account also have full access to the parent folder ?

  2. Is the parent folder a symlink, hardlink, or mountpoint ? The VHD driver tends not to like those.

OneBlue avatar Nov 26 '25 20:11 OneBlue

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-file it as a new issue.

Thank you!