How to fix apt error: NO_PUBKEY C5E224500C1289C0

Problem:

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

Err:2 https://linux.teamviewer.com/deb stable InRelease                                                                                                                                
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C5E224500C1289C0

Solution:

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

You can import the key using the following commands:

wget -q https://download.teamviewer.com/download/linux/signature/TeamViewer2017.asc -O- | gpg --dearmor | sudo tee /usr/share/keyrings/teamviewer-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/teamviewer-archive-keyring.gpg] https://linux.teamviewer.com/deb stable main" > /etc/apt/sources.list.d/teamviewer.list

and then running

apt update

again.