技术知识库
Debian bookworm 主仓库没有 riscv64 软件包索引
Debian bookworm 主仓库没有 riscv64 软件包索引
摘要
debootstrap 使用了不存在的 Debian 架构名 riscv,因此先查找 binary-riscv;正确名称应为 riscv64。但 Debian 12 bookworm 本身也没有正式发布 riscv64,主仓库仍不会提供 bookworm/main/binary-riscv64。本实验改用第一个正式支持 riscv64 的 Debian 13 trixie。
现象
E: Invalid Release file, no entry for main/binary-riscv/Packages
触发命令的关键参数:
--arch=riscv
bookworm
根因
这里有两处不匹配:
- Debian/dpkg 的 64 位小端 RISC-V 架构名是
riscv64,不是riscv。 - Debian 13 trixie 是首个正式发布 riscv64 的 Debian 稳定版本;Debian 12 bookworm 的 Release 文件没有该架构索引。
Release 签名验证成功只说明镜像元数据可信,不代表所选 suite 一定包含目标架构。
修复
不要在失败后留下的半成品目录中继续 second stage。保留它作为故障证据或另行处理,改用新的目标目录:
cd /home/martin-zou/workspace
sudo debootstrap \
--arch=riscv64 \
--foreign \
--variant=minbase \
trixie \
/home/martin-zou/workspace/debian-riscv64-rootfs \
https://deb.debian.org/debian
验证
第一阶段成功后检查:
file /home/martin-zou/workspace/debian-riscv64-rootfs/bin/dash
sudo du -sh /home/martin-zou/workspace/debian-riscv64-rootfs
ls /home/martin-zou/workspace/debian-riscv64-rootfs/debootstrap
dash 应为 RISC-V 64 位 ELF,且 /debootstrap 中保留第二阶段脚本。
适用边界
Debian 13 用户空间与教学平台 Linux 5.0 相差多年。debootstrap 能成功不等于最终一定能由 Linux 5.0 完整启动;systemd、glibc 和内核接口兼容性仍需在后续 QEMU 启动中验证。