问题描述
我给树莓派安装了ROS后,需要换源。我用了清华源,我在/etc/apt/sources.list
里写入:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
结果换源之后update,upgrade
,以及apt-get install xxx
全都报错,报错如下:
E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-updates/main/binary-arm64/Packages 404 Not Found [IP: 101.6.15.130 443]
原因
原因很简单,换源时疏忽了,清华源官网界面写着
我们的树莓派是arm架构,而这个仓库不包含arm架构的软件包!
解决方案
图片里也写了解决方案,要使用ubuntu-port源(链接)。
进入网站(链接),找到合适版本。
选择版本后复制里面的链接。
我们更改源,打开配置文件:
sudo nano /etc/apt/sources.list
在里面粘贴你对应版本的源,问题解决。
然后更新软件包,观察输出已经正常了。
sudo apt-get update
sudp apt-get upgrade
// 此步第一次一般时间比较长