“Ubuntu From Scratch(UFS)”通常指两类情况:
你可以先告诉我:具体报错信息是什么?(终端最后几行最关键)
在不知道错误前,下面是常见原因 + 通用排查办法,基本能解决 80% 的问题。
uname -a
lsb_release -a
df -h
free -h
重点看:
/tmp 或构建目录)报错类似:
E: Unable to locate package xxx
configure: error: xxx not found
解决:
sudo apt update
sudo apt install -y build-essential \
debhelper devscripts fakeroot \
bison flex ncurses-dev
如果是 UFS 项目:
sudo apt build-dep ubuntu-minimal
报错:
Failed to fetch
Connection timed out
解决:
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
或换源:
sudo sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
sudo apt update
报错:
Permission denied
must be root
解决:
sudo -i
不要混用 root 和普通用户构建
报错:
failed to run command ‘/bin/bash’: No such file or directory
mount: permission denied
检查:
mount | grep chroot
ls -l /path/to/rootfs/bin/bash
修复示例:
sudo mount --bind /dev fs/dev
sudo mount --bind /proc fs/proc
sudo chroot fs
这是正常难度问题,不是你的问题
✅ 建议:
sudo debootstrap noble /mnt/ubuntu http://mirrors.tuna.tsinghua.edu.cn/ubuntu
强烈建议别 From Scratch,用:
debootstrap
或
ubuntu-base tarball + chroot
请发:
22.04 / 24.04)我可以直接告诉你哪一步错了、怎么改。