安装ROS时遇到的一些坑,做个笔记方便自己查看

一、当执行

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources/list.d/ros-latest/list'

时,终端显示sh: 1: cannot create /etc/apt/sources/list.d/ros-latest/list: Directory nonexistent
解决办法:将命令替换成

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'

——————————————————————————————————
参考文章:https://www.cnblogs.com/sea-stream/p/10049385.html
作者:anobscureretreat

不用上述两种的话,
写入如下源(中科大):

 sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/$DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

这个比较好用。

二、添加密钥可以有以下几种:

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

显示gpg: 合计被处理的数量:1 gpg: 已导入:1表示成功。

三、sudo apt-get update失败
如下报错

命中:1 http://archive.canonical.com/ubuntu bionic InRelease
获取:2 http://mirrors.sohu.com/ubuntu bionic InRelease [8 B]
错误:2 http://mirrors.sohu.com/ubuntu bionic InRelease
  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
获取:3 http://mirrors.sohu.com/ubuntu bionic-updates InRelease [8 B]
错误:3 http://mirrors.sohu.com/ubuntu bionic-updates InRelease
  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
获取:4 http://mirrors.sohu.com/ubuntu bionic-backports InRelease [8 B]
错误:4 http://mirrors.sohu.com/ubuntu bionic-backports InRelease
  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
获取:5 http://mirrors.sohu.com/ubuntu bionic-security InRelease [8 B]
错误:5 http://mirrors.sohu.com/ubuntu bionic-security InRelease
  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
命中:6 http://packages.ros.org/ros/ubuntu trusty InRelease
正在读取软件包列表... 完成   
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
N: 无法安全地用该源进行更新,所以默认禁用该源。
E: 仓库 “http://mirrors.sohu.com/ubuntu bionic InRelease” 没有数字签名。
E: 无法下载 http://mirrors.sohu.com/ubuntu/dists/bionic/InRelease  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
N: 无法安全地用该源进行更新,所以默认禁用该源。
E: 仓库 “http://mirrors.sohu.com/ubuntu bionic-updates InRelease” 没有数字签名。
E: 无法下载 http://mirrors.sohu.com/ubuntu/dists/bionic-updates/InRelease  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
E: 无法下载 http://mirrors.sohu.com/ubuntu/dists/bionic-backports/InRelease  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
E: 仓库 “http://mirrors.sohu.com/ubuntu bionic-backports InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 无法下载 http://mirrors.sohu.com/ubuntu/dists/bionic-security/InRelease  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
E: 仓库 “http://mirrors.sohu.com/ubuntu bionic-security InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

解决方案:
使用如下源

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/$DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

之后输入:

sudo apt-get update

四、sudo apt-get update后有如下错误

E: 文件 list 第 1 行的记录格式有误 /etc/apt/sources.list.d/ros-latest.list (Component)
E: 无法读取源列表。

解决方案:
执行

sudo rm /etc/apt/sources.list.d/ros-latest.list

参考文章:https://blog.csdn.net/qq_45805535/article/details/107289424

五、sudo apt-get update后有如下错误

E: 仓库 “http://archive.ubuntu.com/ubuntu/trusty main Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

解决方案:
1.在官网源https://mirrors.ustc.edu.cn/repogen/下载对应版本最新的源,比如19.10版本的ubuntu,对应下载这个
在这里插入图片描述我的是18.04的ubuntu就选18.04下载

2.下载sources.list完成之后将源拷贝到对应的位置将原文件覆盖

sudo cp sources.list /etc/apt

3.再执行sudo apt-get update

参考文章:https://blog.csdn.net/jh_luchi/article/details/102812031

注意!!!!
这个方法用完以后要重新执行ROS安装的第一步,添加ros源,因为这个是改变了原有的sources.list文件。不然后续安装就会报出类似

sudo apt-get install ros-melodic-desktop-full
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
E: 无法定位软件包 ros-melodic-desktop-full

的错误。

补充:
其中,复制文件没有权限的时候
1.打开终端
2.输入sudo nautilus
3.可以进行和windows下相同的操作了
参考文章:https://blog.csdn.net/weixin_40556448/article/details/79769585

六、执行sudo rosdep init
报如下错误
sudo: rosdep:找不到命令

解决方案:
1.输入sudo apt install python-rosdep2
2.输入sudo rosdep init
3.见到如下错误时

ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

输入sudo apt-get install python-rosdep python-wstool ros-melodic-ros
(根据自己安装ros版本填入,比如我是ubuntu18.04安装ROS melodic,所以命令如上)
参考文章:https://blog.csdn.net/weixin_40772628/article/details/103377637
但是我用这个方法只解决了第一个找不到命令的问题,第二个没有解决。解决方法用下边记录的方法。

七、执行sudo rosdep init
有如下错误

ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

解决方案:
1、网上说可能是网络原因,换成手机热点可以成功,但是因为我是在台式机安装,用不了热点,没法尝试。

2、参考这个文章方法以前解决过这个问题https://www.bbsmax.com/A/ZOJPvXKydv/
其中最后一个方法里提到的新建文件复制https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list 里面的内容。具体方法如下:
*1.*输入sudo mkdir -p /etc/ros/rosdep/source.list.d
*2.*进入这个位置cd /etc/ros/rosdep/sources.list.d/
*3.*创建一个文件sudo gedit 20-default.list
*4.*把https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list 里的文件写入刚刚创建的文件(开始我打不开,也没钱挂vpn,用笔记本电脑连手机热点打开了,里边的文件是这个样子的)

# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
 
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
 
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

但是都没能成功。
3、我又找到了这个方法:https://www.cnblogs.com/knightningwing/p/11456463.html
在终端输入
wget https://raw.github.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
但是这个命令又出现了如下问题:

https://raw.github.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
正在连接 raw.github.com (raw.github.com)|151.101.228.133|:443... 失败:拒绝连接。

解决方案:
*1.*进入网站:https://site.ip138.com/raw.Github.com/在里边查询到最新连接的IP地址。
*2.*在Ubuntu终端输入:sudo vi /etc/hosts
*3.*选择上面一个添加内容即可:
比如:151.101.76.133 raw.github.com
后续我又全部添加了这些

# GitHub Start
52.74.223.119 github.com
192.30.253.119 gist.github.com
54.169.195.247 api.github.com
185.199.111.153 assets-cdn.github.com
151.101.76.133 raw.githubusercontent.com
151.101.108.133 user-images.githubusercontent.com
151.101.76.133 gist.githubusercontent.com
151.101.76.133 cloud.githubusercontent.com
151.101.76.133 camo.githubusercontent.com
151.101.76.133 avatars0.githubusercontent.com
151.101.76.133 avatars1.githubusercontent.com
151.101.76.133 avatars2.githubusercontent.com
151.101.76.133 avatars3.githubusercontent.com
151.101.76.133 avatars4.githubusercontent.com
151.101.76.133 avatars5.githubusercontent.com
151.101.76.133 avatars6.githubusercontent.com
151.101.76.133 avatars7.githubusercontent.com
151.101.76.133 avatars8.githubusercontent.com
# GitHub End

再执行sudo rosdep init显示

Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run
	rosdep update

问题解决。

参考文章:https://www.cnblogs.com/sundaysme/p/13198787.html
https://www.it610.com/article/1293081927871438848.htm

八、执行rosdep update
有如下提示:

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml]:
	<urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error timed out>
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
ERROR: error loading sources list:
	<urlopen error <urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>

解决方案:
1.输入sudo vim /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py将里边DOWNLOAD_TIMEOUT = 15.0值,改大一点,我改成了25。
2.输入sudo vim /usr/lib/python2.7/dist-packages/rosdep2/rep3.py同样将里边DOWNLOAD_TIMEOUT = 15.0值,改大一点,我也改成了25。
3.输入sudo vim /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py同上。
我只改了前边两个文件就可以了,参考文章https://www.cnblogs.com/zxzmnh/p/11758103.html中一共改三个文件,有问题的可以再参考一下。

剩下的过程就很简单了,这里就不说了。

  • 33
    点赞
  • 114
    收藏
    觉得还不错? 一键收藏
  • 13
    评论
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值