How to fix apt error: NO_PUBKEY 458CA832957F5868

Problem:

When running apt update, you see the following error message:

Err:27 https://pkgs.tailscale.com/stable/ubuntu jammy InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 458CA832957F5868

 

Solution:

This error occurs due to the Tailscale repo using the outdated (as of April 2022) apt-key method of importing keys.

You can import the key by just installing the tailscale repo again (these commands are listed on the official tailscale installation page):

curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list

and then running

apt update

again.