The “gpg: no valid OpenPGP data found” error is a common issue when downloading an application, and its key using the wget or curl command. There are a few reasons this error may occur, such as being behind a proxy or having CA certificates installed on your system.
This article will share the most effective methods to fix this error.
What is gpg no valid OpenPGP data found?
The “gpg: no valid OpenPGP data found” error means that the public key you are trying to use is either invalid or unsupported. This can happen for some reasons, but the most common reason is that the public key is not in a supported format.
If you are behind a proxy, your CA certificates may not be installed, or the “curl” command may not be able to locate the path of the CA certificates. In any case, you will need to check with your system administrator to resolve this issue.
How to Fix gpg: no valid OpenPGP data found?
Method 1: Install the CA Certificates
If your computer is missing the CA certs, you may get the “gpg no valid OpenPGP data found” error.
To fix this error, run the following commands:
sudo apt-get update sudo apt-get install ca-certificates
Method 2: Split the Commands
When you run wget with the apt-key command, you may encounter this error. You can try separating the two commands.
First, download the key by running the wget command:
wget -q -O jenkins.io.key https://pkg.jenkins.io/debian/jenkins.io.key
Then add the key to the keyring files:
sudo apt-key add jenkins.io.key
Method 3: Install the CA Certificates
Many companies have security policies restricting Internet access and deleting trusted Certificate Authority (CA) or CA root certificates. This can cause problems when communicating securely with servers that use these certificates.
One solution is to install the CA certificates for signing the servers’ certificates with which you need to communicate. This will also help you eliminate the “gpg: no valid OpenPGP data found” error.
By installing the CA certificates, you can securely communicate with the servers that use them and avoid any errors.
To install the CA certificates, run the following command:
sudo apt-get install ca-certificates
Method 4: Specify Path to CA Certificate File
If you have installed the CA certificates, but still get the error, you can specify the location to the CA certificate file.
To add the key to the keyring files by specifying the CA certificate file, run this command:
wget --ca-certificate=/etc/ssl/certs/ca-certificates.crt -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
To specify the same command using curl, run this command:
curl --cacert /etc/ssl/certs/ca-certificates.crt -s -o - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Method 5: Skip the Certificate Check
While trying to download a file from a website, you may face the error “gpg: no valid OpenPGP data found.” This error occurs when your computer cannot verify the website’s security certificate.
Another way to overcome the error “gpg: no valid OpenPGP data found” is to bypass this verification is to add the “–no-check-certificate” option to the “wget” command. This will allow you to continue downloading without verifying the website’s security certificate.
However, this option should only be used if you trust the website and are confident that the file you are downloading is safe. Otherwise, you could be putting your computer at risk by bypassing the certificate verification process.
To add the key without the verification, run this command:
wget --no-check-certificate -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
This article shares the most effective methods to fix the “gpg: no valid OpenPGP data found” error. We hope that one of these methods will help you solve the issue.