# apt update 报 EXPKEYSIG F42ED6FBAB17C654

> 原文链接：https://robotics.hellobike.com/pitfalls/2021-05-29-robotics-se-99143
> 频道：pitfalls | 更新日期：2021-05-29 | 标签：auto, stackexchange, ros, ros2, buildfarm, apt
> 核心摘要：ROS apt 仓库签名密钥过期导致更新失败，重新导入 ROS 公钥即可。

# apt update 报 EXPKEYSIG F42ED6FBAB17C654

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[apt update: signatures were invalid: F42ED6FBAB17C654](https://robotics.stackexchange.com/questions/99143/apt-update-signatures-were-invalid-f42ed6fbab17c654)（Robotics Stack Exchange #99143）

**状态**：已解决

## 问题

`apt update` 访问 ROS apt 仓库时报 `EXPKEYSIG F42ED6FBAB17C654`，并提示仓库未签名，导致 CI 和通过 apt 安装 ROS 失败。

## 环境

Ubuntu focal；ROS 1/ROS 2 的 `packages.ros.org` apt 仓库；可能涉及 Docker 镜像/容器。

## 解决办法

1. ROS 1 安装运行：`curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -`
2. ROS 2 安装运行：`sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg`
3. 若 Docker 镜像/容器仍提示密钥过期，使用 `docker build --no-cache`，或在密钥导入前修改 `Dockerfile` 以使缓存失效。

原问题作者：gvdhoorn-rse；采纳答案作者：gvdhoorn-rse。原内容依 CC BY-SA 4.0 授权，本页摘要同样依 CC BY-SA 4.0 授权。
:::

## 原始参考来源 (Sources)

- [Robotics Stack Exchange #99143：apt update: signatures were invalid: F42ED6FBAB17C654](https://robotics.stackexchange.com/questions/99143/apt-update-signatures-were-invalid-f42ed6fbab17c654)