TL;DR
To fix the “gpg: no valid OpenPGP data found” error on your Linux system, try these solutions:
- Fix the Outdated Software: Ensure GPG is up-to-date using sudo apt update && sudo apt upgrade, then restart with gpgconf –kill gpg-agent && gpgconf –reload gpg-agent.
- Check for Improperly Formatted or Corrupted Files: Verify files with gpg –list-packets filename.gpg and re-import using gpg –import publickey.asc.
- Install CA Certificates: Install CA certificates with sudo apt update && sudo apt install ca-certificates.
- Change the Path in the .bashrc File: Add export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt to .bashrc and save changes.
Learn more about how to fix the “gpg: no valid OpenPGP data found” error in the detailed guide below.
Running into errors can be really frustrating, especially when you’re in the middle of something important. If you’ve seen the “gpg: no valid OpenPGP data found” error, don’t worry—there’s a way to fix it. This post will help you solve this problem with easy steps. We’ll cover how to update your software, check for corrupted files, and set up key servers correctly. By the end, you’ll know exactly what to do to fix this error and keep it from happening again.
What is the gpg: no valid OpenPGP data found Error?
The gpg: no valid OpenPGP data found error happens when you try to import a PGP key using GPG (GNU Privacy Guard), but GPG can’t find any valid key data in the file or URL you provided. This means the key file might be:
- Corrupt
- Incorrectly formatted
- Incomplete
Alternatively, there might be a problem with the URL where the key is located.
How to Fix the gpg: no valid OpenPGP data found Error
To fix the “gpg: no valid OpenPGP data found” error, start by updating your GPG software. Use the command sudo apt update && sudo apt upgrade to ensure you have the latest version. Then, restart GPG with gpgconf --kill gpg-agent && gpgconf --reload gpg-agent. This should resolve the issue.
Here’s the detailed step-by-step guide for this method and six other methods to fix the “gpg: no valid OpenPGP data found” error:
1. Fix the Outdated Software
Make sure both GPG and OpenPGP software are up-to-date and compatible to avoid or fix the “gpg: no valid OpenPGP data found” error. Here are the steps to update GPG and OpenPGP:
- Check the newer version of GPG by running the command:
sudo apt update && sudo apt upgrade - To install the newer version of GPG, use the command:
sudo apt install gnupg - After running these commands, you’ll have this output:

- Now, restart GPG with the following commands:
gpgconf --list-dirs
gpgconf --kill gpg-agent
gpgconf --reload gpg-agent Alternatively, you can use this command to restart GPG:
sudo systemctl restart gpg 
- Now, try decrypting or verifying the OpenPGP data again.
gpg -c filename.extension - Once you execute this command, you’ll have to enter the passphrase for this file.

- If the command is successful, you’ll see the following output:

2. Check for Improperly Formatted or Corrupted Files
Sometimes, you may see the “gpg: no valid OpenPGP data found” error when the files are corrupt or improperly formatted. If that’s the case, follow these steps:
- Check if the file is complete and not corrupted by running the command:
gpg --list-packets filename.extension.gpg - Enter the passphrase that you had entered for this file to let the Terminal read the packets.

- You’ll see the following output:

- If the file is corrupted, try downloading it from a trusted source again. But if the file is complete but encrypted with a different public key, obtain the correct public key and import it into GPG using the command:
gpg --import publickey.asc 3. Install CA Certificates
If you are experiencing the “gpg: no valid OpenPGP data found” error while using GPG, installing the CA certificate onto your system can help to resolve the issue. This is because GPG relies on digital certificates to authenticate and encrypt messages, and the absence or corruption of these certificates can cause this error message to appear. To install the CA certificate on your system, you can follow these steps:
- Execute the following code to install CA certificates:
sudo apt update && sudo apt install ca-certificates - Wait for the update and the new CA certificate installation process to complete.

- If your Linux packages and CA certificates are already updated and installed on your system, you will see a message indicating this on your Terminal.

4. Change the Path in the .bashrc File
If the “gpg: no valid OpenPGP data found” error is caused by the computer looking for the CA certification in the wrong path, you can change the path in the .bashrc file.
- Use the following command to open the .bashrc file executable script file:
nano ~/.bashrc - Once the file opens, add the following command to it:
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt - Press Ctrl + O to save the file and Ctrl + X to exit the nano editor.

- This command will add the correct path to the file, and the “gpg: no valid OpenPGP data found” error should no longer occur.
5. Refresh the Keyring
To fix the “gpg: no valid OpenPGP data found” error, try refreshing the keyring. To do this, you have to:
- Execute the following command in the Terminal app:
gpg --refresh-keys - Wait for the refreshing process to complete.

- Once this process is complete, try to decrypt the file or verify the OpenPGP signature and check if the error is resolved.
6. Verify the Keyring Settings
Ensure that the keyring settings are correct. Follow the steps below to verify the keyring settings:
- In the Terminal app, enter the following command:
gpg --list-keys - You’ll see the list of gpg keys stored on your Linux system.

- If you see an error message, the keyring settings are incorrect. To fix the settings, enter the following command: