apt: NO_PUBKEY / GPG error

Debian / Ubuntu

Running apt update shows 'NO_PUBKEY xxxxxxxxx' — a third-party repository's GPG signing key is missing or expired, preventing packages from being verified.

Check your exact device first. Codes and procedures vary by model and software version. Back up important files before recovery. Stop if a device is overheating, smells burnt, or has a swollen battery.

CHOOSE HOW YOU WORK

Clear help. Useful detail.

Start with the checks below. Tick a step after you try it, and keep a note of what changed. You can stop as soon as the original task works.

What can cause it?

  • Third-party repository GPG key expired
  • Key imported using deprecated apt-key method
  • Key server not responding
  • Repository changed its signing key

What to try

Work through one step at a time
Your troubleshooting progress0 steps tried
  1. Import the Missing GPG Key

    Run: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYID (replace KEYID with the long hex string from the error). Then re-run apt update.

  2. Use the New Keyring Method

    Modern Debian/Ubuntu uses /etc/apt/keyrings/. Download the key: curl -fsSL https://repo.example.com/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/repo.gpg

  3. Re-add the Repository

    Remove the repository from /etc/apt/sources.list.d/ and add it back following the repository's current instructions (they may have changed the key).

How did it go?

Test the original task again. A completed checklist doesn’t by itself mean the problem is fixed.

If the error comes back

Record the full error, your exact model, software version, and the steps you tried. Share these with the manufacturer or a qualified technician. A repeated code needs a diagnosis, especially if it involves storage, heat, or power.

Find the instructions for your model

Debian / Ubuntu official support

This is a general support link. This reference guide has not been checked against a model-specific source in this update.