Cannot install cuDNN 8.5.0.96 on Ubuntu 22.04, says GPG key not installed

System Info:

OS: Ubuntu 22.04.1 LTS x86_64 
Kernel: 5.15.0-47-generic 
Uptime: 19 mins 
Packages: 2225 (dpkg), 11 (snap) 
Shell: bash 5.1.16 
Resolution: 3840x2160 
DE: GNOME 42.4 
WM: Mutter 
WM Theme: Adwaita 
Theme: Yaru [GTK2/3] 
Icons: Yaru [GTK2/3] 
Terminal: gnome-terminal 
CPU: Intel i9-9900K (16) @ 5.000GHz 
GPU: NVIDIA GeForce RTX 2080 
Memory: 2164MiB / 64225MiB 

Install Cuda using the following code:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda-repo-ubuntu2204-11-7-local_11.7.1-515.65.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-11-7-local_11.7.1-515.65.01-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda

Seems cuda is successfully installed on my device, because when running nvidia-smi it shows:

Sat Sep 17 23:31:20 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.01    Driver Version: 515.65.01    CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| 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 ...  On   | 00000000:01:00.0  On |                  N/A |
|  0%   52C    P8    27W / 215W |    675MiB /  8192MiB |      7%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1214      G   /usr/lib/xorg/Xorg                275MiB |
|    0   N/A  N/A      1449      G   /usr/bin/gnome-shell              104MiB |
|    0   N/A  N/A      2620      G   ...5/usr/lib/firefox/firefox      293MiB |
+-----------------------------------------------------------------------------+

But when I download cuDNN from nvidia and install it with sudo dpkg -i cudnn-local-repo-ubuntu2204-8.5.0.96_1.0-1_amd64.deb it says:

prepare to decompress cudnn-local-repo-ubuntu2204-8.5.0.96_1.0-1_amd64.deb  ...
decompressing cudnn-local-repo-ubuntu2204-8.5.0.96 (1.0-1) and overriding (1.0-1) ...
setup cudnn-local-repo-ubuntu2204-8.5.0.96 (1.0-1) ...

The public CUDA GPG key does not appear to be installed.
To install the key, run this command:
sudo cp /var/cudnn-local-repo-ubuntu2204-8.5.0.96/cudnn-local-7ED72349-keyring.gpg /usr/share/keyrings/

Of course I ran the mentioned code. And I did some research:

(base) desmond@PlanckUbuntu:~$ ls /var/cudnn-local-repo-ubuntu2204-8.5.0.96/
7ED72349.pub                      libcudnn8_8.5.0.96-1+cuda11.7_amd64.deb          Local.md5      Packages.gz
cudnn-local-7ED72349-keyring.gpg  libcudnn8-dev_8.5.0.96-1+cuda11.7_amd64.deb      Local.md5.gpg  Release
InRelease                         libcudnn8-samples_8.5.0.96-1+cuda11.7_amd64.deb  Packages       Release.gpg
(base) desmond@PlanckUbuntu:~$ ls /usr/share/keyrings/
cuda-F83D2C4C-keyring.gpg         ubuntu-advantage-esm-infra-trusty.gpg  ubuntu-archive-removed-keys.gpg
cudnn-local-7ED72349-keyring.gpg  ubuntu-advantage-fips.gpg              ubuntu-cloudimage-keyring.gpg
ubuntu-advantage-cc-eal.gpg       ubuntu-advantage-realtime-kernel.gpg   ubuntu-cloudimage-removed-keys.gpg
ubuntu-advantage-cis.gpg          ubuntu-advantage-ros.gpg               ubuntu-master-keyring.gpg
ubuntu-advantage-esm-apps.gpg     ubuntu-archive-keyring.gpg

Then I reran the installing script. It doesn’t work. I did a reboot and retry. Still no luck.

Any idea how can I install cuDNN in this case?

Turns out what I need to run is:

sudo cp /var/cudnn-local-repo-ubuntu2204-8.5.0.96/cudnn-local-7ED72349-keyring.gpg /usr/share/keyrings/cuda-archive-keyring.gpg

Don’t know why they didn’t give correct error message/

1 Like

Hi,

Please refer to the following similar issue, which may help you.

Thank you.

It worked! Thanks!