opkg crashes when building one of the meta-qcom initramfs images. Currently it shows only under kas-container builds. DL_DIR=/home/lumag/Projects/OE-downloads/ KAS_TARGET=initramfs-firmware-sm8650-hdk-image kas-container build meta-qcom/ci/mirror.yml:meta-qcom/ci/qcom-armv8a.yml:meta-qcom/ci/qcom-distro.yml:meta-qcom/ci/linux-yocto-dev.yml:meta-qcom/ci/initramfs-test.yml 2025-10-15 22:44:11 - INFO - kas 4.8.2 started 2025-10-15 22:44:11 - INFO - Using /repo as root for repository meta-qcom 2025-10-15 22:44:11 - INFO - Repository oe-core already contains master as commit 2025-10-15 22:44:11 - INFO - Repository bitbake already contains master as commit 2025-10-15 22:44:11 - INFO - Repository meta-yocto already contains master as commit 2025-10-15 22:44:11 - INFO - Repository meta-qcom-distro already contains main as commit 2025-10-15 22:44:11 - INFO - Repository meta-openembedded already contains master as commit 2025-10-15 22:44:11 - INFO - Repository meta-virtualization already contains master as commit 2025-10-15 22:44:11 - INFO - Repository meta-audioreach already contains main as commit 2025-10-15 22:44:11 - INFO - Repository oe-core checked out to 5965ae92c866817a0bab54d240b1d197da37df2a 2025-10-15 22:44:11 - INFO - Repository bitbake checked out to 8b582ef8dd0cef0192d4c0104bcd9b5d642d132c 2025-10-15 22:44:11 - INFO - Repository meta-yocto checked out to fe65e142d0d9ba0e51ff9175ffa82e902f982a20 2025-10-15 22:44:11 - INFO - Repository meta-qcom-distro checked out to 0c7c547bc1066f9f5e145aff9868fd48922d7bf9 2025-10-15 22:44:11 - INFO - Repository meta-openembedded checked out to e1915f54f1db1208152148973e9965570972bbc7 2025-10-15 22:44:11 - INFO - Repository meta-virtualization checked out to 437efd9259c1786c130c724290cb1e46d50edcb2 2025-10-15 22:44:11 - INFO - Repository meta-audioreach checked out to fdb558e149c366fe34334b3e63612d1729e8a3df 2025-10-15 22:44:11 - INFO - /work/build$ /work/bitbake/bin/bitbake -c build initramfs-firmware-sm8650-hdk-image Loading cache: 100% |#########################################################################################################################################| Time: 0:00:01 Loaded 5654 entries from dependency cache. Parsing recipes: 100% |#######################################################################################################################################| Time: 0:00:00 Parsing of 3465 .bb files complete (3461 cached, 4 parsed). 5657 targets, 192 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "2.15.2" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "aarch64-qcom-linux" MACHINE = "qcom-armv8a" DISTRO = "qcom-distro" DISTRO_VERSION = "2.0" TUNE_FEATURES = "aarch64 armv8a crc" TARGET_FPU = "" meta-audioreach = "main:fdb558e149c366fe34334b3e63612d1729e8a3df" meta-filesystems meta-gnome meta-multimedia meta-networking meta-oe meta-python meta-xfce = "master:e1915f54f1db1208152148973e9965570972bbc7" repo = "HEAD:f3df40e147f39d4e159c9368a6fcce3ad15a9a6f" meta-qcom-distro = "main:0c7c547bc1066f9f5e145aff9868fd48922d7bf9" meta-virtualization = "master:437efd9259c1786c130c724290cb1e46d50edcb2" meta-poky = "master:fe65e142d0d9ba0e51ff9175ffa82e902f982a20" meta = "master:5965ae92c866817a0bab54d240b1d197da37df2a" Sstate summary: Wanted 404 Local 398 Mirrors 0 Missed 6 Current 1699 (98% match, 99% complete)################################################## | ETA: 0:00:00 Removing 8 stale sstate objects for arch qcom_armv8a: 100% |##################################################################################################| Time: 0:00:00 NOTE: Executing Tasks ERROR: initramfs-firmware-sm8650-hdk-image-1.0-r0 do_rootfs: Unable to install packages. Command '/work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/opkg.conf -t /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/temp/ipktemp/ -o /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/rootfs --force-postinstall --prefer-arch-to-version install packagegroup-sm8650-hdk-firmware' returned -11: ERROR: Logfile of failure stored in: /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/temp/log.do_rootfs.739 ERROR: Task (/work/build/../../repo/recipes-bsp/images/initramfs-firmware-sm8650-hdk-image.bb:do_rootfs) failed with exit code '1' NOTE: Tasks Summary: Attempted 4592 tasks of which 4589 didn't need to be rerun and 1 failed. NOTE: Build completion summary: NOTE: do_create_spdx: 100.0% sstate reuse(1 setscene, 0 scratch) NOTE: do_create_package_spdx: 100.0% sstate reuse(1 setscene, 0 scratch) NOTE: Writing buildhistory NOTE: Writing buildhistory took: 2 seconds Summary: 1 task failed: /work/build/../../repo/recipes-bsp/images/initramfs-firmware-sm8650-hdk-image.bb:do_rootfs log: /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/temp/log.do_rootfs.739 Summary: There was 1 ERROR message, returning a non-zero exit code. 2025-10-15 22:44:37 - ERROR - Command "/work/bitbake/bin/bitbake -c build initramfs-firmware-sm8650-hdk-image" failed with error 1 Running the command inside the container under valgrind produces the following trace (and makes it work): $ valgrind /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/bin/opkg --volatile- cache -f /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/opkg.conf -t /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm86 50-hdk-image/1.0/temp/ipktemp/ -o /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/rootfs --force-postinstall --prefer-arch-to-version install packagegroup-sm8650-hdk-firmware ==483== Memcheck, a memory error detector ==483== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==483== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==483== Command: /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/opkg.conf -t /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/temp/ipktemp/ -o /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/rootfs --force-postinstall --prefer-arch-to-version install packagegroup-sm8650-hdk-firmware ==483== ==483== Invalid read of size 1 ==483== at 0x4B50D20: stringpool_strn2id (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x4B4A3DB: pool_str2id (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x487936C: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x487A17C: opkg_solver_install (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x4865731: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x4865DB1: opkg_cmd_exec (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x10AA4C: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/bin/opkg) ==483== by 0x48AFF67: (below main) (in /work/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6) ==483== Address 0xe1b5728 is 219,928 bytes inside a block of size 458,752 free'd ==483== at 0x484C82F: realloc (vg_replace_malloc.c:1437) ==483== by 0x4B835FD: solv_realloc (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x4B50C86: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x4B50F26: stringpool_strn2id (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x4B4A3DB: pool_str2id (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x487936C: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x487A17C: opkg_solver_install (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x4865731: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x4865DB1: opkg_cmd_exec (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x10AA4C: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/bin/opkg) ==483== by 0x48AFF67: (below main) (in /work/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6) ==483== Block was alloc'd at ==483== at 0x484C82F: realloc (vg_replace_malloc.c:1437) ==483== by 0x4B835FD: solv_realloc (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x4B50EF4: stringpool_strn2id (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x4B4A3DB: pool_str2id (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libsolv.so.1) ==483== by 0x48783F5: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x4878604: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x487999A: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x487A0C0: opkg_solver_install (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x4865731: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x4865DB1: opkg_cmd_exec (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/lib/libopkg.so.1.0.0) ==483== by 0x10AA4C: ??? (in /work/build/tmp/work/qcom_armv8a-qcom-linux/initramfs-firmware-sm8650-hdk-image/1.0/recipe-sysroot-native/usr/bin/opkg) ==483== by 0x48AFF67: (below main) (in /work/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6) ==483==
I finished the bisect and the issue becomes in https://git.openembedded.org/openembedded-core/commit/?id=9b883aa6f3cf881bfd60442b9ec193ae191b4cbe This includes a big refactor of the linux-firmware. We currently have the opkg 0.7.0 in oe-core but a new 0.9.0 is available. I have updated the opkg to v0.9.0 and the libsolv to the tip but the libsolv.so.1 segment-fault is still there. In the meantime I will send the opkg bump to 0.9.0 to the oe-core list. I will continue the debugging and will do a compaction of the linux-firmware refactor using the buildhistory to see the differences in the packages. Looks like this refactor trigger the memory corruption and I believe it can be something on the RDEPENDS that becomes now a little bigger
Are you thinking there is an issue with the patch (ie I did something wrong), or that the linux-firmware package now has a very large number of dependencies due to all of the sub packages that it is breaking something in opkg?
Are you depending on the full linux-firmware package in your image instead of the proper sub package for the firmware you actually need?
I believe more in your suggestion of the linux-firmware package now has a very large number of dependencies due to all of the sub packages that it is breaking something in opkg?
Disabling the libsolv in opkg fixes the segmentfault so I believe the issue is inside the the libsolv.
Thanks for the bug @dmitry. I've renamed it to reflect the most-probable root cause, per your investigation. I consider this high-priority, since the internal satisfaction solver (ie. not libsolv) is scheduled to be deprecated sometime soon. Do you think we might be able to simply reproduce this error outside of the OE build environment by installing that firmware IPK to an offline root? If that seems likely, could you attach the reproducing IPK to this bug item for whoever takes up a fix?
Disabling the libsolv in opkg fixes the segmentfault but I have now other errors like: "error: opkg_solver_install: Cannot install package" Do you think we might be able to simply reproduce this error outside of the OE build environment by installing that firmware IPK to an offline root? I don't know what you mean by offline root. If that seems likely, could you attach the reproducing IPK to this bug item for whoever takes up a fix? I can attach the IPK that give us the segment fault if that's what you're asking for.
Build opkg without the libsolve fails with errors like: error: calculate_dependencies_for: Cannot satisfy the following dependencies for packagegroup-base-extended: linux-firmware-qcom-qcm6490-audio (>= 1:20251011) linux-firmware-qcom-qcm6490-compute (>= 1:20251011) Removing the versioned RDEPENDS (= 1:${PV})" is not enough to make the opkg happy and I have now new type of errors. I'm seeing that opkg only works with libsolve, without it it always breaks in one way or another. We're really going to have to fix the libsolve and hope it doesn't happen again while we work on the fix.
I'm seeing something very similar with a yocto-based build with a large package list. It looks like a use-after-free in the libsolv solver backend due to a realloc. This patch seemed to resolve it. Using opkg_0.8.0, it didnt seem to be addressed on latest? ---- diff --git a/libopkg/solvers/libsolv/opkg_solver_libsolv.c b/libopkg/solvers/libsolv/opkg_solver_libsolv.c index d152174..56fb8e8 100644 --- a/libopkg/solvers/libsolv/opkg_solver_libsolv.c +++ b/libopkg/solvers/libsolv/opkg_solver_libsolv.c @@ -791,13 +791,16 @@ static void libsolv_solver_add_job(libsolv_solver_t *libsolv_solver, Id what = 0; Id how = 0; + /* pkg_name may point directly into the pool's string space */ + char *name = xstrdup(pkg_name); + if (pkg_version) { what = pool_rel2id(libsolv_solver->pool, - pool_str2id(libsolv_solver->pool, pkg_name, 1), + pool_str2id(libsolv_solver->pool, name, 1), pool_str2id(libsolv_solver->pool, pkg_version, 1), constraint_to_solv_flags(constraint), 1); } else { - what = pool_str2id(libsolv_solver->pool, pkg_name, 1); + what = pool_str2id(libsolv_solver->pool, name, 1); } switch (action) { @@ -809,7 +820,7 @@ static void libsolv_solver_add_job(libsolv_solver_t *libsolv_solver, how = SOLVER_ERASE | SOLVER_SOLVABLE_NAME; break; case JOB_UPGRADE: - if (pkg_name && strcmp(pkg_name, "") != 0) { + if (name && strcmp(name, "") != 0) { how = SOLVER_UPDATE | SOLVER_SOLVABLE_PROVIDES | SOLVER_TARGETED; } else { how = SOLVER_UPDATE | SOLVER_SOLVABLE_REPO; @@ -817,7 +828,7 @@ static void libsolv_solver_add_job(libsolv_solver_t *libsolv_solver, } break; case JOB_DISTUPGRADE: - if (pkg_name && strcmp(pkg_name, "") != 0) { + if (name && strcmp(name, "") != 0) { how = SOLVER_DISTUPGRADE | SOLVER_SOLVABLE_PROVIDES | SOLVER_TARGETED; } else { how = SOLVER_DISTUPGRADE | SOLVER_SOLVABLE_ALL; @@ -840,6 +851,8 @@ static void libsolv_solver_add_job(libsolv_solver_t *libsolv_solver, queue_push2(&libsolv_solver->solver_jobs, SOLVER_FAVOR | SOLVER_SOLVABLE_NAME, what); } + + free(name); } static void libsolv_print_all_problem_rules(libsolv_solver_t *libsolv_solver, Id problem) ----
This should be fixed via https://git.yoctoproject.org/opkg/commit/?id=293e176300a1a52e4aba1ab659dac69248f35760