Invalid public key for CUDA apt repository

RUN (all capitals) is typically the way the docker run command is written. Depending on the state during the container build the command could be executed as root or another user.

This is was my fix:

RUN apt-key del 7fa2af80 \
    && apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub \
    && apt-get update \
    && apt-get install -y libsm6 libgl1-mesa-glx libxext6 libfontconfig1 libxrender1 \
    && rm -rf /var/lib/apt/lists/*    && rm -rf /var/lib/apt/lists/*

Adjust the second to last line where additional packages are installed to reflect your Dockerfile.

Sorry for the noob-question (I am a mechanical engeneer in numerical analysis’ - the craft of computer science is not native to me). I don’t know where to execute the code. I am building the singularity container from a singularity *.def. When is docker available in the building process of singularity?

EDIT: Thanks a lot. Now i got it and it works.

Do these file names stay the same and their contents change? Wondering if this would work as a long term solution to solve for key rotations. Don’t want to hardcode the filenames and then have this fail in 3 months.

This worked for me as well.

Below steps helped to fix the nvidia baseos repo GPG error:
sudo apt-key adv --fetch-keys https://repo.download.nvidia.com/baseos/GPG-KEY-dgx-debian-prod

sudo apt-get update

This still looks to be an issue

{"changed": false, "msg": "Failure downloading https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb, HTTP Error 404: Not Found"}

Hi @cpierre, the CUDA repository for Ubuntu 22.04 support is not yet live. Check back at the next release.

Hi all,
adding this to my Dockerfile with base image nvcr.io/nvidia/tritonserver:22.04-py3
solved the problem

RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin && \
    mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 && \
    apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub && \
    add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" && \
    apt-get update && apt-get clean && apt-get install -fy && dpkg-reconfigure debconf

You just saved my night

I am getting a bunch of them

W: GPG error: file:/var/cudnn-local-repo-ubuntu2204-8.8.0.121  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BE5F80F804B81517
E: The repository 'file:/var/cudnn-local-repo-ubuntu2204-8.8.0.121  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: file:/var/cudnn-local-repo-ubuntu2204-8.9.3.28  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 619ECF317F7A158C
E: The repository 'file:/var/cudnn-local-repo-ubuntu2204-8.9.3.28  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: file:/var/nv-tensorrt-local-repo-ubuntu2204-8.5.3-cuda-11.8  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D129ACC63E951519
E: The repository 'file:/var/nv-tensorrt-local-repo-ubuntu2204-8.5.3-cuda-11.8  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: file:/var/nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-11.8  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F981A7F10628887B
E: The repository 'file:/var/nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-11.8  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

@bassemfg
Those are all local repos, installed in /var/, the ephemeral GPG pubkey for each is located in its directory, for example

ls /var/cudnn-local-repo-ubuntu2204-8.9.3.28/cudnn-local-7F7A158C-keyring.gpg

As prompted during installation of the local repo, copy the keyring to /usr/share/keyrings/
(see: NVIDIA CUDA Installation Guide for Linux)

I had same issue while installing Cuda on my Jetson agx xavier by referencing [this]

1. error explanation

when I doing this I got an error:

jetsonagx@jetsonagx-desktop:~/Downloads/nvidia/sdkm_downloads$ sudo dpkg -i cuda-repo-l4t-11-4-local_11.4.19-1_arm64.deb 

Selecting previously unselected package cuda-repo-l4t-11-4-local.
(Reading database ... 148565 files and directories currently installed.)
Preparing to unpack cuda-repo-l4t-11-4-local_11.4.19-1_arm64.deb ...
Unpacking cuda-repo-l4t-11-4-local (11.4.19-1) ...
Setting up cuda-repo-l4t-11-4-local (11.4.19-1) ...

The public cuda-repo-l4t-11-4-local GPG key does not appear to be installed.
To install the key, run this command:
sudo cp /var/cuda-repo-l4t-11-4-local/cuda-13070C62-keyring.gpg /usr/share/keyrings/



jetsonagx@jetsonagx-desktop:~/Downloads/nvidia/sdkm_downloads$ sudo apt-key add /var/cuda-repo-l4t-11-4-local/13070C62.pub 
OK



jetsonagx@jetsonagx-desktop:~/Downloads/nvidia/sdkm_downloads$ sudo apt-get -y update
#...    
Err:1 file:/var/cuda-repo-l4t-11-4-local  InRelease             
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 
#...                                
Reading package lists... Done                                                                                                          
W: GPG error: file:/var/cuda-repo-l4t-11-4-local  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 65E126F113070C62
E: The repository 'file:/var/cuda-repo-l4t-11-4-local  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.




I tried everything said in Internet, but didn’t work.


2. issue solving process explanation


What I did is as displayed in first command:
To install the key, run this command:
sudo cp /var/cuda-repo-l4t-11-4-local/cuda-13070C62-keyring.gpg /usr/share/keyrings/

so I run this command also:

jetsonagx@jetsonagx-desktop:~/Downloads/nvidia/sdkm_downloads$ sudo cp /var/cuda-repo-l4t-11-4-local/cuda-13070C62-keyring.gpg /usr/share/keyrings/

then update

jetsonagx@jetsonagx-desktop:~/Downloads/nvidia/sdkm_downloads$ sudo apt-get update
Get:1 file:/var/cuda-repo-l4t-11-4-local  InRelease [1,575 B]
Get:1 file:/var/cuda-repo-l4t-11-4-local  InRelease [1,575 B]
Get:2 file:/var/cuda-repo-l4t-11-4-local  Packages [12.7 kB]
Hit:3 https://repo.download.nvidia.com/jetson/common r35.4 InRelease                 
Hit:4 https://repo.download.nvidia.com/jetson/t194 r35.4 InRelease                         
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal InRelease                                 
Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:7 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Hit:8 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Reading package lists... Done




2. issue solving summarize


sudo dpkg -i cuda-repo-l4t-11-4-local_11.4.19-1_arm64.deb 
sudo cp /var/cuda-repo-l4t-11-4-local/cuda-13070C62-keyring.gpg /usr/share/keyrings/ 
sudo apt-get -y update
sudo apt-get install cuda-toolkit-11-4

Hi @zrn-dev yes you need to copy the ephemeral keyring included with a local repo installer to /usr/share/keyrings/

The reason apt-key (deprecated) does not solve the issue is because it appends public keys to the system default keyring (/etc/apt/trusted.gpg)

However, the provided .list file has been updated to use for example deb [signed-by=/usr/share/keyrings/cuda-13070C62-keyring.gpg].

More information about this DebianRepository/UseThirdParty - Debian Wiki

Thank you! It works for me!

This was THREE years ago. Has anything happened? I still can’t get this installed.

(You’d think a $4T company would have its act together!)

Help!