Bug 9496 - smart fails to install packages which adds groups in core-image-minimal
Summary: smart fails to install packages which adds groups in core-image-minimal
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.1
Hardware: x86 Multiple
: Medium+ major
Target Milestone: 2.2 M1
Assignee: Maxin B. John
QA Contact:
URL:
Whiteboard:
: 9521 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-04-21 08:43 UTC by Maxin B. John
Modified: 2016-06-21 17:01 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: Regression (Used to work)
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxin B. John 2016-04-21 08:43:51 UTC
In core-image-minimal, "smart" package manager fails to install packages which adds groups/users (eg: cronie)


How to recreate the scenario:

# cd poky
# source 

Edit the "local.conf" file and add these lines (just an example for cronie):

MACHINE = "qemux86-64"
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
IMAGE_FEATURES += "package-management"

Build the image:
# bitbake core-image-minimal
# bitbake cronie

Copy the cronie rpm to the image and boot it:

# cd tmp/deploy/images/qemux86-64
# mkdir test
# sudo mount core-image-minimal-qemux86-64.tar.bz2 test

Copy cronie rpm to the media directory, unmount it and boot the image:
# sudo cp {build}/tmp/deploy/rpm/core2_64/cronie-1.5.0-r0.core2_64.rpm test/media
# sudo umount test
# cd {build}
# runqemu qemux86-64 core-image-minimal nographic

After booting the image, install "cronie" with smart package manager:


root@qemux86-64:~# smart install /media/cronie-1.5.0-r0.core2_64.rpm 
Updating cache...                                                                                                                                                        ###################################################################################################################################################################################################################################################### [100%]

Computing transaction...

Installing packages (1):
  cronie-1.5.0-r0@core2_64  

54.7kB of package files are needed. 88.7kB will be used.

Confirm changes? (Y/n): Y

Committing transaction...                                                                                                                                                                                                                                                                                                                                                                                                             
Preparing...                                                                                                                                                             ###################################################################################################################################################################################################################################################### [  0%]
Output from cronie-1.5.0-r0@core2_64:                                          
Running groupadd commands...                                                   
NOTE: cronie: Performing groupadd with [ --system crontab]
ERROR: cronie: groupadd command did not succeed.
error: %pre(cronie-1.5.0-r0.core2_64) scriptlet failed, exit status 1          
error:   install: %pre scriptlet failed (2), skipping cronie-1.5.0-r0.core2_64

Saving cache...
Comment 1 Maxin B. John 2016-04-21 08:48:22 UTC
The reason for this seems to be the difference in behavior of "flock" command present in busybox.

In busybox/util-linux/flock.c, comment says:

 * TODO: in upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'

Due to this, the "rpm preinstall script" which adds the group fails. 

Prepared a patch and sent it to the busybox mailing list:
http://lists.busybox.net/pipermail/busybox/2016-April/084142.html
Comment 2 Maxin B. John 2016-04-21 10:58:00 UTC
IMHO, cronie (for groupadd) and dhcp-server (for useradd) should be included in package manager tests.

Fix sent to oe-core:
http://lists.openembedded.org/pipermail/openembedded-core/2016-April/120489.html
Comment 4 Ross Burton 2016-04-28 14:46:22 UTC
*** Bug 9521 has been marked as a duplicate of this bug. ***
Comment 5 Jose Perez C 2016-06-21 17:00:07 UTC
this is working as expected now 

Validated on : commit 6f0c5537e02c59e1c8f3b08f598dc049ff8ee098

..............................................................................

root@qemux86-64:~# smart install cronie-1.5.0-r0.core2_64.rpm 
Updating cache...                                                                 ################################################################################################################### [100%]

Computing transaction...

Installing packages (1):
  cronie-1.5.0-r0@core2_64     

54.7kB of package files are needed. 88.5kB will be used.

Confirm changes? (Y/n): y

Committing transaction...                                                                                                                                                                                   
Preparing...                                                                      ################################################################################################################### [  0%]
Output from cronie-1.5.0-r0@core2_64:                                          
Running groupadd commands...                                                   
NOTE: cronie: Performing groupadd with [ --system crontab]
   1:Installing cronie                                                            ################################################################################################################### [100%]
Created symlink from /etc/systemd/system/multi-user.target.wants/crond.service to /lib/systemd/system/crond.service.

Saving cache...

..........................................................................
Comment 6 Jose Perez C 2016-06-21 17:01:04 UTC
Verified as per Comment 5