Ubuntu: apt upgrade NO_PUBKEY for kitware repository
Assume you have the following error:
$ sudo apt upgrade ... 9 packages can be upgraded. Run 'apt list --upgradable' to see them. W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://apt.kitware.com/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1A127079A92F09ED W: Failed to fetch https://apt.kitware.com/ubuntu/dists/jammy/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1A127079A92F09ED W: Some index files failed to download. They have been ignored, or old ones used instead.
The kitware repo is added via
$ cat /etc/apt/sources.list.d/kitware.list deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main
Solution: Install the key via
$ sudo apt install kitware-archive-keyring
Source: https://apt.kitware.com/