在为ARM64架构(RK3566)移植ubuntu20.04的时候发现在更换为国内源之后,无法正常完成apt update,报错为:
Ign:25 http://mirrors.aliyun.com/ubuntu focal-updates/main arm64 Packages
Ign:26 http://mirrors.aliyun.com/ubuntu focal-updates/restricted arm64 Packages
Ign:27 http://mirrors.aliyun.com/ubuntu focal-updates/universe arm64 Packages
Ign:28 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse arm64 Packages
Ign:20 http://mirrors.aliyun.com/ubuntu focal-security/multiverse arm64 Packages
Err:17 http://mirrors.aliyun.com/ubuntu focal-security/main arm64 Packages 404 Not Found [IP: 221.204.66.204 80]
Ign:18 http://mirrors.aliyun.com/ubuntu focal-security/restricted arm64 Packages
Ign:19 http://mirrors.aliyun.com/ubuntu focal-security/universe arm64 Packages
Ign:25 http://mirrors.aliyun.com/ubuntu focal-updates/main arm64 Packages
Ign:26 http://mirrors.aliyun.com/ubuntu focal-updates/restricted arm64 Packages
Ign:27 http://mirrors.aliyun.com/ubuntu focal-updates/universe arm64 Packages
Ign:28 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse arm64 Packages
Ign:20 http://mirrors.aliyun.com/ubuntu focal-security/multiverse arm64 Packages
Ign:25 http://mirrors.aliyun.com/ubuntu focal-updates/main arm64 Packages
Ign:26 http://mirrors.aliyun.com/ubuntu focal-updates/restricted arm64 Packages
Ign:27 http://mirrors.aliyun.com/ubuntu focal-updates/universe arm64 Packages
Get:28 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse arm64 Packages [13.0 kB]
Get:28 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse arm64 Packages [13.0 kB]
Ign:28 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse arm64 Packages
Ign:25 http://mirrors.aliyun.com/ubuntu focal-updates/main arm64 Packages
Ign:26 http://mirrors.aliyun.com/ubuntu focal-updates/restricted arm64 Packages
Ign:31 http://mirrors.aliyun.com/ubuntu focal-backports/main arm64 Packages
Ign:32 http://mirrors.aliyun.com/ubuntu focal-backports/universe arm64 Packages
Ign:27 http://mirrors.aliyun.com/ubuntu focal-updates/universe arm64 Packages
Ign:28 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse arm64 Packages
Err:25 http://mirrors.aliyun.com/ubuntu focal-updates/main arm64 Packages 404 Not Found [IP: 221.204.66.204 80]
Ign:26 http://mirrors.aliyun.com/ubuntu focal-updates/restricted arm64 Packages
Ign:31 http://mirrors.aliyun.com/ubuntu focal-backports/main arm64 Packages
Ign:32 http://mirrors.aliyun.com/ubuntu focal-backports/universe arm64 Packages
Ign:27 http://mirrors.aliyun.com/ubuntu focal-updates/universe arm64 Packages
Ign:28 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse arm64 Packages
Ign:31 http://mirrors.aliyun.com/ubuntu focal-backports/main arm64 Packages
Ign:32 http://mirrors.aliyun.com/ubuntu focal-backports/universe arm64 Packages
Ign:31 http://mirrors.aliyun.com/ubuntu focal-backports/main arm64 Packages
Ign:32 http://mirrors.aliyun.com/ubuntu focal-backports/universe arm64 Packages
Ign:31 http://mirrors.aliyun.com/ubuntu focal-backports/main arm64 Packages
Ign:32 http://mirrors.aliyun.com/ubuntu focal-backports/universe arm64 Packages
Err:31 http://mirrors.aliyun.com/ubuntu focal-backports/main arm64 Packages 404 Not Found [IP: 221.204.66.204 80]
Ign:32 http://mirrors.aliyun.com/ubuntu focal-backports/universe arm64 Packages
Reading package lists... Done
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal/main/binary-arm64/Packages 404 Not Found [IP: 221.204.66.204 80]
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal-security/main/binary-arm64/Packages 404 Not Found [IP: 221.204.66.204 80]
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal-updates/main/binary-arm64/Packages 404 Not Found [IP: 221.204.66.204 80]
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal-backports/main/binary-arm64/Packages 404 Not Found [IP: 221.204.66.204 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
我更换的是阿里云的国内源码,是在搜索"Ubuntu20.04换源"的第一个文章,报错发现是无法fetch,我首先尝试了查看是 etc/resolv.conf 文件是否有我所换的阿里云的DNS,发现这里有
nameserver 127.0.0.53
这里是阿里云的DNS,那么好,我查看我的 etc/apt.source.list的文件查看换源换的是否有遗漏
后来发现是这里的错误,举个栗子
我换完源之后的其中之一的源是这样的
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
发现这里"deb http://mirrors.aliyun.com/ubuntu"这里指的是标准的Ubuntu的源,用于运行在Inter架构时候需要的源,但是我的是arm64架构的,不可以使用这个源,如果在非Intel架构(如ARM)的设备上使用标准的ubuntu
源,系统可能无法找到与您的硬件架构匹配的包,从而导致软件包安装失败,在ubuntu后面添加-port可以使用适用非Inter架构的源,所以是
deb http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
更换之后可以正常apt update和install
在这里贴上我修改过后的完整的阿里云的源,在非Inter架构可以正常下载,注意版本是Ubuntu20.04
deb http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse# deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse## Pre-released source, not recommended.
# deb http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse