当前位置:   article > 正文

ROS2安装:Failed to connect to raw.githubusercontent.com port 443 after 3 ms: Connection refused_add the ros 2 gpg key with apt.

add the ros 2 gpg key with apt.

前言

这两天换了台电脑装ROS2,按照官网的教程进行安装,发现到如下两步会出现问题,最后把解决的过程记录,便于自己理解

环境

Ubuntu 22.04
ROS2 humble(需要安装)
已经科学上网

流程

按照官网的步骤如下:

官网: https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html#

Set locale

locale  # check for UTF-8

sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

locale  # verify settings
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Add the ROS2 apt repository

First ensure that the Ubuntu Universe repository is enabled.

sudo apt install software-properties-common
sudo add-apt-repository universe
  • 1
  • 2

Now add the ROS 2 GPG key with apt.

sudo apt update && sudo apt install curl
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
  • 1
  • 2

Then add the repository to your sources list.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
  • 1

Install ROS2 bag

sudo apt update
sudo apt upgrade
  • 1
  • 2

之后就可以使用sudo apt install来下载需要的ROS2的包了

sudo apt install ros-humble-desktop
sudo apt install ros-humble-ros-base
sudo apt install ros-dev-tools
  • 1
  • 2
  • 3

问题

在正常的安装流程的这一步sudo add-apt-repository universe会出现以下问题

Adding component(s) 'universe' to all repositories.
Press [ENTER] to continue or Ctrl-c to cancel.
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:4 http://packages.ros.org/ros2/ubuntu jammy InRelease [4,673 B]
Err:4 http://packages.ros.org/ros2/ubuntu jammy InRelease  
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
Hit:5 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
W: GPG error: http://packages.ros.org/ros2/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
E: The repository 'http://packages.ros.org/ros2/ubuntu jammy 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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

使用搜到的增加PUBKEY的方法无法解决,并且如果在后面,需要增加ros的key时候,会出现连接拒绝的情况

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 3 ms: Connection refused
  • 1
  • 2

解决

  1. sudo vim etc/hosts
  2. 添加一行:185.199.108.133 raw.githubusercontent.com
  3. :wq保存退出
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/719142
推荐阅读
相关标签
  

闽ICP备14008679号