ROS error: An error occurred during the signature verification

created at 08-17-2021 views: 8

description

When executing sudo apt-get update, ROS reports an error:

An error occurred during the signature verification. The repository
is not updated and the previous index files will be used. GPG error:
http://packages.ros.org/ros/ubuntu bionic InRelease: The following
signatures couldn’t be verified because the public key is not
available: NO_PUBKEY F42ED6FBAB17C654

reason

In order to deal with a recent security incident, the old key has been revoked. Therefore, when executing apt-get update, the key error will be prompted, just replace the key.
The new key and the old key are as follows:

old key: 421C365BD9FF1F717815A3895523BAEEB01FA116
new key: C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

Solution

First delete the old key:
Versions after 16.04:

 sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116

15.10:

sudo apt-key del B01FA116

Then add a new key:

sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

Finally, just run sudo apt update and it will be OK.

created at:08-17-2021
edited at: 08-17-2021: