armbian / build

Armbian Linux build framework generates custom Debian or Ubuntu image for x86, aarch64, riscv64 & armhf
https://www.armbian.com
GNU General Public License v2.0
4.24k stars 2.31k forks source link

image-helpers.sh segfault #3519

Closed sej7278 closed 2 years ago

sej7278 commented 2 years ago

Using these flags I built for orangepi r1+ lts.....

./compile.sh  BOARD=orangepi-r1plus-lts BRANCH=current RELEASE=bullseye \
    BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no \
    COMPRESS_OUTPUTIMAGE=sha,gpg,img

Whilst it resulted in an image at the end, there's a disturbing segfault that i can reproduce 100%

[ .... ] Installing [ armbian-bsp-cli-orangepi-r1plus-lts_22.05.0-trunk_arm64.deb ]
/home/simon/build/lib/image-helpers.sh: line 204: 571258 Segmentation fault      (core dumped) chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq $apt_extra --no-install-recommends install $name" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
[ error ] ERROR in function install_deb_chroot [ main.sh:589 -> main.sh:550 -> debootstrap.sh:69 -> distributions.sh:334 -> image-helpers.sh:225 -> general.sh:0 ]
[ error ] Installation of /root/armbian-bsp-cli-orangepi-r1plus-lts_22.05.0-trunk_arm64.deb failed [ orangepi-r1plus-lts bullseye no rockchip64 ]
[ o.k. ] Process terminated 
[ .... ] Installing [ armbian-firmware_22.05.0-trunk_all.deb ]

i'm running this from within qemu-kvm, so wondered if it was something to do with running qemu aarch64 inside qemu x86_64?

building the kernel/uboot alone seems to work.

even tried upgrading the vm to 21.10 and i get the exact same error on a fresh git clone.

igorpecovnik commented 2 years ago

Try to use Docker.

/compile.sh docker BOARD=orangepi-r1plus-lts ...

sej7278 commented 2 years ago

i'll try, but not keen on installing docker on this box.

i managed to build the minimal image ok just now

igorpecovnik commented 2 years ago

I think its one of the qemu bugs ... If you need bullseye/sid or Jammy, you need x64 Ubuntu Hirsute host. Or if you build natively on arm64.

sej7278 commented 2 years ago

exactly the same error on a debian bullseye vm, lets see where docker gets me.

nope same error in Docker, so its very doubtful a qemu bug (especially as kernel, uboot and minimal build fine) its something to do with install_deb_chroot()

igorpecovnik commented 2 years ago

exactly the same error on a debian bullseye vm

Officially supported environment is only Ubuntu Hirsute. Others might work or not. Docker must, since it uses Hirsute and whole our CI system is based on that image. And we just successfully built hundreds of images with it and there was not code change after that.

its something to do with

Possible, but to debug that, check logs (output/debug/). Installation is done within QEMU so I would not rule that out yet. Especially if deb install seg faults.

sej7278 commented 2 years ago

I might try building a different board as I noticed the r1+ only got a Sid build not bullseye on the website

sej7278 commented 2 years ago

i managed to build for bananpi on my hirsute vm (no docker):

./compile.sh BOARD=bananapi BRANCH=current RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img

so maybe the problem is orangepi specific

sej7278 commented 2 years ago

ah now this is interesting, i managed to build a nanopi-r2s which is basically the same board:

./compile.sh BOARD=nanopi-r2s BRANCH=current RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img

tinkerboard works too (another rockchip):

./compile.sh BOARD=tinkerboard BRANCH=current RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=prebuilt COMPRESS_OUTPUTIMAGE=sha,gpg,img

igorpecovnik commented 2 years ago

Indeed its something wrong but it looks like with bullseye only. Nothing we can do about that - on a short notice I can't see what could be causing this. Use other release (this is one reason we have them all) - buster works, focal works, ... others i didn't try.

sej7278 commented 2 years ago

i noticed the website has Sid+5.16, how do i select that, in compile.sh there doesn't seem to be an option?

i wonder is the build infra smart enough to notice the error - as it ends up with a built img file, but i assume it doesn't work with a broken BSP package. does the 22.05 sid image work? (i'll try it when my LTS arrives). in the meantime 21.08.8 works fine on my non-LTS.

p.s. this works too:

./compile.sh BOARD=nanopi-r4s BRANCH=current RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=prebuilt COMPRESS_OUTPUTIMAGE=sha,gpg,img

igorpecovnik commented 2 years ago

i noticed the website has Sid, how do i select that, in compile.sh there doesn't seem to be an option?

Hidden out by purpose

i wonder is the build infra smart enough to notice the error

Current build infra has some issues regarding error detection, so this can't be ruled out ... but we fixed version, which is not yet on user level, will be merged probably in a couple of weeks.

sej7278 commented 2 years ago

ok got it now thanks, going to try this:

./compile.sh BOARD=orangepi-r1plus-lts BRANCH=edge RELEASE=sid BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img

and that works! so seems its a bullseye problem specific to the r1+ full image.

so if you want bullseye you stick to 21.08 but it won't work on the LTS version.

this works too, so its not the kernel, its bullseye:

./compile.sh BOARD=orangepi-r1plus-lts BRANCH=current RELEASE=sid BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img

sej7278 commented 2 years ago

i'm really confused now, as this works:

./compile.sh BOARD=orangepi-r1plus-lts BRANCH=edge RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img

so its the combination of a full bullseye and the 5.15 kernel that seems to be the problem?! that's gibberish.

what's in the non-minimal build that conflicts with the 5.15 kernel?

i'm going to try again with a fresh checkout to verify. if it works i'm happy enough with that - bullseye+latest kernel is better than sid.

edit: yup it worked, only took 24mins too which is weird as it was taking an hour before. i'm not using ccache or anything.

i wonder if its because i did a full clone, not --depth 1

sej7278 commented 2 years ago

ok i'm closing this as i can now build bullseye with the current kernel no problem, i can only assume it was the --depth 1 checkout was missing some key files, or maybe something wasn't downloading properly as builds are repeatedly taking 24mins not an hour now.

this works: ./compile.sh BOARD=orangepi-r1plus-lts BRANCH=current RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img