public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v4 3/7] classes-global/package_rpm.bbclass: Remove %pre and %postin for libc6
Date: Tue, 10 Feb 2026 18:54:25 +0800	[thread overview]
Message-ID: <ce6c27ce-4b66-44db-8545-05a539f4e455@windriver.com> (raw)
In-Reply-To: <7f8d134d-0ce5-4643-badc-8820110904cc@windriver.com>



On 2/10/26 18:08, Robert Yang wrote:
> Hi RP,
> 
> On 2/10/26 16:52, Richard Purdie wrote:
>> On Mon, 2026-02-09 at 23:10 -0800, Robert Yang via lists.openembedded.org wrote:
>>> From: Robert Yang <liezhi.yang@windriver.com>
>>>
>>> Fixed:
>>> $ bitbake core-image-full-cmdline:do_testimage
>>> %post(busybox-1.37.0-r0.x86_64_x32): execv(/bin/sh) pid 624
>>> error: failed to exec scriptlet interpreter /bin/sh: No such file or directory
>>>
>>> It is because busybox and libc6 depends on each other, busybox' elf files
>>> depends on libc6, and libc6's postin depends on busybox' /bin/sh, the do_rootfs
>>> works well is because dnf-native has set RPM_NO_CHROOT_FOR_SCRIPTS=1, but it
>>> would be failed for a fresh rootfs.
>>>
>>> In rpm 4.20.1, it let the installed files' Requires win, so it installed
>>> busybox firstly, but in rpm 6.0.1, it let the postin's Requires win since
>>> postin would run immediately after the files are installed, this does make
>>> sense, so it installed busybox (which provides /bin/sh required by libc6'
>>> postin) firstly, then we got the errors. I couldn't find which commit made this
>>> change because a lot of files and functions are refactored during 4.20.1 and
>>> 6.0.0 (not .1), I also tried bisect, but failed because a lot of do_patch or
>>> do_configure/do_compile failures for each build.
>>>
>>> For libc6's the postin is:
>>>
>>>    #!/bin/sh
>>>    if [ x"$D" = "x" ]; then
>>>        if [ -x /sbin/ldconfig ]; then /sbin/ldconfig ; fi
>>>    fi
>>>
>>> This doesn't make sense for lib6 since there is no /bin/sh or ldconfig when
>>> libc6 is not ready yet, so we can just remove libc6's postin to fix the
>>> problem.
>>>
>>> And also remove the workarounds in oeqa/runtime/cases/dnf.py, they are not
>>> needed any more since the circular dependency is fixed.
>>>
>>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>>> ---
>>>   meta/classes-global/package_rpm.bbclass | 6 ++++--
>>>   meta/lib/oeqa/runtime/cases/dnf.py      | 8 --------
>>>   2 files changed, 4 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/ 
>>> package_rpm.bbclass
>>> index f4dd779a52..526ac57982 100644
>>> --- a/meta/classes-global/package_rpm.bbclass
>>> +++ b/meta/classes-global/package_rpm.bbclass
>>> @@ -421,12 +421,14 @@ python write_specfile () {
>>>           spec_preamble_bottom.append('')
>>>           # Now process scriptlets
>>> -        if splitrpreinst:
>>> +        # The libc6 shouldn't have %pre or %post to avoid circular dependency
>>> +        libc6 = '%slibc6' % (d.getVar('MLPREFIX') or '')
>>> +        if splitrpreinst and splitname != libc6:
>>>               spec_scriptlets_bottom.append('%%pre -n %s' % splitname)
>>>               spec_scriptlets_bottom.append('# %s - preinst' % splitname)
>>>               spec_scriptlets_bottom.append(splitrpreinst)
>>>               spec_scriptlets_bottom.append('')
>>> -        if splitrpostinst:
>>> +        if splitrpostinst and splitname != libc6:
>>>               spec_scriptlets_bottom.append('%%post -n %s' % splitname)
>>>               spec_scriptlets_bottom.append('# %s - postinst' % splitname)
>>>               spec_scriptlets_bottom.append(splitrpostinst)
>>
>> I'm not happy about coding a "libc6" reference into the generic package
>> class. It does make me wonder if there is a similar issue with musl for
>> example and we'd end up with a longer hardcoded list.
>>
>> Could/shouldn't we just not add that postinst for libc6? You could for
>> example force the value of pkg_postinst:libc6 during the packaging
>> process and empty the postinst instead.
> 
> I think you meant add the following lines in glibc-package.inc:
> 
> pkg_postinst:glibc () {
>      echo
> }
> 
> We need an "echo" here, otherwise, meta/lib/oe/package.py would add the
> "#!/bin/sh" to the postinst:
> 
>          if needs_ldconfig:
>              bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
>              postinst = d.getVar('pkg_postinst:%s' % pkg)
>              if not postinst:
>                  postinst = '#!/bin/sh\n'
>              postinst += d.getVar('ldconfig_postinst_fragment')
>              d.setVar('pkg_postinst:%s' % pkg, postinst)
> 
> But this still doesn't work, because rpm will add the /bin/sh as the default
> interpreter when not specified. And currently, meta/lib/oe/package.py
> add the ldconfig_postinst_fragment automatically when find so files,
> that the root cause, so how about we add a value like:
> 
> NEEDS_LDCONFIG:<pkg> = "0" or "1"
> 
> Then we can add the following line to glibc-package.inc to skip that.
> NEEDS_LDCONFIG:libc6 = "0"
> 
> And also we need update meta/lib/oe/package.py to check the
> NEEDS_LDCONFIG:pkg.

A easier way should be like this:

lyang1@ala-lpggp3:glibc$ git diff
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 17535ebd6d..f97eae104f 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -1824,7 +1824,8 @@ def process_shlibs(pkgfiles, d):
                      if s[0] not in shlib_provider:
                          shlib_provider[s[0]] = {}
                      shlib_provider[s[0]][s[1]] = (pkg, pkgver)
-        if needs_ldconfig:
+        if needs_ldconfig and \
+                not 
bb.utils.to_boolean(d.getVar('SKIP_LDCONFIG_POSTINST_FRAGMENT:%s' % pkg)):
              bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
              postinst = d.getVar('pkg_postinst:%s' % pkg)
              if not postinst:
diff --git a/meta/recipes-core/glibc/glibc-package.inc 
b/meta/recipes-core/glibc/glibc-package.inc
index 21f2200d19..df0dd6720f 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -293,7 +293,10 @@ pkg_postinst:nscd () {
                 fi
         fi
  }
+
  CONFFILES:nscd = "${sysconfdir}/nscd.conf"
+SKIP_LDCONFIG_POSTINST_FRAGMENT:${PN} = "1"
+do_package[vardeps] += "SKIP_LDCONFIG_POSTINST_FRAGMENT"

  SYSTEMD_PACKAGES = "nscd"
  SYSTEMD_SERVICE:nscd = "nscd.service"


And also set the value for musl.

I will send the updated patches after more testing.


// Robert

> 
>>
>> Also the commit message explains the problem with the postinst but not
>> really why the preinst is a problem? What does that contain which is
>> problematic?
>>
> 
> It is similar to posint, the prinst has a harder situation than postinst.
> 
> // Robert
> 
> 
>> Cheers,
>>
>> Richard
> 



  reply	other threads:[~2026-02-10 10:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10  7:10 [PATCH v4 0/7] rpm: 4.20.1 -> 6.0.1 liezhi.yang
2026-02-10  7:10 ` [PATCH v4 1/7] package_rpm.bbclass: Drop external dependency generator to support rpm 6 liezhi.yang
2026-02-10  7:10 ` [PATCH v4 2/7] package_rpm.bbclass: Define _lib and _libdir for rpmbuild liezhi.yang
2026-02-10  7:10 ` [PATCH v4 3/7] classes-global/package_rpm.bbclass: Remove %pre and %postin for libc6 liezhi.yang
2026-02-10  8:52   ` [OE-core] " Richard Purdie
2026-02-10 10:08     ` Robert Yang
2026-02-10 10:54       ` Robert Yang [this message]
2026-02-10  7:10 ` [PATCH v4 4/7] glib/python3/acl: Add pkgconfig to RDEPENDS liezhi.yang
2026-02-10  7:31   ` Patchtest results for " patchtest
2026-02-10  7:10 ` [PATCH v4 5/7] lib/oe/package.py: Don't redirect stderr liezhi.yang
2026-02-10  7:10 ` [PATCH v4 6/7] target-sdk-provides-dummy: Add pkg-config to DUMMYPROVIDES liezhi.yang
2026-02-10  7:10 ` [PATCH v4 7/7] rpm: 4.20.1 -> 6.0.1 liezhi.yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce6c27ce-4b66-44db-8545-05a539f4e455@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox