RPi-Distro / pi-gen

Tool used to create the official Raspberry Pi OS images
BSD 3-Clause "New" or "Revised" License
2.58k stars 1.61k forks source link

Error: qemu: uncaught target signal 11, Segmentation fault #656

Open alexander-sony opened 1 year ago

alexander-sony commented 1 year ago

In order to bring down image build times, I am trying to build arm64 images using vagrant and Debian 10 i386 running on an Ubuntu 20 x86_64 host. However, it fails with... Observe that binfmt_misc is loaded.

...
I: Extracting liblzma5...
I: Extracting zlib1g...
W: Failure trying to run: chroot "/home/vagrant/pi-gen/work/bullseye-arm64/stage0/rootfs" /sbin/ldconfig
W: See /home/vagrant/pi-gen/work/bullseye-arm64/stage0/rootfs/debootstrap/debootstrap.log for details
rmdir: failed to remove '/home/vagrant/pi-gen/work/bullseye-arm64/stage0/rootfs/debootstrap': Directory not empty
[14:42:01] bootstrap failed: please check /home/vagrant/pi-gen/work/bullseye-arm64/stage0/debootstrap.log

vagrant@debian10:~/pi-gen$ tail -3 work/bullseye-arm64/stage0/debootstrap.log
2022-12-07 14:41:58 URL:http://deb.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.11.dfsg-2+deb11u2_arm64.deb [88168/88168] -> "/home/vagrant/pi-gen/work/bullseye-arm64/stage0/rootfs//var/cache/apt/archives/partial/zlib1g_1%3a1.2.11.dfsg-2+deb11u2_arm64.deb" [1]
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

vagrant@debian10:~/pi-gen$ lsmod | grep fmt
binfmt_misc            20480  1

Reproduce:

host$ lsb_release -ds
Ubuntu 20.04.5 LTS
host$ uname -sri
Linux 5.14.0-1054-oem x86_64
host$ vboxmanage --help | head -1
Oracle VM VirtualBox Command Line Management Interface Version 6.1.40
host$ vagrant --version
Vagrant 2.3.3
host$ vagrant init generic-x32/debian10
host$ vagrant up
host$ vagrant ssh
vagrant@debian10:~$ git clone https://github.com/RPi-Distro/pi-gen.git && cd pi-gen
vagrant@debian10:~$ git checkout arm64
vagrant@debian10:~$ sudo apt install -y quilt parted qemu-user-static debootstrap zerofree zip dosfstools libarchive-tools bc qemu-utils kpartx pigz
vagrant@debian10:~$ touch ./stage2/SKIP_NOOBS; \
touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP; \
touch ./stage4/SKIP_IMAGES ./stage5/SKIP_IMAGES;
vagrant@debian10:~$ sudo IMG_NAME=bullseye-arm64 ENABLE_SSH=1 ./build.sh
...
I: Extracting liblzma5...
I: Extracting zlib1g...
W: Failure trying to run: chroot "/home/vagrant/pi-gen/work/bullseye-arm64/stage0/rootfs" /sbin/ldconfig
W: See /home/vagrant/pi-gen/work/bullseye-arm64/stage0/rootfs/debootstrap/debootstrap.log for details
rmdir: failed to remove '/home/vagrant/pi-gen/work/bullseye-arm64/stage0/rootfs/debootstrap': Directory not empty
[14:42:01] bootstrap failed: please check /home/vagrant/pi-gen/work/bullseye-arm64/stage0/debootstrap.log
XECDesign commented 1 year ago

Could you try a bullseye VM? I think the issue is that buster has a buggy version of qemu.