The public CUDA GPG key does not appear to be installed

I am following this guide to install Cuda 11.7 on Ubuntu 20.04 via WSL2.

  1. CUDA Support for WSL 2
    Option 1: Installation of Linux x86 CUDA Toolkit using WSL-Ubuntu Package – Recommended
    4.sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb

throws an error,
Preparing to unpack cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb …
Unpacking cuda-repo-wsl-ubuntu-11-7-local (11.7.0-1) over (11.7.0-1) …
Setting up cuda-repo-wsl-ubuntu-11-7-local (11.7.0-1) …

The public CUDA GPG key does not appear to be installed.

To install the key, run this command:
sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-B81839D3-keyring.gpg /usr/share/keyrings/

so when I try to run the above command, nothing happens.

I have read the similar thread, however, the solution offered by [mattshilling] does not work for me.

I have also tried removing the old signing key and installing the new cuda-keyring package with these commands:

$ sudo apt-key del 7fa2af80
$ wget
$ sudo dpkg -i cuda-keyring_1.0-1_all.deb

from this thread, Updating the CUDA Linux GPG Repository Key | NVIDIA Technical Blog

so I dont know how to go past this error. please help?

1 Like

I have the exact same issue with the same environment (Ubuntu 22.04, WSL2.0), and the suggested fix for the similar issue does not resolve it!

Please help!
@mattshilling @kmorozov

sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-B81839D3-keyring.gpg /usr/share/keyrings/cuda-archive-keyring.gpg


I also get the same problem even when I do:
sudo apt-key del 7fa2af80
sudo dpkg -i cuda-keyring_1.0-1_all.deb
It continues to complain about this key.

I think I found the bug. I hope someone from NVidia sees this.
contains the file ‘postinst’. The “if” test there say if the trusted.gpg file doesn’t exist or the key DOES NOT exist then complain about the key existing which is silly. I even figure out how this mistake was likely made.
I found some ‘postinst’ file contents that were quoted in some github discussion. The file looked nearly identical but it use the same if test to “ADD” the key instead of asking for it to be deleted. Nobody changed the IF test!