RaspberryPi 上的 Qemu Debian x86

Qemu Debian x86 on RaspberryPi

我想在 Raspberry Pi 上使用 QEMUchroot 创建 i386 环境。 我正在使用 Raspberry Pi 版本 B,但我想使用哪个版本应该无关紧要。

到目前为止我做了:

apt-get install qemu qemu-user qemu-user-static binfmt-support debootstrap binutils

然后我将 chroot 目录挂载到 /tmp/mnt 和 运行:

sudo debootstrap --foreign --arch i386 buster  ./ http://deb.debian.org/debian/

然后我挂载了:

mount -t sysfs /sys /tmp/mnt/sys/
mount -t proc /proc /tmp/mnt/proc/
mount –bind /dev /tmp/mnt/dev/
mount –bind /dev/pts /tmp/mnt/dev/pts/
mount –bind /dev/shm /tmp/mnt/dev/shm/

现在,当我尝试 运行 debootstrap 的第二阶段时:

sudo chroot ./ ./debootstrap/debootstrap --second-stage

我收到以下错误消息:

W: Failure trying to run:  /sbin/ldconfig
W: See //debootstrap/debootstrap.log for details

我检查了 debootstrap/debootstrap.log:

qemu: uncaught target signal 11 (Segmentation fault) - core dumped 
Segmentation fault

确实,当我尝试 sudo chroot ./ ./sbin/ldconfig 时,我遇到了同样的段错误。 但是当我尝试 sudo chroot ./ ./bin/bash 时它起作用了。

我不确定下一步应该做什么。

我想这与我的 qemu 配置或版本有关(我正在使用 version 2.8.1(Debian 1:2.8+dfsg-6+deb9u4))。我检查了很多关于类似问题的线程,但找不到可以帮助我找到解决方案的线程。

好的,我想我明白了。

当我在 debootstrap 命令中 select stretch 作为 Debian 版本时它工作。

sudo debootstrap --foreign --arch i386 stretch  ./ http://deb.debian.org/debian/

现在仔细想想,还是有道理的。我猜想 运行 i386 chroot 中的 Debian 不提供与主机的完全分离 OS(我安装了 procsys 等)。

我遇到了完全相同的问题 运行 Raspbian Buster;当 chrooting Debian Stretch 时问题消失了。

因此 i386 存储库中的 ldconfig 无法与 buster 上的 qemu-i386-static 模拟器一起使用,但它正在 stretch 上工作!

与主机系统无关....