Failed to properly shut down NVML: GPU access blocked by the operating system

Hello to everyone.

Premising that I’m using “Microsoft Windows 11 [Version 10.0.22000.1219]”,I have installed Ubuntu 22.04 on top of it and then I’ve upgraded Ubuntu 22.04 to 22.10 and I’ve upgraded the driver for my RTX 2080 ti on the host os. After this,I have installed CUDA inside the WSL2 / Ubuntu following this mini tutorial :

These are the commands that I have issued :

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda

at this point I did :

apt install nvidia-utils-510

because without installing this package,it won’t find the utility nvidia-smi. But this is the error that I’ve got next :

# nvidia-smi

Failed to initialize NVML: GPU access blocked by the operating system
Failed to properly shut down NVML: GPU access blocked by the operating system

what should I do now ? The driver installed on the host os is version : 31.0.15.2686

Follow this document CUDA on WSL :: CUDA Toolkit Documentation (nvidia.com)

marietto@marietto-windows11:~$ wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
--2022-11-19 01:25:53--  https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 152.199.20.126
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|152.199.20.126|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 190 [application/octet-stream]
Saving to: ‘cuda-wsl-ubuntu.pin’

2022-11-19 01:25:53 (24.2 MB/s) - ‘cuda-wsl-ubuntu.pin’ saved [190/190]

marietto@marietto-windows11:~/Desktop$ sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600

marietto@marietto-windows11:~/Desktop$ wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
--2022-11-19 01:27:15--  https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 152.199.20.126
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|152.199.20.126|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2766643886 (2.6G) [application/x-deb]
Saving to: ‘cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb’

cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb   100%[=====================================================================================================================>]   2.58G  8.52MB/s    in 5m 12s

2022-11-19 01:32:27 (8.46 MB/s) - ‘cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb’ saved [2766643886/2766643886]

marietto@marietto-windows11:~/Desktop$ sudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
Selecting previously unselected package cuda-repo-wsl-ubuntu-11-8-local.
(Reading database ... 112057 files and directories currently installed.)
Preparing to unpack cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb ...
Unpacking cuda-repo-wsl-ubuntu-11-8-local (11.8.0-1) ...
Setting up cuda-repo-wsl-ubuntu-11-8-local (11.8.0-1) ...

The public cuda-repo-wsl-ubuntu-11-8-local GPG key does not appear to be installed.
To install the key, run this command:
sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-9EA88183-keyring.gpg /usr/share/keyrings/

marietto@marietto-windows11:~/Desktop$ sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-9EA88183-keyring.gpg /usr/share/keyrings/

marietto@marietto-windows11:~/Desktop$ sudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
(Reading database ... 112134 files and directories currently installed.)
Preparing to unpack cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb ...
Unpacking cuda-repo-wsl-ubuntu-11-8-local (11.8.0-1) over (11.8.0-1) ...
Setting up cuda-repo-wsl-ubuntu-11-8-local (11.8.0-1) ...

marietto@marietto-windows11:~/Desktop$ sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/

marietto@marietto-windows11:~/Desktop$ sudo apt-get update
Get:1 file:/var/cuda-repo-wsl-ubuntu-11-8-local  InRelease [1575 B]
Get:1 file:/var/cuda-repo-wsl-ubuntu-11-8-local  InRelease [1575 B]
Get:2 file:/var/cuda-repo-wsl-ubuntu-11-8-local  Packages [16.6 kB]
Get:3 http://security.ubuntu.com/ubuntu kinetic-security InRelease [109 kB]
Hit:4 https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64  InRelease
Hit:5 http://archive.ubuntu.com/ubuntu kinetic InRelease
Get:6 http://security.ubuntu.com/ubuntu kinetic-security/main amd64 Packages [82.6 kB]
Get:7 http://security.ubuntu.com/ubuntu kinetic-security/main Translation-en [23.8 kB]
Get:8 http://security.ubuntu.com/ubuntu kinetic-security/universe amd64 Packages [27.8 kB]
Get:9 http://security.ubuntu.com/ubuntu kinetic-security/universe Translation-en [11.1 kB]
Get:10 http://archive.ubuntu.com/ubuntu kinetic-updates InRelease [109 kB]
Get:11 http://archive.ubuntu.com/ubuntu kinetic-backports InRelease [99.9 kB]
Get:12 http://archive.ubuntu.com/ubuntu kinetic-updates/main amd64 Packages [85.3 kB]
Get:13 http://archive.ubuntu.com/ubuntu kinetic-updates/main Translation-en [24.7 kB]
Get:14 http://archive.ubuntu.com/ubuntu kinetic-updates/universe amd64 Packages [28.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu kinetic-updates/universe Translation-en [11.3 kB]
Fetched 612 kB in 1s (491 kB/s)
Reading package lists... Done

marietto@marietto-windows11:~/Desktop$ sudo apt-get -y install cuda
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  cuda
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/2404 B of archives.
After this operation, 7168 B of additional disk space will be used.
Get:1 file:/var/cuda-repo-wsl-ubuntu-11-8-local  cuda 11.8.0-1 [2404 B]
Selecting previously unselected package cuda.
(Reading database ... 112134 files and directories currently installed.)
Preparing to unpack ..././cuda_11.8.0-1_amd64.deb ...
Unpacking cuda (11.8.0-1) ...
Setting up cuda (11.8.0-1) ...

marietto@marietto-windows11:~/Desktop$ nvidia-smi

Failed to initialize NVML: GPU access blocked by the operating system
Failed to properly shut down NVML: GPU access blocked by the operating system

In my cases, the nvidia-smi only worked when exec from Windows Terminal as Admin.

Windows 11 22H2 22621.819
WSL2 5.15.74.2-microsoft-standard-WSL2
Nvidia driver 472.12
Cuda 11.7.0

I didn’t think about to do as you suggest :

C:\Users\virtu\Downloads\cmder

λ nvidia-smi

Sat Nov 19 01:58:28 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 526.98       Driver Version: 526.98       CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ... WDDM  | 00000000:01:00.0  On |                  N/A |
| 51%   26C    P8     8W / 120W |    140MiB /  3072MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  NVIDIA GeForce ... WDDM  | 00000000:02:00.0  On |                  N/A |
| 29%   30C    P8    25W / 250W |    420MiB / 11264MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     13096    C+G   ...iles\AutoMate 11\AMEM.exe    N/A      |
|    1   N/A  N/A      7312    C+G   ...\Kinect\KinectService.exe    N/A      |
|    1   N/A  N/A      9872    C+G   ...418.42\msedgewebview2.exe    N/A      |
|    1   N/A  N/A     10620    C+G   ...Update\Reallusion Hub.exe    N/A      |
|    1   N/A  N/A     10676    C+G   C:\Windows\explorer.exe         N/A      |
|    1   N/A  N/A     12320    C+G   ...n1h2txyewy\SearchHost.exe    N/A      |
|    1   N/A  N/A     13096    C+G   ...iles\AutoMate 11\AMEM.exe    N/A      |
|    1   N/A  N/A     13316    C+G   ...e\PhoneExperienceHost.exe    N/A      |
|    1   N/A  N/A     16900    C+G   ...ger\SSHFS-Win Manager.exe    N/A      |
+-----------------------------------------------------------------------------+

run nvidia-smi in your wsl bash under Windows Terminal as Admin

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