microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.45k stars 822 forks source link

WSL Freeze When Accessing Windows Drives #9842

Open groboclown opened 1 year ago

groboclown commented 1 year ago

Windows Version

Microsoft Windows [Version 10.0.19044.2728]

WSL Version

1.1.3.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.90.1-microsoft-standard-WSL2

Distro Version

Archlinux

Other Software

tmux gcc cmake bash

Repro Steps

I attempted to run the Codon build on files located on the Windows drive (linked to the /home/ directory from the /mnt/c drive).

Expected Behavior

It doesn't freeze.

Actual Behavior

I've attempted this about 8 times, all with the same behavior. Some times have been through a podman container, others have been in a bare WSL terminal. The build gets to compiling anywhere from 1000 to 3030 files (out of 3292 files) when it freezes. At this point, I can open new WSL terminals in the same distro, and examine the WSL local files, but any attempt to look at the Windows native files (such as ls /mnt/c or cd /mnt/c) causes the terminal to hang.

In some cases, ls /mnt causes a hang, in others ls /mnt/c causes the hang.

Diagnostic Logs

WslLogs-2023-03-24_12-55-39.zip

These logs are from after the freeze is encountered, and I ran ls /mnt then ls /mnt/c which caused the hang to occur.

groboclown commented 1 year ago

To follow up, running "wsl --shutdown" will allow new WSL distros to start with proper drive access. A reboot isn't necessary.

alanchen222 commented 1 year ago

I have the same issue

JingbiaoMei commented 1 year ago

Same issue even after reinstalling wsl2.

qf-wei commented 11 months ago

Same here, any updates?

koji-dev commented 11 months ago

Same here, Windows version: 10.0.19045.3693, WSL 2.0.9.0, Ubuntu 20.04.6 LTS, Kernel version: 5.15.133.1-1 Ubuntu terminal is frozen with command "cd /mnt/c". but when i open new terminal, it is still alive. But if type "cd /mnt/c", the terminal freeze. It means WSL2 is still alive, but lost access or hangs to specific drive. Only one drive which I run code is frozen after a period(2-30mins).

[Update] I switch from WSL2 to WSL1. It works for me. (I understand everyone can not change version, though..) Find distribution name, then set wsl version to 1.

wsl -l -v
wsl --set-version Ubuntu-20.04 1
JingbiaoMei commented 10 months ago

Same issue even after reinstalling wsl2.

Switched to ubuntu...

JingbiaoMei commented 10 months ago

Temporarily solution: Softlink the required windows drive directories to home directory of wsl seems a work around.

nbopardi commented 9 months ago

Also experiencing this issue for WSL2 on Windows 11 for Ubuntu 18.04.06 LTS.

@JingbiaoMei is there a guide you followed to softlink the windows drive? The closest answer I found online was https://stackoverflow.com/a/76181147

tchristensenowlet commented 8 months ago

Same here on Windows 11. The softlink workaround didn't work for me

JingbiaoMei commented 8 months ago

Also experiencing this issue for WSL2 on Windows 11 for Ubuntu 18.04.06 LTS.

@JingbiaoMei is there a guide you followed to softlink the windows drive? The closest answer I found online was https://stackoverflow.com/a/76181147

@nbopardi Sorry for the late reply. I used the ln -s command. This has been worked smoothly for me for over a month now, even when accessing millions of image files

UesugiErii commented 7 months ago

For me, I found that I had enabled TPM in the BIOS but Windows did not recognize it. Then I turned off AMD CPU's PBO and after restarting, TPM was recognized. Then I updated the WSL2 version and I haven't had any issues with file system access since then.

The above content works for me at least, for reference only.