以下是针对树莓派(ARM64 架构)Ubuntu 24.04 (Noble) 系统 apt update 报错的最终解决方案总结:
问题原因
- 初始错误 (
Transaction was already aborted):APT 缓存损坏或镜像源同步问题 - 后续错误 (
404 Not Foundforbinary-arm64):ARM64 架构误用了仅支持 AMD64 的ubuntu镜像源
最终解决方案
步骤 1:备份原配置
bash
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
步骤 2:修改为 ARM64 适用的 Ubuntu Ports 国内源
bash
sudo tee /etc/apt/sources.list.d/ubuntu.sources << 'EOF'
Types: deb
URIs: http://mirrors.aliyun.com/ubuntu-ports/
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb-src
URIs: http://mirrors.aliyun.com/ubuntu-ports/
Suites: noble-backports noble-updates noble noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://mirrors.aliyun.com/ubuntu-ports/
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
步骤 3:清理缓存并更新
bash
sudo rm -rf /var/lib/apt/lists/*
sudo apt clean
sudo apt update
关键要点
| 项目 | 说明 |
|---|---|
| 适用架构 | ARM64 / aarch64(树莓派、ARM 服务器等) |
| 镜像源关键区别 | 必须使用 ubuntu-ports 而非 ubuntu |
| 推荐国内镜像 | 阿里云 mirrors.aliyun.com/ubuntu-ports/ |
| 其他可选镜像 | 清华 mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/、中科大 mirrors.ustc.edu.cn/ubuntu-ports/ |
验证命令
bash
# 确认系统架构
dpkg --print-architecture # 应输出: arm64
# 确认 apt 正常工作
sudo apt update && sudo apt upgrade -y