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

Alexander Kanavin <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <CANNYZj_-hX-LCvZmOgzJXhsaX1F9TRJExij5fL9gQu0YAJ4sDw@mail.gmail.com>
Here's an idea. How about adding (or extending) one of the tests in
selftest/cases/overlayfs.py? I see there's plenty of examples there
with /etc mounted that way (there's a whole class for it), and it
might be a simple tweak to check for postinst as well.

Alex

On Fri, 5 Jul 2024 at 09:58, Gassner, Tobias.ext via
lists.yoctoproject.org
<[email protected]> wrote:
>
> 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
>
> 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.
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#13408): https://lists.yoctoproject.org/g/poky/message/13408
> Mute This Topic: https://lists.yoctoproject.org/mt/106869018/1686489
> Group Owner: [email protected]
> Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
> -=-=-=-=-=-=-=-=-=-=-=-
>
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.