'Error while update the linux (sudo apt-get update)

W: GPG error: https://apt.kitware.com/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6AF7F09730B3F0A4 E: The repository 'https://apt.kitware.com/ubuntu xenial InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.



Solution 1:[1]

Problem:

$ sudo apt update
...
Get:6 https://apt.kitware.com/ubuntu focal InRelease [11.0 kB]
Err:6 https://apt.kitware.com/ubuntu focal InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6AF7F09730B3F0A4
...

Reference(s):

The following page explained the problem nicely, and initially solved the problem for me:

Cause:

The apt packaging system has a set of trusted keys that determine whether a package can be authenticated and therefore trusted to be installed on the system. Sometimes the system does not have all the keys it needs and runs into this issue. Fortunately, there is a quick fix. Each key that is listed as missing needs to be added to the apt key manager so that it can authenticate the packages.

Solution:

Looking at the error above, apt is telling us that the following key is missing: 6AF7F09730B3F0A4

To add these keys, run the following command:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
Executing: /tmp/apt-key-gpghome.LNRASkE1Mc/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
gpg: key E2D464B33738BD19: public key "Kitware Apt Archive Automatic Signing Key (2022) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1
$

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JonathanG