Skip to contentSkip to conversation

multilib.bbclass: Filter ROOTFS_RO_UNNEEDED to fix uninstallation

PATCH In review [email protected] 2 participants 3 messages Oct 20, 2025 – Oct 31, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multilib.bbclass: Filter ROOTFS_RO_UNNEEDED to fix uninstallation

From: Mike Crowe <[email protected]>

When building an entire multilib image (e.g. lib32-core-image-minimal) we need to ensure that the unneeded packages in ROOTFS_RO_UNNEEDED get the multilib prefix applied before they are compared against the list of installed packages inside Rootfs._uninstall_unneeded() to decide whether they need to be installed.

Before this change with local.conf containing:

MACHINE = qemuarm64
require conf/multilib.conf
MULTILIBS = "multilib:lib32" DEFAULTTUNE:virtclass-multilib-lib32 = "armv7at-neon" IMAGE_FEATURES = "read-only-rootfs"

running:
bitbake lib32-core-image-minimal
tar tavf tmp/deploy/images/qemuarm64/lib32-core-image-minimal-qemuarm64.rootfs.tar.zst|grep postinst

shows three files:
-rwxr-xr-x 0/0 25 2018-03-09 12:34 ./etc/init.d/run-postinsts
lrwxrwxrwx 0/0 0 2018-03-09 12:34 ./etc/rcS.d/S99run-postinsts -> ../init.d/run-postinsts
-rwxr-xr-x 0/0 2153 2018-03-09 12:34 ./usr/sbin/run-postinsts

whereas with this change there are no matching files.

---
 meta/classes/multilib.bbclass | 1 +
 1 file changed, 1 insertion(+)

Rootfs._uninstall_unneeded can also try to uninstall run-postinsts without using the multilib prefix right at the top. I could fix that with d.expand("${MLPREFIX}run-postinsts") it feels wrong to sully the generic code with something multilib specific. Advice welcome.

meta/classes/multilib.bbclass +1 -0
index 677dbc854a..15056dac4d 100644
@@ -116,6 +116,7 @@ python __anonymous () {
         clsextend = oe.classextend.ClassExtender(variant, prefixes, d)
         clsextend.set_filter("PACKAGE_INSTALL", deps=False)
         clsextend.set_filter("LINGUAS_INSTALL", deps=False)
+        clsextend.set_filter("ROOTFS_RO_UNNEEDED", deps=False)
         clsextend.set_filter("RDEPENDS", deps=True)
         pinstall = d.getVar("LINGUAS_INSTALL") + " " + d.getVar("PACKAGE_INSTALL")
         d.setVar("PACKAGE_INSTALL", pinstall)
Signature · 1 line
2.39.5
#1 lore raw

Hi Mike,

Quoted 9 lines · Mike Crowe via lists.openembedded.org

From: Mike Crowe <[email protected]>

When building an entire multilib image (e.g. lib32-core-image-minimal) we need to ensure that the unneeded packages in ROOTFS_RO_UNNEEDED get the multilib prefix applied before they are compared against the list of installed packages inside Rootfs._uninstall_unneeded() to decide whether they need to be installed.

Would you be able to make a test case in oeqa to verify that this behaviour works as expected in the future, and doesn’t regress?

Thanks,
Ross

#2 lore raw

Hi Ross,

Quoted 9 lines · Ross Burton
Quoted 6 lines · Mike Crowe via lists.openembedded.org
Quoted 5 lines

When building an entire multilib image (e.g. lib32-core-image-minimal) we need to ensure that the unneeded packages in ROOTFS_RO_UNNEEDED get the multilib prefix applied before they are compared against the list of installed packages inside Rootfs._uninstall_unneeded() to decide whether they need to be installed.

Would you be able to make a test case in oeqa to verify that this behaviour works as expected in the future, and doesn’t regress?

I've never written one before and I wasn't sure whether it should fit inside one of the existing case files, but is this the sort of thing you mean?

Subject: [PATCH] oe-selftest: Add test of read-only multilib image

This test confirms that the fix for ROOTFS_RO_UNNEEDED with multilib images in 77c35362fb13c75145f9f999216b3d879ab18b77 don't regress.

meta/lib/oeqa/selftest/cases/multilib.py new file +32 -0
new file mode 100644
index 0000000000..67bfb37967
@@ -0,0 +1,32 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import get_bb_var, bitbake, runCmd
+
+class MultiLib(OESelftestTestCase):
+
+    def test_read_only_multilib_image_lacks_run_postinsts(self):
+        """
+        Check that a read-only multilib image can be built and that image has had
+        ${MLPREFIX}run-postinsts correctly uninstalled.
+        """
+
+        config = """
+MACHINE = "qemuarm64"
+require conf/multilib.conf
+MULTILIBS = "multilib:lib32"
+DEFAULTTUNE:virtclass-multilib-lib32 = "armv7at-neon"
+IMAGE_FEATURES = "read-only-rootfs"
+"""
+        self.write_config(config)
+        bitbake('lib32-core-image-minimal')
+        deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
+        manifest_lines = open(deploy_dir_image + "/lib32-core-image-minimal-qemuarm64.rootfs.manifest").readlines()
+
+        # lib32-run-postinsts should have been uninstalled since
+        # run-postinsts is in ROOTFS_RO_UNNEEDED.
+        self.assertEqual(list(filter(lambda l: "run-postinsts" in l, manifest_lines)), [])

--
2.39.5

Thanks.

Mike.