Re: execute pkg_postinst_ontarget when read-only-rootfs-delayed-postinsts is set for a read only rootfs

"Gassner, Tobias.ext" <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <[email protected]>
I digged a bit into the hanging issue by starting-up poky outside the test environment, but with the same configuration (rpm, no systemd, read-only-rootfs and read-only-rootfs-delayed-postinsts set, plus my first patch). After the kernel boot log messages I get the following (for testing purposes I use opkg-keyrings , as it provides a pkg_postinst_ontarget task) :

Configuring packages on first boot....
(This may take several minutes. Please do not power off the machine.)
Running postinst /etc/rpm-postinsts/100-opkg-keyrings...
rm: remove '/etc/rpm-postinsts/100-opkg-keyrings'?

Since I have to type 'yes' into the console and press enter to continue the test execution hangs on that line.

The behavior (and hence the log messages) at that point are determined by the following script: https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts

( https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts ) When I apply the following patch

From c144a7dcad403f41dd33b4429fe6481188512bb0 Mon Sep 17 00:00:00 2001
From: "Gassner, Tobias.ext" <[email protected]>
Date: Fri, 5 Jul 2024 09:51:25 +0200
Subject: [PATCH] adding force to remove postinst on target script

Signed-off-by: Gassner, Tobias.ext <[email protected]>
---
meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index 1f3e692029..7f197bf89b 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -68,7 +68,7 @@ exec_postinst_scriptlets() {
[ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." $append_log
if [ -x $i ]; then
(sh -c $i $append_log)
-            rm $i
+            rm -f $i
else
echo "ERROR: postinst $i failed."
[ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
--
2.45.2

I get the following output, and the test executes without hanging for rpm:

Configuring packages on first boot....
(This may take several minutes. Please do not power off the machine.)
Running postinst /etc/rpm-postinsts/100-opkg-keyrings...
rm: can't remove '/etc/rpm-postinsts/100-opkg-keyrings': Read-only file system
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
Removing any system startup links for run-postinsts ...
/etc/rcS.d/S99run-postinsts
rm: can't remove '/etc/rcS.d/S99run-postinsts': Read-only file system

Note: Since overlayFS is not configured for this test, the postinst ontarget script file cannot be removed, but this is expected. This specific test does not rely on the fact that the file can be removed so the test passes.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.