Eyshika
Eyshika

Reputation: 1099

apt-update in Azure Nvidia gives publickey error

I started a NVIDIA VM on AZURE and trying to do update using sudo apt update but gives error:

Hit:2 http://azure.archive.ubuntu.com/ubuntu focal InRelease                                                 
Hit:3 http://azure.archive.ubuntu.com/ubuntu focal-updates InRelease                                         
Hit:4 http://azure.archive.ubuntu.com/ubuntu focal-backports InRelease                                   
Hit:5 https://packages.microsoft.com/repos/azure-cli focal InRelease        
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease            
Err:1 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
Reading package lists... Done
W: GPG error: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
E: The repository 'http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease' is no longer 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.

to install the keys i used sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv A4B469963BF863CC

but that gives No data error. gpg: keyserver receive failed: No data

I can run sudo apt-get upgrade but not the update. Any help would be appreciated

Even though there is cuda installed but it still doesnt find cuda libraries, and that could be due to update.

Upvotes: 14

Views: 7725

Answers (4)

Dan
Dan

Reputation: 773

As others mentioned this issue is due to Cuda repo key rotation. apt-key approach mentioned above didn't work for me. I looked more about details on the nvidia forum and came across another method from user (olyuninv) where you have to copy the below command in Dockerfile before apt-get update as follows:

COPY ./cuda-keyring_1.0-1_all.deb cuda-keyring_1.0-1_all.deb

RUN rm /etc/apt/sources.list.d/cuda.list
&& rm /etc/apt/sources.list.d/nvidia-ml.list
&& dpkg -i cuda-keyring_1.0-1_all.deb

RUN apt-get update

Don't forget to download keys first according to your OS version from here.
You have to basically use below command:
wget https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.0-1_all.deb
(But have to replace $distro/$arch with your OS version, more details in the link)

If interested, more details might be available here on this nvidia cuda gitlab ticket.

References:
1: https://forums.developer.nvidia.com/t/invalid-public-key-for-cuda-apt-repository/212901/7
2: https://developer.nvidia.com/blog/updating-the-cuda-linux-gpg-repository-key/
3: https://gitlab.com/nvidia/container-images/cuda/-/issues/158

Upvotes: 3

user8912375
user8912375

Reputation: 492

The error is due to Cuda repo key rotation. The solution posted on Nvidia forms didn't work for me https://forums.developer.nvidia.com/t/notice-cuda-linux-repository-key-rotation/212771

The following worked:

apt-key del 7fa2af80
wget https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.0-1_all.deb
dpkg -i cuda-keyring_1.0-1_all.deb

Replace $distro/$arch in the following commands;ex:

  • debian10/x86_64
  • debian11/x86_64
  • ubuntu1604/x86_64
  • ubuntu1804/cross-linux-sbsa
  • ubuntu1804/ppc64el
  • ubuntu1804/sbsa
  • ubuntu1804/x86_64
  • ubuntu2004/cross-linux-sbsa
  • ubuntu2004/sbsa
  • ubuntu2004/x86_64
  • ubuntu2204/sbsa
  • ubuntu2204/x86_64
  • wsl-ubuntu/x86_64

and then

apt-get update

if you have an error as the following after the apt-get update

root@9c8cceaf7843:/# apt-get update
E: Conflicting values set for option Signed-By regarding source https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /: /usr/share/keyrings/cuda-archive-keyring.gpg != 
E: The list of sources could not be read.

run the following

sed -i '/developer\.download\.nvidia\.com\/compute\/cuda\/repos/d' /etc/apt/sources.list.d/*
sed -i '/developer\.download\.nvidia\.com\/compute\/machine-learning\/repos/d' /etc/apt/sources.list.d/*
apt-get update

this should solve the issue

Method 2 (Not recommended)

Alternatively, you can manually install the keys (change $distro/$arch)

apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/3bf863cc.pub

To Check your distro and architecture

Disto

uname -v
or
lsb_release -a

Architecture:

uname -i

Reference:

https://forums.developer.nvidia.com/t/notice-cuda-linux-repository-key-rotation/212771

https://github.com/NVIDIA/cuda-repo-management/issues/4

https://forums.developer.nvidia.com/t/updating-the-cuda-linux-gpg-repository-key/212897/8

Upvotes: 4

Hayk Petrosyan
Hayk Petrosyan

Reputation: 373

the following worked for me

apt-key del 7fa2af80
rm /etc/apt/sources.list.d/cuda.list
rm /etc/apt/sources.list.d/nvidia-ml.list
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
dpkg -i cuda-keyring_1.0-1_all.deb

I ran those commands in docker container, so in VM you might need to add sudo.

Upvotes: 15

Eyshika
Eyshika

Reputation: 1099

I found the solution. This error was occuring due to NVidia GPG key rotation occurred today. All the details are provdhttps://developer.nvidia.com/blog/updating-the-cuda-linux-gpg-repository-key/

Upvotes: 1

Related Questions