是什么问题?
当我们进行ros相关的功能包的安装的时候或者在有安装ros的linux系统上进行sudo apt-get update的操作的时候, 就会出现以下报错:
Get:1 http://packages.ros.org/ros/ubuntu focal InRelease [4,676 B]
Hit:2 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Err:1 http://packages.ros.org/ros/ubuntu focal InRelease
The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Fetched 4,676 B in 4s (1,078 B/s)
Reading package lists… Done
W: 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 focal InRelease: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
W: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/focal/InRelease The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
W: Some index files failed to download. They have been ignored, or old ones used instead.
为什么出现这个报错
ROS使用debian包管理系统来分发软件, 因此就需要一个GPG密钥来确保功能包的准确性和权威性, 通常来说,默认的密钥大概在使用2年之后会过期, 因此我们需要从新添加ros相关的密钥上去。
如何解决
下载证书并添加。
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.key
sudo apt-key add ./ros.key
安装成功后,会显示OK的log信息。
$ sudo apt update
...
Get:15 http://packages.ros.org/ros/ubuntu focal InRelease [4,676 B]
...
Fetched 2,671 kB in 2s (1,607 kB/s)
Reading package lists… Done
Building dependency tree
Reading state information… Done
30 packages can be upgraded. Run 'apt list --upgradable' to see them.