当我执行该行sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
以及替换时http://wiki.ros.org/melodic/Installation/Ubuntu它给出了一个错误:gpg: keyserver receive failed: No data
答案1
更新:代码中的任何更改均无效。您需要再次运行代码,直到它正常工作(或者在 if 语句中添加更多要浏览的下载位置,以减少无法下载的可能性);请参阅这个答案。
我只是留下以下旧部分作为证明,任何安慰剂代码更改都对我没有帮助,它是随机的,并且奇怪地出现在每次第一次运行时,而在第二次运行时,它通常有效。
我遇到过类似的事情,安装 ROS Melodic,不过我的情况是在 WSL2 上使用 Docker。
我有=> ERROR [stage-1 2/11] RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources 3.5s
... gpg: keyserver receive failed: Cannot assign requested address
:
#5 0.602 Executing: /tmp/apt-key-gpghome.CWiWk2Kd63/gpg.1.sh --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
#5 2.350 gpg: keyserver receive failed: Cannot assign requested address
我不得不再运行一次,它似乎以某种方式运行通过了——我一开始是这么想的。这是代码:
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros-latest.list' &&\
apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \
apt-get update && \
apt-get install -y ros-melodic-desktop-full
但后来我收到一个新的错误:
#5 353.2 Get:1306 http://archive.ubuntu.com/ubuntu bionic/main amd64 usb-modeswitch amd64 2.5.2+repack0-2ubuntu1 [53.6 kB]
#5 353.3 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/o/opencv/libopencv-core3.2_3.2.0+dfsg-4ubuntu0.1_amd64.deb Hash Sum mismatch
#5 353.3 Hashes of expected file:
#5 353.3 - SHA512:6c5ee067a73d330eeea4ba0426f1f41a3021e1d91548ab7530706ba3d80b25df330bb37be2e753e1c87fbcd5d50f57c2e2de80ee91c59a80b69a8a6cc982bef5
#5 353.3 - SHA256:292740f9146eca5728a32cdf40a27efae4a724f76cf40601b8ef57368cde5bd5
#5 353.3 - SHA1:3a27b6ade543bd5f2ca5087ed3bf57b3df569d89 [weak]
#5 353.3 - MD5Sum:a629fdd926ae5e75fc878403a5409c1a [weak]
#5 353.3 - Filesize:708876 [weak]
#5 353.3 Hashes of received file:
#5 353.3 - SHA512:0fd63abb591a56fb4f0b790483b53df60037e2494a26913430cd5fb70ed21e05d3f0cc355562ce354f9ee07b9caf8d23a9d56d281e384ba973403dfd02a73cd4
#5 353.3 - SHA256:dcf88559ae189cde343f2be1e228d889ffa40746e0dcd9330600243606bbe949
#5 353.3 - SHA1:e5c14569a3bbfdb2e93f08535147e3547379c418 [weak]
#5 353.3 - MD5Sum:2d778738711f7745937060a2b50ba051 [weak]
#5 353.3 - Filesize:708876 [weak]
#5 353.3 Last modification reported: Wed, 26 Sep 2018 13:48:22 +0000
#5 353.3 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
#5 353.3 Fetched 556 MB in 5min 31s (1680 kB/s)
------
executor failed running [/bin/bash -c sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros-latest.list' && apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && apt-get update && apt-get install -y ros-melodic-desktop-full]: exit code: 100
我不确定哪一行代码导致了该错误。如果是由 引起的apt-get install -y ros-melodic-desktop-full
,那么这超出了这个问题。我后来解决了这个问题。但如果该错误是由前两行引起的,那么它就足以在这里发布。
随后,gpg: keyserver receive failed: Cannot assign requested address
错误再次出现。
最后,添加更多 似乎有帮助RUN
。我发布了超出此问题的其他代码行,只是为了展示这一切的目的:安装 ros-melodic 和 python-catkin-tools。
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ros-melodic-desktop-full
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-catkin-tools