Installing the driver to WSL2 Ubuntu on Windows11

WSL2 Ubuntu on Windows11, the driver downloaded from nvidia,com can not detect GPU, even if the mesa-driver did it.

I tried some versions, however I got same results.

$ nvidia-smi
Fri Apr 26 11:14:09 2024
±----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.76.01 Driver Version: 552.22 CUDA Version: 12.4 |
|-----------------------------------------±-----------------------±---------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4070 On | 00000000:01:00.0 Off | N/A |
| 40% 63C P2 124W / 200W | 4557MiB / 12282MiB | 77% Default |
| | | N/A |
±----------------------------------------±-----------------------±---------------------+

nvidia-installer log file ‘/var/log/nvidia-installer.log’
creation time: Thu Apr 25 21:07:54 2024
installer version: 550.76

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

nvidia-installer command line:
./nvidia-installer

Using: nvidia-installer ncurses v6 user interface
→ Detected 28 CPUs online; setting concurrency level to 28.
→ Unable to locate any tools for listing initramfs contents.
→ Unable to scan initramfs: no tool found
WARNING: You do not appear to have an NVIDIA GPU supported by the 550.76 NVIDIA Linux graphics driver installed in this system. For further details, please see the appendix SUPPORTED NVIDIA GRAPHICS CHIPS in the README available on the Linux driver download page at www.nvidia.com.
→ Installing NVIDIA driver version 550.76.
→ Performing CC sanity check with CC=“/usr/bin/cc”.
→ Performing CC check.
ERROR: Unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the ‘kernel-source’ or ‘kernel-devel’ RPM installed. If you know the correct kernel source files are installed, you may specify the kernel source path with the ‘–kernel-source-path’ command line option.
ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

You can’t/mustn’t install the nvidia driver in wsl2, it doesn’t have a real gpu.
Graphics accel works through mesa/dozen, cuda is simply passed through using the Windows driver.

Hi,

I downloaded “cuda driver” from “GPU in Windows Subsystem for Linux (WSL) | NVIDIA Developer”.

EpicGames said that UE does not officially support mesa, so you need the nvidia official driver instead.
When I installed mesa-driver, UE applications can boot, however they show only noises on viewports.

Thanks,

Sadahiro

WSL2 is not built for that.

What about this MS page that instructs to download and install the standard NVIDIA driver?

Seems interesting but by reading it, it just looks like the usual ambigous and bogus msft docs crap. Technically, it doesn’t really contain any info. I’m interpreting this as you’ll have to install the Windows driver matching your gpu vendor, to have a virtual gpu in the wsl2 vm with some hw accel available. Nothing new, really. A bit puzzling is it directly mentions OpenGL, which would be a novelty but i wouldn’t know how this would work as it would need to be provided by mesa as an extra driver and I don’t know of any project working on that. Would be pointless anyway imho. What does work is vulkan via mesa/dozen as I mentioned. You might then be able to plug Zink to it to have OpenGL accel but that is rather fiddly and no novelty. Even if the doc were about that, it would need to talk about the mesa version needed and not some wsl blahblah. So I have no idea what they’re talking about, please investigate yourself and report.

Hi moderatevoltage,

Thanks for your post.

However, there are no problem running X11 apps without GPU(vulkan) on WSL2 as this page.
What generix says in the post below is the answer.

My conclusion is that if UE supports only the official Driver and not open source drivers, then it is impossible to run UE applications on WSL2.
My final goal is not to run UE applications on WSL2, I just wanted to do casual test my cross-compiled UE5 application for Linux on Windows PC.
So I ended up building a new native Linux PC environment.

By the way, even though the viewport image is corrupted, but the UE5 editor itself works.

Cheers,

Sadahiro

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.