Bug 5318

Summary: When installing ipkg and deb postinst script order can be undefined
Product: [Runtime] Package Management Issues Reporter: Mark Hatle <mark.hatle>
Component: ipkg opkgAssignee: Aníbal Limón <anibal.limon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: benjamin.esquivel, kevin.tian, Qi.Chen, sgw
Version: 1.7   
Target Milestone: 1.9 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)
Bug Depends on:    
Bug Blocks: 5319    

Description Mark Hatle 2013-10-04 16:03:38 UTC
The postinst system attempts to capture scripts that can not execute during the cross install phase.  It then configures these to run on the initial system boot.

For ipkg / deb the scripts are determined in the 'save_postinsts' function of their <package>_rootfs.bbclass files.

For ipkg the result of this is very clearly out of order from what is expected and appears to be based primarily on order of the install arguments.

For deb the order does appear to be reconfigured slightly, but it's unclear if my testing just happened to work, or it really does attempt to order the status files based on the install dependencies.  (I found instances in the status file where the dependencies were not ordered.)
Comment 1 Mark Hatle 2013-10-04 16:08:50 UTC
See test case attached to 5319.
Comment 2 Mark Hatle 2015-04-28 18:18:49 UTC
Moved to 1.9.  I'm not the right person to be assigned this however.  Is there someone with more experience with IPK/DEB that might be able to work on this?
Comment 3 Saul Wold 2015-06-03 17:06:19 UTC
Since Anibal is working with DEB packaging he can take the first crack at this and them rebase it over to ipkg also.
Comment 4 Aníbal Limón 2015-06-24 19:43:44 UTC
(In reply to comment #0)
> The postinst system attempts to capture scripts that can not execute during
> the cross install phase.  It then configures these to run on the initial
> system boot.
> 
> For ipkg / deb the scripts are determined in the 'save_postinsts' function
> of their <package>_rootfs.bbclass files.
> 
> For ipkg the result of this is very clearly out of order from what is
> expected and appears to be based primarily on order of the install arguments.
> 
> For deb the order does appear to be reconfigured slightly, but it's unclear
> if my testing just happened to work, or it really does attempt to order the
> status files based on the install dependencies.  (I found instances in the
> status file where the dependencies were not ordered.)

Hi Mark,

Reviewing the current implementation of postinsts there are two ways to do it. 
 
- The dafault are by openembedded script /etc/init.d/run-postinst that refers to the code you mention 'save_postinsts' the function '_get_delayed_postinsts'
don't take into account dependencies for generate execution order. This is the reason for the problem.

- The another is using package-manager dpkg/opkg handling if is added to EXTRA_IMAGE_FEATURES="package-management". Can you test using package managers?

Cheers,
   alimon
Comment 5 Mark Hatle 2015-06-24 20:10:37 UTC
Last time I checked (which was a while back) RPM worked, and ipkg and deb failed.

The issue was that RPM had code that ordered the writing of the deferred install scripts, so that when run later they were executed in the correct order.

ipkg / deb did not order the scripts in any way.. so order could not be determined.

For RPM we capture the order at the time the script is attempted, ipkg and deb defer the scripts that don't work and write them out in the end.