LINUX系列文章目录
第一章 ARM板子如何替换debian镜像源
前言
当你做嵌入式开发过程中拿到一个开发板,遇到apt update
,发现无法成功,镜像源无法使用,这样的话大大增加了开发难度。最近一个项目遇到这个问题,搜寻网络却无法得到有效答案,本人作为一名嵌入式开发工程师,在这里总结了一下,希望对大家做开发有所帮助,共同进步,这是我的第一篇文章,都是干货,希望大家多多支持,点点关注订阅,持续更新,致力于有效解决我们项目开发过程中遇到问题。
一、镜像源是什么?
下面先普及一下概念(此部分来源于网络)
- 源: 源就是来源,就是你安装软件时,程序从哪里获取软件包(安装程序在你的机器上,但需要安装的东西在软件源服务器上)。
- 镜像:镜像原意是光学里指的物体在镜面所成之像。引用到电脑网络上,一个网站的镜像是指对一个网站内容的拷贝。镜像通常用于为相同信息内容提供不同的源,特别是在下载量大的时候提供了一种可靠的网络连接。
- 镜像源:镜像源就是把官方的源作为一个镜像,你可以在这下载软件。比如ubuntu官方源在国外,下载软件可能会很慢,这时候就需要换成国内的镜像源。
二、问题复现
root@zynq:/etc/apt# apt-get update
Ign http://mirrors.tuna.tsinghua.edu.cn jessie InRelease
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates InRelease
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates InRelease
Ign http://mirrors.tuna.tsinghua.edu.cn jessie Release.gpg
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates Release.gpg
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates Release.gpg
Ign http://mirrors.tuna.tsinghua.edu.cn jessie Release
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates Release
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates Release
Err http://mirrors.tuna.tsinghua.edu.cn jessie/main Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/contrib Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/non-free Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/main armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/contrib armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/non-free armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/contrib Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/contrib Translation-en
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/main Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/main Translation-en
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/non-free Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/non-free Translation-en
Err http://mirrors.tuna.tsinghua.edu.cn jessie-updates/main Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie-updates/contrib Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie-updates/non-free Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie-updates/main armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie-updates/contrib armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie-updates/non-free armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates/contrib Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates/contrib Translation-en
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates/main Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates/main Translation-en
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates/non-free Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie-updates/non-free Translation-en
Err http://mirrors.tuna.tsinghua.edu.cn jessie/updates/main Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/updates/contrib Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/updates/non-free Sources
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/updates/main armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/updates/contrib armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Err http://mirrors.tuna.tsinghua.edu.cn jessie/updates/non-free armhf Packages
404 Not Found [IP: 101.6.15.130 80]
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates/contrib Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates/contrib Translation-en
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates/main Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates/main Translation-en
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates/non-free Translation-en_US
Ign http://mirrors.tuna.tsinghua.edu.cn jessie/updates/non-free Translation-en
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie/main/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie/contrib/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie/non-free/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie/main/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie/contrib/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie/non-free/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie-updates/main/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie-updates/contrib/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie-updates/non-free/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie-updates/main/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie-updates/contrib/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/dists/jessie-updates/non-free/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian-security/dists/jessie/updates/main/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian-security/dists/jessie/updates/contrib/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian-security/dists/jessie/updates/non-free/source/Sources 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian-security/dists/jessie/updates/main/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian-security/dists/jessie/updates/contrib/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian-security/dists/jessie/updates/non-free/binary-armhf/Packages 404 Not Found [IP: 101.6.15.130 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
我们用apt-get update
时候发现更新失败,查询发现国内debian镜像源已经不维护这个jessie版本的源,所以导致更新失败。怎么去解决呢?毫无疑问,这个时候需要换一个国内持续维护的debian镜像源。文章来源:https://www.toymoban.com/news/detail-843029.html
三、更换镜像源步骤
- 先选择一个目前还在维护合适的镜像源:https://mirrors.tuna.tsinghua.edu.cn/help/debian/
- 在arm开发板上更换国内镜像源,这里我选择的debian 11 bullseye。
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb https://security.debian.org/debian-security bullseye-security main contrib non-free # deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free
- 执行
apt update
,之后会发现报错,信息如下:
解决方法:
再次执行cd /usr/lib/apt/methods ln -s http https
apt update
,发现又出现报错,信息如下:
解决方法:
最后再次执行:apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 6ED0E7B82643E131 605C66F00D6C9793 112695A0E562B32A 54404762BBB6E853
apt update
无报错。 - 执行
apt upgrade
,问题解决。
总结
以上就是今天要讲的内容,本文简单介绍了ARM板子debian镜像源替换方法,一个好的稳定的镜像源可以有效提升我们嵌入式开发效率。希望大家点点关注,订阅,持续更新,张工致力于有效解决我们项目开发过程中遇到的问题。文章来源地址https://www.toymoban.com/news/detail-843029.html
到了这里,关于嵌入式LINUX开发系列之ARM板子如何替换debian镜像源的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!