When running `sudo apt update` on Kali Linux, you might face a GPG key error like this:
Get:1 http://kali.download/kali kali-rolling InRelease [41.5 kB]
Err:1 http://kali.download/kali kali-rolling InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED65462EC8D5E4C5
Reading package lists... Done
W: GPG error: http://kali.download/kali kali-rolling InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED65462EC8D5E4C5
E: The repository 'http://http.kali.org/kali kali-rolling InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.This means Kali's signing key is missing from your system.
Follow these steps to resolve the issue by fetching and adding the missing GPG key.
curl -fsSL https://archive.kali.org/archive-key.asc -o kali-archive-key.ascsudo gpg --dearmor < kali-archive-key.asc | sudo tee /etc/apt/trusted.gpg.d/kali.gpg > /dev/nullrm kali-archive-key.ascsudo apt updateThe update should now work without GPG key errors.
Hit:1 http://kali.download/kali kali-rolling InRelease
Reading package lists... Done- This method is cleaner and aligns with current best practices for GPG key management in Debian-based systems.
- Always make sure the key you're importing is from a trusted source.