Fix the "GPG error: https://apt.releases.hashicorp.com bionic InRelease: The following signatures couldn't be verified because the public key is not available" error message and successfully install HashiCorp products on your Ubuntu system.
You're encountering a "NO_PUBKEY" error when trying to install or update HashiCorp packages, right? This means your system doesn't recognize the digital signature on the package, indicating a potential security risk. Don't worry, this is usually a simple fix related to HashiCorp's routine key rotation. Here's a step-by-step guide to resolve this:
The issue arises from a mismatch between your system's GPG key database and the HashiCorp repository's signing keys. This typically happens after HashiCorp rotates their signing keys for security. To resolve this:
NO_PUBKEY AA16FCBCA621E701).wget command to download the key file (usually ending in .asc) and then use sudo apt-key add <key_file.asc> to add it to your system's trusted keys.sudo apt update to refresh your package lists and incorporate the changes.If the issue persists, double-check that you've downloaded the correct key and that there are no typos in the commands. You can also try removing and re-adding the HashiCorp repository to ensure you have the latest configuration.
This guide provides a solution for resolving GPG key errors encountered when using HashiCorp repositories. The error message typically indicates a missing key on the system. To fix this, download the HashiCorp GPG key, add it to your system, and update your package lists. If the issue persists, try removing and re-adding the HashiCorp repository to your package manager's sources list. Remember to verify the GPG key fingerprint from official sources before adding it and adjust the commands based on your operating system.
Let's assume the error message you received is:
gpg: key AA16FCBCA621E701: The key is not certified with a trusted signature
This indicates that the key with ID AA16FCBCA621E701 is missing from your system. Here's how to fix it:
1. Download the new key:
wget -O hashicorp.asc https://www.hashicorp.com/static/gpg/hashicorp.asc
# Replace the URL with the actual key file location from HashiCorp's documentation2. Add the key to your system:
sudo apt-key add hashicorp.asc3. Update your package lists:
sudo apt update4. (Optional) Remove and re-add the HashiCorp repository:
If the issue persists, you can try removing and re-adding the HashiCorp repository.
First, identify the repository line in your sources.list:
grep hashicorp /etc/apt/sources.listThen, comment out the line by adding a # at the beginning. For example:
# deb [arch=amd64] https://releases.hashicorp.com focal main
Finally, update your package lists, uncomment the line, and update again:
sudo apt update
# Remove the # from the beginning of the HashiCorp repository line
sudo apt updateImportant Notes:
<key_file.asc> and URLs with the actual values from your specific situation.apt, which is the package manager for Debian-based systems like Ubuntu. If you're using a different distribution, adjust the commands accordingly.wget: If you don't have wget installed, you can use curl -O <key_file_url> to download the key file.sudo apt update frequently, can help prevent these issues as it ensures you have the latest GPG keys.This document outlines the steps to resolve GPG key errors encountered when interacting with HashiCorp repositories. These errors typically occur due to a mismatch between your system's GPG key database and the HashiCorp repository's signing keys, often after HashiCorp rotates their keys for security.
| Step | Action | Details |
|---|---|---|
| 1. Identify the Problematic Key | Examine the error message. | The error message will usually specify the missing key ID (e.g., NO_PUBKEY AA16FCBCA621E701). |
| 2. Download the New Key | Obtain the updated key. | Visit the HashiCorp website or their repository's documentation to find the latest GPG key fingerprint. |
| 3. Add the Key to Your System | Integrate the new key. | Use wget to download the key file (usually ending in .asc) and then use sudo apt-key add <key_file.asc> to add it to your system's trusted keys. |
| 4. Update Your Package Lists | Refresh your package lists. | Run sudo apt update to incorporate the changes. |
Troubleshooting:
By following these steps, you can effectively resolve GPG key errors and ensure the integrity of the HashiCorp packages you install. Remember to prioritize security by always verifying GPG key fingerprints and obtaining software from trusted sources. If you encounter persistent issues, consult the official HashiCorp documentation or seek assistance from their support channels.
[Resolved] Debian Repo - Apt Update Fails, New GPG Keys ... | Update: Mostly resolved. Main security page lists both updated and rotated key fingerprints, PRs in place to update remaining docs. Just pull the new keys, as per the regular installation docs for your specific tool. I was running my apt update this morning (as one does on Mondays) and got a complete failure due to the the Debian GPG signing key rotation for Hashicorp. When I pulled the latest key from Hashicorp servers, I could not find any reference to the fingerprint in the docs. Here is...
Bad signature for https://apt.releases.hashicorp.com/dists/focal ... | I’m trying to mirror the hashicorp apt repository with debmirror, but I get the following error: [GNUPG:] BADSIG DA418C88A3219F7B HashiCorp Security (HashiCorp Package Signing) security+packaging@hashicorp.com [GNUPG:] VERIFICATION_COMPLIANCE_MODE 23 gpgv: Signature made Wed Jan 4 15:38:21 2023 UTC gpgv: using RSA key DA418C88A3219F7B gpgv: BAD signature from "HashiCorp Security (HashiCorp Package Signing) security+packaging@hashicorp.com" .temp/.tmp/dists/focal/InRelease si...
The repository 'https://apt.releases.hashicorp.com focal Release ... | Hello, Trying to install vagrant on Ubuntu 20 following these instructions, but getting the error in title. Does Hashicorp no longer maintain a repo for Ubuntu 20 (focal)?
Fix apt-get update “the following signatures couldn't be verified ... | … W: GPG error: http://download.opensuse.org Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ...