使用live-build构建自定义Debian ISO时出现错误求助
解决live-build构建Debian ISO时的chroot文件缺失与/usr/bin/env错误
报错信息
执行sudo lb build构建自定义Debian Bullseye amd64 ISO时,出现以下错误:
sudo lb build [2022-07-24 14:38:27] lb build P: live-build 1:20190311 P: Building config tree for a debian/bullseye/amd64 system [2022-07-24 14:38:27] lb bootstrap P: Setting up cleanup function [2022-07-24 14:38:28] lb bootstrap_cache restore P: Restoring bootstrap stage from cache... [2022-07-24 14:38:28] lb bootstrap_debootstrap P: Begin bootstrapping system... W: skipping bootstrap, already done [2022-07-24 14:38:28] lb bootstrap_cache save P: Saving bootstrap stage to cache... W: skipping bootstrap_cache.save, already done [2022-07-24 14:38:28] lb chroot_devpts install P: Begin mounting /dev/pts... [2022-07-24 14:38:28] lb chroot_proc install P: Begin mounting /proc... [2022-07-24 14:38:28] lb chroot_selinuxfs install [2022-07-24 14:38:28] lb chroot_sysfs install P: Begin mounting /sys... [2022-07-24 14:38:28] lb chroot_debianchroot install P: Configuring file /etc/debian_chroot /usr/lib/live/build/chroot_debianchroot: строка 50: chroot/etc/debian_chroot: 没有该文件或目录 P: Begin unmounting filesystems... P: Saving caches... chroot: failed to run command ‘/usr/bin/env’: No such file or directory
问题原因
构建缓存中的bootstrap环境已损坏,导致chroot目录结构不完整,缺少必要的系统文件(如/etc/debian_chroot)和核心二进制工具(如/usr/bin/env)。
解决方案
彻底清理构建缓存与残留文件
执行以下命令清除所有损坏的缓存和临时构建文件:sudo lb clean --purge重新初始化构建配置(可选)
如果之前的配置存在潜在问题,可重新生成默认配置(按需添加自定义参数):lb config --distribution bullseye --architecture amd64重新执行构建
从头启动构建流程,确保生成完整的chroot环境:sudo lb build
注意事项
- 确保构建主机网络连通正常,bootstrap过程需要从Debian官方仓库下载依赖包。
- 构建过程中避免中断命令,防止缓存再次损坏。
- 若使用自定义镜像源,检查
config/archives/*.list中的源地址是否有效,避免因源问题导致bootstrap不完整。
内容的提问来源于stack exchange,提问作者Dima Kmentsynskyi
相关产品推荐
相关产品推荐

