gpg: no valid OpenPGP data found
Asked Answered
A

20

151

I am trying to install Jenkins on Ubuntu 13.10 and I am getting the above mentioned error when i try to run the following command:

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
Andean answered 24/1, 2014 at 17:26 Comment(2)
Are you behind a proxy?Mor
notice, that's -O option but not -0 oneNev
O
144

This problem might occur if you are behind corporate proxy and corporation uses its own certificate. Just add "--no-check-certificate" in the command. e.g. wget --no-check-certificate -qO - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

It works. If you want to see what is going on, you can use verbose command instead of quiet before adding "--no-check-certificate" option. e.g. wget -vO - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - This will tell you to use "--no-check-certificate" if you are behind proxy.

Outport answered 26/6, 2016 at 15:9 Comment(5)
I don't know what this does but it seems to have fixed another issue for me for downloading a Microsoft key into GPGHyperbaric
This should be the answer. This worked for me for AWS EC2Jeannettajeannette
I did curl -fsSL --no-check-certificate https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - but it gave me command not found and gpg: no valid OpenPGP data found. error.Kershner
@Chan Kim: --no-check-certificate is a command-line option for wget, not curl.Horologe
I would caution any who read this answer as this seems very dangerous, considering the question is regarding GPG. Not validating that the certificate ensures that you do not check who actually issued this key, bypassing a very important step, ensuring that the key was given from a trusted server. By doing this you do not know if the server is spoofing the server who you think you are talking to, compromising the validity of the key to be used in GPG. Maybe you need to refresh your keys? gpg --keyserver hkp://keyserver.ubuntu.com --refresh-keysMunshi
D
74

I got this error in an Ubuntu Docker container. I believe the cause was that the container was missing CA certs. To fix it, I had to run:

apt-get update
apt-get install ca-certificates
Diploid answered 18/2, 2018 at 16:46 Comment(4)
No idea why this was downvoted but this was my issue, thanks!Rickirickie
thanks, it solved my issue on ubuntu 16.04 LTS docker containerLancelot
I use the systemd-nspawn on Raspbian. The machine is Debian. This solution is also very usefull for me.Restaurateur
got no idea but this solves my problem when installing mongodb on wsl ubuntuMelanous
M
62

Managed to resolve it. separated the command in to two commands and used directly the file name which was downloaded example -

wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key    add -

can be separated into

  1. wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key
  2. sudo apt-key add jenkins-ci.org.key
Messuage answered 23/9, 2016 at 6:52 Comment(3)
This worked for me, adding "jenkins-ci.org.key" after -O in the first command.Rosetterosewall
When I tried to execute above commands, faced error saying 'no such file or directory named jenkins-ci.org.key' . As a work around I created file with name 'jenkins-ci.org.key' and executed above commands and it worked like charm!! .Maroon
You can pipe them. Try | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -Redeemer
D
25

gpg: no valid OpenPGP data found.

In this scenario, the message is a cryptic way of telling you that the download failed. Piping these two steps together is nice when it works, but it kind of breaks the error reporting -- especially when you use wget -q (or curl -s), because these suppress error messages from the download step.

There could be any number of reasons for the download failure. My case, which wasn't exactly listed so far, was that the proxy settings were lost when I called the enclosing script with sudo.

Doykos answered 24/1, 2019 at 18:53 Comment(2)
In my case (https://dl.winehq.org/wine-builds/winehq.key) it was because of a bad cert. Strangely enough, chrome accepts the https connection, but wget (on Ubuntu 18.04) complains. I assume Chrome and linux are using different certificate chains. The key to understand the problem was to remove the -q flag from wget as you suggest, and the problem became plain and clear. I had to add --no-check-certificate for wget to work.Outdated
curl also has --show-error >When used with -s, --silent, it makes curl show an error message if it fails.Doykos
P
19

I too got the same error, when I did this behind a proxy. But after I exported the following from a terminal and re-tried the same command, the problem got resolved:

export http_proxy="http://username:password@proxy_ip_addr:port/"
export https_proxy="https://username:password@proxy_ip_addr:port/"
Pelion answered 9/3, 2015 at 6:29 Comment(2)
How to get proxy_ip_addr and port? Also is username and password means my machine username and password?Emmyemmye
Still i am getting error after exporting above mentioned variablesPremature
V
6

i got this problem "gpg-no-valid-openpgp-data-found" and solve it with the following first i open browser and paste https://pkg.jenkins.io/debian/jenkins-ci.org.key then i download the key in Downloads folder then cd /Downloads/ then sudo apt-key add jenkins-ci.org.key if Appear "OK" then you success to add the key :)

Vincentvincenta answered 3/8, 2017 at 9:27 Comment(0)
S
6

I had a similar issue.

The command I used was as follows:

wget -qO https://download.jitsi.org/jitsi-key.gpg.key |  apt-key add -

I forgot a hyphen between the flags and the URL, which is why wget threw an error.

This is the command that finally worked for me:

wget -qO - https://download.jitsi.org/jitsi-key.gpg.key |  apt-key add -
Supposition answered 7/5, 2020 at 1:24 Comment(1)
I still get gpg: no valid OpenPGP data found. How am I supposed to solve this issue.Ellie
D
3

In my case, the problem turned out to be that the keyfile was behind a 301 Moved Permanently redirect, which the curl command failed to follow. I fixed it by using wget instead:

wget URL
sudo apt-key add FILENAME

...where FILENAME is the file name that wget outputs after it downloads the file.

Update: Alternatively, you can use curl -L to make curl follow redirects.

Daybook answered 17/2, 2018 at 23:12 Comment(1)
I faced the similar issue with the curl, as per your update I added -L which worked like a charm for me. Thanks a lotLaurentian
Y
2

you forgot sudo ... try with sudo and you will get OK

sudo wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
Yestreen answered 18/3, 2020 at 1:1 Comment(2)
You do not need super user permissions to wget the key, and on the apt-key add command the questioner uses sudoEalasaid
And if it was permission issue, it would say so, not gpg: no valid OpenPGP data found .Skiff
H
2

Try executing the commands separately.

 wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc

then

sudo apt-key add -
Huffy answered 10/10, 2021 at 15:23 Comment(0)
E
1

By executing the following command, it will save a jenkins-ci.org.key file in the current working directory:

curl -O http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key

Then use the following command to add the key file:

apt-key add jenkins-ci.org.key

If the system returns OK, then the key file has been successfully added.

Exoenzyme answered 17/7, 2018 at 23:12 Comment(0)
G
1
export https_proxy=http://user:pswd@host:port
                   ^^^^

Use http for https_proxy instead of https

Grantham answered 11/11, 2019 at 9:19 Comment(1)
replacing https to http worked for me.. Before replace : "wget -qO- packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -" , After replace : "sudo wget -qO- packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -"Either
S
1

install gpg and

1-Import the repository’s GPG key:

wget -qO - https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
    

2-this is code repository elasticserach in linux for download

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

3-link download elasticsearch

  https://www.elastic.co/downloads/elasticsearch

if error "Job for elasticsearch.service failed because a timeout was exceeded. See "systemctl status elasticsearch.service" and "journalctl -xe" for details."

solution:

1-sudo journalctl -f

2-sudo systemctl enable elasticsearch.service

3-sudo systemctl start elasticsearch

Scalpel answered 15/3, 2021 at 12:2 Comment(0)
M
1

I guess the issue is with wrong GPG key. Jenkins changed their GPG key recently (16 April 2020). You might need to import the correct key following the current official directions.

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

Maroon answered 19/9, 2021 at 17:24 Comment(0)
R
1

Solution 1 - Update CA certificates

Update your system's certificate authorities (CA) certificates to ensure they are current and can verify SSL certificates correctly. In Ubuntu, you can do this with the following command:

sudo apt-get install --reinstall ca-certificates

Solution 2 - Use wget instead of curl

If updating the CA certificates doesn't resolve the issue, try using wget instead of curl to download the Docker GPG key

sudo wget -O /usr/share/keyrings/docker-archive-keyring.gpg https://download.docker.com/linux/ubuntu/gpg

Solution 3 - Check your network and firewall settings

Make sure your internet connection is working correctly, and there are no firewall rules or other network restrictions preventing the secure connection to the "download.docker.com" server. You can try accessing the URL directly in your web browser to check if it's accessible.

Solution 4 - Verify DNS settings

Ensure that your DNS settings are configured correctly. If your DNS server is not resolving the hostname properly, it can lead to SSL certificate verification issues. You can check your DNS settings by running:

cat /etc/resolv.conf

Solution 5 - Disable SSL certificate verification (not recommended)

Please note that disabling SSL certificate verification is not recommended from a security standpoint. However, as a temporary workaround for testing purposes, you can use the --insecure option with curl to ignore SSL certificate verification:

sudo curl -fsSL --insecure https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Rosalindarosalinde answered 19/7, 2023 at 16:47 Comment(0)
A
0

wget may not be using up to date root certificates. In that case it will output nothing to stdout, causing apt-key to throw the error of the description. I could resolve this by upgrading my debian 9.5 image to the latest 9.13

apt-get update
apt-get upgrade -y

before running wget

Abscissa answered 30/9, 2021 at 22:51 Comment(0)
D
0

There's another, very basic reason that triggers the error message that is the title of this post:

This error message happens if you try to decrypt an unencrypted file.

The message is saying that gpg did try to read the file to decrypt, but it could not find the info it needed, the info the encrypt process writes there.

So the message can also mean "double-check you gave the correct file to decrypt, it looks like it is not an encrypted file".

Like this:

# Encrypt your file
encrypt my_text_file > my_encrypted_file

# ERROR! You try to decrypt the unencrypted file DON'T DO THIS
decrypt my_text_file > decrypted_file
gpg: no valid OpenPGP data found. 
gpg: decrypt_message failed: Unknown system error

# You unencrypt the correct (encrypted) file and it works 
decrypt  my_encrypted_file > decrypted_file
Decathlon answered 10/1, 2022 at 17:27 Comment(0)
H
0

I have solved the error gpg: no valid OpenPGP data found. For my Ubuntu 20.04 Firstly:

sudo apt-get update

then,

sudo apt-get install ca-certificates

Finally,

sudo apt install curl

Hellish answered 23/9, 2022 at 4:3 Comment(0)
S
0

For those facing gpg: no valid OpenPGP data found. during docker installation due to curl: (5) Could not resolve proxy: could clear their list of proxies and try again;

env | grep -i proxy  //for listing all proxies
unset <name of the proxy>  // remove all proxies that is shown in the error 

Example :

unset http_proxy
unset HTTPS_PROXY
Strasser answered 21/10, 2022 at 7:31 Comment(0)
H
-4

I also got the same error. I've referred to the below mentioned link and ran this commands

gpg --import fails with no valid OpenPGP data found

gpg --import KEYS
sudo apt-get update

It worked.

I'm using Ubuntu version 12.04

Hendrika answered 24/2, 2014 at 12:21 Comment(3)
this means gpg --import KEYS will bypass (work like) apt-key add KEYS?Faltboat
Unfortunately, I dont understand how to apply this solution. How does the text "gpg --import KEYS" "sudo apt-get update" relate to the command "wget -q -O - pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -"? what is KEYS? if you dont now need to use wget, how do you get the key? If I try "# gpg --import KEYS" i get a lot of errors, including "pgp: cant open KEYS: no such file or directory"Dependency
maybe he meant the word KEYS as a placeholder for your key source URL.Alyssa

© 2022 - 2024 — McMap. All rights reserved.