Bug 2127

Summary: base-passwd is not being installed early enough during rootfs generation with package_rpm
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Scott Garman <scott.a.garman>
Component: meta-yoctoAssignee: Scott Garman <scott.a.garman>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: andrei, edwin.zhai, mark.hatle, poky.bs.watcher, poky.watcher, sgw
Version: unspecified   
Target Milestone: 1.2 M4   
Hardware: x86   
OS: Multiple   
Whiteboard: (P1) 2012-03-23 Fix in master
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---
Bug Depends on:    
Bug Blocks: 1794    
Attachments:
Description Flags
do_rootfs log none

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. ***