This write-up has compiled the most authentic solutions for fixing the “gpg: no valid OpenPGP data found” error. Have a look at the below-given methods and try them one by one on your system
Method 1: Solve gpg: no valid OpenPGP data found error (for wget and curl command)
If you are getting the “gpg: no valid OpenPGP data found” error while executing a “wget” or “curl” command, then the first solution you can try out is to split your command into two parts and then execute them separately.
Let’s say the “wget” command which encountered the error is :
For resolving the “gpg: no valid OpenPGP data found” error, firstly download the “BAA3GF9.asc” key separately and then add it to the apt repository.
To get the key file key, we will type out the following command:
After doing so, we will add the key into the apt repository by adding its filename in the “apt-key” command:
Similarly, if you have executed a “curl” command with output the “gpg: no valid OpenPGP data found” error, then you have to perform the same split operation on it:
Firstly, we will download the key specified in the curl command:
In the next step, add the downloaded key as a “trusted key” in your “apt” repository in the following way:
Method 2: Solve gpg: no valid OpenPGP data found error (for wget and curl command)
In case if your company’s security policy has restricted your access to the Internet and deleted the trusted CA or Certificate Authority root certificates, then, you must install the CA Certificates for signing the certificates of the servers with which you need to securely communicate. This solution will also assist you in getting rid of the “gpg: no valid OpenPGP data found” error.
For installing the “CA certificates”, write out below-given command in terminal:
Method 3: Solve gpg: no valid OpenPGP data found error (for wget command)
Suppose your organization uses its own certificate and you are behind a corporate proxy. In that case, there exists a possibility to face the “gpg: no valid OpenPGP data found” error while executing the “wget” command. The “–no-check-certificate” option is added in the “wget” command to bypass the verification and continue the download:
For instance, the command which showed us the “gpg: no valid OpenPGP data found” error is:
Now, we will add the “–no-check-certificate” option in the same “wget” command:
Method 4: Solve gpg: no valid OpenPGP data found error (for curl command)
One of the other reasons for the “gpg: no valid OpenPGP data found” error can be the configuration problem of your machine, where the “curl” command is searching for the root CA in the wrong place. To handle the “gpg: no valid OpenPGP data found” error, in this case, you have to fix the CURL certificates path in the “.bashrc” file.
To do so, firstly open up the “.bashrc” file in the nano editor:
After doing so, add the following line in the opened file and save it:
Conclusion
You may encounter “gpg: no valid OpenPGP data found” error when you download a file and try to add its key to your apt repositories at once using the “wget” or “curl” command. Also, if CA certificates are not installed on your system or wrong path is assigned for the CA certificates, then “wget” and “curl” will only output the “gpg: no valid OpenPGP data found” error. In this write-up, we have discussed five different methods for solving the “gpg: no valid OpenPGP data found” error. Try each of them sequentially and be free from the mentioned error.