From: Robert Yang <[email protected]>

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 <[email protected]>
---
 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)
diff --git a/meta/lib/oeqa/runtime/cases/dnf.py 
b/meta/lib/oeqa/runtime/cases/dnf.py
index 3ccb18ce83..029651c571 100644
--- a/meta/lib/oeqa/runtime/cases/dnf.py
+++ b/meta/lib/oeqa/runtime/cases/dnf.py
@@ -124,15 +124,8 @@ class DnfRepoTest(DnfTest):
         self.target.run('mkdir -p %s/bin %s/sbin %s/usr/bin %s/usr/sbin' % 
(rootpath, rootpath, rootpath, rootpath), 1500)
         self.target.run('mkdir -p %s/dev' % rootpath, 1500)
         #Handle different architectures lib dirs
-        self.target.run('mkdir -p %s/lib' % rootpath, 1500)
-        self.target.run('mkdir -p %s/libx32' % rootpath, 1500)
-        self.target.run('mkdir -p %s/lib64' % rootpath, 1500)
-        self.target.run('cp /lib/libtinfo.so.5 %s/lib' % rootpath, 1500)
-        self.target.run('cp /libx32/libtinfo.so.5 %s/libx32' % rootpath, 1500)
-        self.target.run('cp /lib64/libtinfo.so.5 %s/lib64' % rootpath, 1500)
         self.target.run('cp -r /etc/rpm %s/etc' % rootpath, 1500)
         self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500)
-        self.target.run('cp /bin/sh %s/bin' % rootpath, 1500)
         self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500)
         self.dnf_with_repo('install --installroot=%s -v -y 
--rpmverbosity=debug busybox' % rootpath)
         status, output = self.target.run('test -e %s/var/cache/dnf' % 
rootpath, 1500)
@@ -156,7 +149,6 @@ class DnfRepoTest(DnfTest):
         self.target.run("for l in /lib*; do mkdir -p %s/usr/$l; ln -s usr/$l 
%s/$l; done" % (rootpath, rootpath))
         self.target.run('cp -r /etc/rpm %s/etc' % rootpath)
         self.target.run('cp -r /etc/dnf %s/etc' % rootpath)
-        self.target.run('cp /bin/busybox %s/bin/sh' % rootpath)
         self.target.run('mount -o bind /dev %s/dev/' % rootpath)
         self.dnf_with_repo('install --installroot=%s -v -y 
--rpmverbosity=debug busybox' % rootpath)
         status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath)
-- 
2.49.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#230855): 
https://lists.openembedded.org/g/openembedded-core/message/230855
Mute This Topic: https://lists.openembedded.org/mt/117734634/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to