microsoft / WSL

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

Windows 11 - WSL2 takes 10+ minutes to launch #11692

Closed plasma-vision closed 3 weeks ago

plasma-vision commented 3 weeks ago

Windows Version

Microsoft Windows [Version 10.0.22631.3737]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.146.1-microsoft-standard-WSL2

Distro Version

Ubuntu 24.04, Ubuntu 22.04, Kali Linux

Other Software

Cisco AnyConnect Secure Mobility Client 4.10.08029 (this has known issues with WSL2, but I don't seem to be having problems with the networking)

Repro Steps

Start from a freshly booted computer. Launch a WSL Linux distro, or run a WSL.EXE command. Wait.................... ............................. .............................

Expected Behavior

I expect it to launch in less than a minute (previously it would launch in under 10 seconds).

Actual Behavior

I've tried 3 distros (Ubuntu 22.04, Ubuntu 24.04 and Kali Linux) and they all have the same problem. Even trying to run wsl.exe commands takes 10+ minutes.

dmesg shows long gaps in time between _hvballoon and /sbin/ldconfig, then another gap between some Ioctl failed messages for dxgk and /sbin/ldconfig.real

See attached snippit from dmesg output.

I've fully uninstalled WSL and reinstalled, but the issue persists.

I've tried re-installing the NVIDIA drivers for Windows because the dxgk errors appear to be related to DirectX. I tried disabling the GPU (gpuSupport=false) in .wslconfig, and that got rid of the Ioctl failures, but the loading of WSL took even longer.

Is anyone else experiencing this?

[    1.731326] EXT4-fs (sdc): mounted filesystem with ordered data mode. Opts: discard,errors=remount-ro,data=ordered. Quota mode: none.
[   49.650182] hv_balloon: Max. dynamic memory size: 16234 MB
[  375.557342] /sbin/ldconfig:
[  375.557345] /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link

[  375.701335] FS-Cache: Duplicate cookie detected
[  375.701705] FS-Cache: O-cookie c=00000008 [p=00000002 fl=222 nc=0 na=1]
[  375.701948] FS-Cache: O-cookie d=0000000085840207{9P.session} n=0000000035e3d955
[  375.702193] FS-Cache: O-key=[10] '34323934393734383430'
[  375.702372] FS-Cache: N-cookie c=00000009 [p=00000002 fl=2 nc=0 na=1]
[  375.702608] FS-Cache: N-cookie d=0000000085840207{9P.session} n=00000000c5a37aa8
[  375.702859] FS-Cache: N-key=[10] '34323934393734383430'
[  375.875271] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[  375.875671] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[  375.876001] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[  375.876328] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
[  375.877581] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[  375.877915] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[  375.878203] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[  375.878553] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
[  739.908389] /sbin/ldconfig.real:
[  739.908392] /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link

Diagnostic Logs

No response

github-actions[bot] commented 3 weeks ago

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](https://github.com/Microsoft/WSL/blob/master/diagnostics/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 scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

plasma-vision commented 3 weeks ago

Well, moments after posting this, I managed to fix it. I tried running wsl.exe --status, which timed out with a memory error, so I thought to try looking at Windows virtual memory settings (something I haven't thought of for years). It was set to "Automatically manage paging file size for all drives". I unchecked that. Chose "no paging file" and clicked set. Then I changed my mind and switched back to "System managed size", and re-enabled "Automatically manage paging file size for all drives" and clicked OK. It asked me to reboot, and now WSL launches quickly every time. This seems like a totally random fix, if in fact that is what fixed the issue, but if you are having the same problem, give it a try. I had been trying to fix this for weeks.

plasma-vision commented 3 weeks ago

I guess we can close this, since I was able to fix it. I'm still puzzled about why this was an issue, but I've wasted enough time on it already. I hope it helps someone else facing the same issue.