When working with Debian Stretch (version 9), you might encounter package verification errors when running apt-get update
, particularly with Google Cloud repositories. The system reports:
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
This occurs because the system lacks the public key needed to verify packages from Google's repositories. APT package manager uses GPG keys to ensure package authenticity. The missing key (6A030B21BA07F4FB
) is required for:
- Google Cloud SDK packages
- Google Compute Engine packages
- Google Cloud Packages Archive
Here's how to resolve this permanently:
# Install necessary tools
sudo apt-get install -y wget
# Download and add the Google Cloud public key
wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# Alternative method if the above fails
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6A030B21BA07F4FB
# Verify the key was added
apt-key list | grep 6A030B21BA07F4FB
Ensure your /etc/apt/sources.list.d/google-cloud.list
contains:
deb http://packages.cloud.google.com/apt cloud-sdk-stretch main
deb http://packages.cloud.google.com/apt google-compute-engine-stretch-stable main
deb http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch main
After implementing the solution:
# Update package lists
sudo apt-get update
# Check for any remaining errors
sudo apt-get update 2>&1 | grep -i pubkey
# Install a test package
sudo apt-get install -y google-cloud-sdk
If issues persist, try these additional steps:
# Clean the apt cache
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
# Reinitialize the package system
sudo apt-get update --fix-missing
# For Docker users (common conflict point)
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
To avoid similar issues in the future:
- Regularly update your keyring:
sudo apt-get install debian-archive-keyring
- Maintain your sources.list files properly
- Consider using
apt-key fingerprint
to verify keys
When running apt-get update
on Debian Stretch systems with Google Cloud repositories configured, you may encounter this signature verification error:
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
The error occurs because your system doesn't have the public key needed to verify packages from Google's repositories. This is a security measure in Debian/Ubuntu systems to ensure package authenticity.
There are two reliable ways to resolve this:
Method 1: Using apt-key (for older Debian versions)
sudo apt-get install -y wget
wget -qO - https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Method 2: Manual Key Installation (recommended)
sudo mkdir -p /usr/share/keyrings
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
Then update your sources.list entry to reference the keyring:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
After importing the key, run:
sudo apt-get update
You should no longer see the NO_PUBKEY errors. The output should look clean:
Hit:1 http://security.debian.org stretch/updates InRelease
Hit:2 http://deb.debian.org/debian stretch InRelease
Get:3 http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease [6,377 B]
Get:4 http://packages.cloud.google.com/apt cloud-sdk-stretch/main amd64 Packages [1,786 B]
Fetched 8,163 B in 1s (5,549 B/s)
Reading package lists... Done
If you still encounter issues:
sudo apt-get install -y debian-archive-keyring
sudo apt-key update
For systems behind corporate proxies:
sudo apt-get -o Acquire::http::proxy="http://proxy.example.com:8080/" update
Remember that Debian 9 (stretch) has reached EOL, so consider upgrading to a supported version if possible.