I have an error when running apt-get update - linux

In my Jenkins pipeline, I am trying to run a build using the Docker image maven:3.5.4-jdk-10-slim as my Jenkins agent. Inside it, I run the command apt-get update. However, when I do, I get the following error:
Get:1 http://deb.debian.org/debian sid InRelease [165 kB]
Err:1 http://deb.debian.org/debian sid InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9
I searched online for help on this error, and it was advised I add the following 2 commands before my update command so I can add the public keys for apt to verify:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
However, now I get a different error when running those commands:
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
I also searched for help on that error, and I was advised to run this before the 2 new commands : apt-get update && apt-get install -y gnupg
But I can't run apt-get update. How can I fix this?

I encountered the same problem. For me, the following had solved the issue.
I realized, that I was using a very old version of docker:18-dind to build images in my CI. This 18-dind was more like a puppet, that built and pushed images. It was able to build images, except that based on Ubuntu 22, for example, eclipse-temurin.
I updated my Docker build puppet from 18-dind to 20-dind and it solved the issue.

Related

Error when Installing Wine on Linux: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F

I was installing Wine on linux and up on following the guide instructions on this article, install wine, I came across these errors :-
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu xenial
InRelease: The following signatures couldn't be verified because the
public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu xenial
InRelease' is not signed.
I looked for solutions but I could not find one. I decided to create a post and my solution to this problem.
Find the solution in the answers.
The solution is easy.
Add the required public key using the below command line:-
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 76F1A20FF987672F
Now you can run:-
sudo apt update && sudo apt upgrade -y
And you are sorted

Getting Invalid Signature error while installing MySQL 5.7 on Ubuntu 22.04 LTS?

I need to install mysql 5.7 on Ubuntu 22.04. I followed the following steps :
- wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
- sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
- Selected the option MySQL Server and Cluster mysql-5.7 -> ok.
- sudo apt-get update
The following error comes :
Err:1 http://repo.mysql.com/apt/debian jessie InRelease
The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build#oss.oracle.com>
E: The repository 'http://repo.mysql.com/apt/debian jessie InRelease' is not signed.
And after running the command : "apt-cache policy mysql-server" , the list does not include 5.7
Tried to run the following commands to get the key :
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8C718D3B5072E1F5
Checked the command : sudo apt-key list
It shows the mysql key is expired. Tried deleting again getting the key , but no gains
Tried the following keystores, but again no gains :
hkp://pgp.mit.edu:80
hkps://pgp.mit.edu
hkps://keyserver.ubuntu.com
hkp://p80.pool.sks-keyservers.net:80
Tried the following links :
https://askubuntu.com/questions/1120363/mysql-ppa-invalid-signature/1141364#1141364
https://stackoverflow.com/questions/73250312/how-can-i-install-mysql-5-7-on-ubuntu-22-04-lts
Kindly help
Regards
Anuradha
I have fixed this issue for me with a small trick.What we actually need to do is edit our /etc/apt/sources.list with the source.list available in Ubuntu 20.4. eg. you will get an entry in ubuntu 22
"deb http://in.archive.ubuntu.com/ubuntu/ jammy main restricted"
so just replace jammy by bionic in all places in /etc/apt/sources.list then save and try apt update after then just simply try to install myslq sudo apt install -fmysql-server=5.7* can use this command and now you can able to install mysql successfully.
Once you are installed and mysql is up and running just make sure to revert the /etc/apt/sources.list file.
Reason for doing this is in Ubuntu 22.04 it is not bale to install all required dependencies for mysql5.7 so by editing source.list we allow to install all req dependencies.
Note: Don't use upgrade in while doing this all and make sure you revert the source.list file after myslq installed and plz mark mysql on hold for upgrade because whenever you run an upgrade command it will upgrade the mysql version to 8 from 5.
Hope this work for you.
Thanks

The following signatures couldn't be verified because the public key is not available while updating sudo apt update

I am trying to install some application on Ubuntu 20.04, for that I am trying to run command on terminal
$ sudo apt update
and I have got following error
Err:1 http://dl.google.com/linux/chrome/deb stable InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 78BD65473CB3BD13
I am got the same issue while running the below command
$ sudo apt update
In your case, you can follow below option to resolved these issue.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13
Or
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 78BD65473CB3BD13
In first option, we don't have to decide which port should be or you can go with second option. Either way, both will work.

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.
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.
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
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
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/

Not being able to update ubuntu on Azure VM's

Problem:
I tried to create VM's and then update it to install the azure-cli but am facing this NO_PUBKEY error.
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
My Ubuntu Configuration:
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
Steps to recreate:
Create a Azure VM
Image:
Size:
And the rest as the default configurations
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash &
sudo apt-get update
What other things I did to solve this problem:
Created another VM with same configuration and got the same problem. So I think that the problem was not only to that particular VM
For the error message, you could add missing keys by executing the following command for each key from the log file:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF
Note: the actual key server name and the key mentioned in the error message should be used in the command above.
After adding the missing keys, you could try to install the azure-cli again.
For more information, you could refer to this.
Okay, after much research I found out that the problem existed only on certain Nvidia Images and not on the barebone Linux images. So I figured that there must be something wrong with the trusted key itself. So, these are the steps that I did in order to fix the issue.
sudo rm -rf /etc/apt/trusted.gpg.d/microsoft.gpg
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF
sudo apt-get update
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Now you will be able to update the instance
Resources:
[1] http://forums.debian.net/viewtopic.php?t=130558

Resources