WSL: GPU resource cannot be used in wsl2: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22/-2

Windows Version

10.0.22631.3155

WSL Version

2.1.4.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu20.04

Other Software

NVIDIA-SMI 550.60.01 Driver Version: 551.76 CUDA Version: 12.4

Repro Steps

I have a RTX3070Ti type GPU in my laptop, and I am using wsl2 with nvidia driver and cuda installed.

Initially, after I run my wsl -d Ubuntu-20.04, I saw “libcuda.so.1 is not a symbolic link” in my dmesg log, after I deleted the orignal libcuda.so.1 and libcuda.so files by running the following code in my powershell:

cd C:\Windows\System32\lxss\lib
rm libcuda.so
rm libcuda.so.1
wsl -e /bin/bash
ln -s libcuda.so.1.1 libcuda.so.1
ln -s libcuda.so.1.1 libcuda.so

I still get this error message in my dmesg log: [ 0.593906] EXT4-fs (sdc): mounted filesystem with ordered data mode. Opts: discard,errors=remount-ro,data=ordered. Quota mode: none. [ 0.868684] FS-Cache: Duplicate cookie detected [ 0.868920] FS-Cache: O-cookie c=00000008 [p=00000002 fl=222 nc=0 na=1] [ 0.869171] FS-Cache: O-cookie d=00000000f48f82d2{9P.session} n=0000000041b2bec2 [ 0.869359] FS-Cache: O-key=[10] ‘34323934393337333737’ [ 0.869533] FS-Cache: N-cookie c=00000009 [p=00000002 fl=2 nc=0 na=1] [ 0.869739] FS-Cache: N-cookie d=00000000f48f82d2{9P.session} n=00000000254caff7 [ 0.869983] FS-Cache: N-key=[10] ‘34323934393337333737’ [ 1.019739] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22 [ 1.020297] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22 [ 1.020621] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22 [ 1.021025] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2 [ 1.021994] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22 [ 1.022328] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22 [ 1.022633] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22 [ 1.023063] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2 [ 1.121705] FS-Cache: Duplicate cookie detected [ 1.122075] FS-Cache: O-cookie c=0000000f [p=00000002 fl=222 nc=0 na=1] [ 1.122362] FS-Cache: O-cookie d=00000000f48f82d2{9P.session} n=00000000afce7235 [ 1.122634] FS-Cache: O-key=[10] ‘34323934393337343032’ [ 1.122871] FS-Cache: N-cookie c=00000010 [p=00000002 fl=2 nc=0 na=1] [ 1.123121] FS-Cache: N-cookie d=00000000f48f82d2{9P.session} n=00000000f2f4c832 [ 1.123445] FS-Cache: N-key=[10] ‘34323934393337343032’

Expected Behavior

My was trying to use gpu acceleration for my xgboost model in a wsl2 environment, and here is what I posted in their forum: https://discuss.xgboost.ai/t/xgboost-using-gpu-in-wsl-environment-doesnt-work/3539

Actual Behavior

In side my dmesg log: image


For my xgboost model running: https://discuss.xgboost.ai/t/xgboost-using-gpu-in-wsl-environment-doesnt-work/3539

Diagnostic Logs

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 25
  • Comments: 35

Most upvoted comments

I wonder why is this still not fixed. All those issues are directly related: #9083 #9523 #9662 #10085 #11086 #11095 #11208 #11838 #11939. Intel iGPU doesn’t exist to Microsoft?

I think the current implementation on Kernel 5.15 and up is broken. I’ve tested on 6.6.36 and even on 6.6.63 by pulling latest updates from upstream stable branch and doesn’t seem to be working at all.

[    1.687032] misc dxg: dxgk: dxgkio_is_feature_enabled: Ioctl failed: -22
[    1.687032] misc dxg: dxgk: dxgkio_is_feature_enabled: Ioctl failed: -22
[    1.692342] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    1.693191] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    1.694044] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    1.695030] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
[    1.697464] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    1.698302] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    1.699089] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    1.700093] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2

Linux fedoraremix 6.6.63-microsoft-standard-WSL2+ #3 SMP PREEMPT_DYNAMIC Sun Dec  1 15:29:41 -03 2024 x86_64 GNU/Linux

Or, if there’s something missing on the host side it could be stated somewhere but none that I could find.

It would be very good if someone working directly on this driver could follow up on this.

With so many people experiencing this issue it’s pretty disappointing that none of the devs have even given an explanation, let alone are working on a fix.

I use WSL often and the slow startup times are one of the reasons that I’m considering just ditching Windows altogether.

I have tested with another Distro within WSL2 - OpenSuse Leap and I found out this problem does not occur with Leap.

More info on my wsl --version:

WSL version: 2.4.5.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22624.1391

hitting this on a clean install of windows 11 and WSL, the errors occur as soon as the wsl distro is started:

[    0.245739] hv_vmbus: registering driver dxgkrnl
[    0.955213] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    0.955615] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    0.955991] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    0.956428] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2

GPU acceleration is working properly on windows sandbox info:

 WSL: 2.2.2.0
 kernel: 5.15.150.1-2
 WSLg: 1.0.61
 MSRDC: 1.2.5105
 Direct3D: 1.611.1-81528511
 DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
 Windows: 10.0.22631.3374
 distro: Ubuntu 22.04.3 LTS
 gpu: 7800x3d igpu
amd driver version: 23.40.27.01-240313a-401413C-AMD-Software-Adrenalin-Edition

There is a coping strategy to the slow loading problem, although it is not a fundamental solution. You can set a timeout.

[boot]
initTimeout=1000

The only workaround I was able to find thus far was to disable systemd by commenting out the following line at /etc/wsl.conf:

[boot] # systemd=true Then in PowerShell, shutting down the distro then launching it back again without systemd this time.

I had recently upgraded from 22.04 to 24.04 and ran into hanging problems. During diagnosis, I ran into the reported errors. Your comment reminded me I had enabled it. This eliminates the logs.

I also had autoMemoryReclaim=gradual set, which is experimental. I’ve disabled that hoping it eliminates the hanging.

After disabling systemd it’s definitely faster to wake up 😆

The only workaround I was able to find thus far was to disable systemd by commenting out the following line at /etc/wsl.conf:

[boot]
# systemd=true

Then in PowerShell, shutting down the distro then launching it back again without systemd this time.

More info on my wsl --version after wsl --update and wsl --update --pre-release:

WSL version: 2.4.5.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22624.1391

Obs.: I am using Debian distro. Previously I was using systemd with https://github.com/DamionGans/ubuntu-wsl2-systemd-script.