Bug 2127 - base-passwd is not being installed early enough during rootfs generation with package_rpm
Summary: base-passwd is not being installed early enough during rootfs generation with...
Status: RESOLVED FIXED
Alias: None
Product: Meta-yocto
Classification: Build System, Metadata & Runtime
Component: meta-yocto (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.2 M4
Assignee: Scott Garman
QA Contact:
URL:
Whiteboard: (P1) 2012-03-23 Fix in master
: 1889 (view as bug list)
Depends on:
Blocks: 1794
  Show dependency tree
 
Reported: 2012-03-15 18:45 UTC by Scott Garman
Modified: 2012-03-29 20:39 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments
do_rootfs log (49.54 KB, text/plain)
2012-03-15 18:47 UTC, Scott Garman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Garman 2012-03-15 18:45:50 UTC
When do_rootfs is run for an image which is built from RPM packages, some of which need to create user accounts, the base-passwd package is not guaranteed to be installed. This causes the postinst scripts to add the user/group accounts to fail, as /etc/passwd and /etc/group do not exist yet.

An easy way to reproduce this bug is to add openssh-sshd to the IMAGE_INSTALL of core-image-minimal and build it. Your do_rootfs log will show useradd errors, and that the openssh-sshd package was installed before base-passwd.
Comment 1 Scott Garman 2012-03-15 18:47:16 UTC
Created attachment 376 [details]
do_rootfs log
Comment 2 Scott Garman 2012-03-15 18:47:33 UTC
Note, this bug does not occur when using the ipk packaging backend.
Comment 3 Andrei Gherzan 2012-03-15 18:51:36 UTC
Reproduced this bug. I will dig into it as much as i can.
Comment 4 Richard Purdie 2012-03-15 21:55:20 UTC
One hacky fix:

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index a6d46d7..5f7877d 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -431,7 +431,11 @@ package_install_internal_rpm () {
 
        fi
 
-       cat ${target_rootfs}/install/install_solution.manifest > ${target_rootfs}/install/total_solution.manifest
+       in=${target_rootfs}/install/install_solution.manifest
+        out=${target_rootfs}/install/total_solution.manifest
+       cat $in | grep /base-passwd-[0-9] > $out
+       cat $in | grep /shadow-[0-9] >> $out
+       cat $in | grep -v /shadow-[0-9] | grep -v /base-passwd-[0-9] >> $out
        cat ${target_rootfs}/install/install_multilib_solution.manifest >> ${target_rootfs}/install/total_solution.manifest
 
        # Construct install scriptlet wrapper
Comment 5 Scott Garman 2012-03-22 21:13:57 UTC
I'm currently testing a variation on Richard's fix for this.
Comment 6 Scott Garman 2012-03-23 16:47:32 UTC
Fixed in oe-core and poky master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=c65d82a88ad8dbd27287e94fb62b98017941fb91
Comment 7 Scott Garman 2012-03-29 20:39:06 UTC
*** Bug 1889 has been marked as a duplicate of this bug. ***