Bug 3223

Summary: Save postinst logs in debug-tweaks mode
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: coreAssignee: Kai Kang <kai.kang>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: Medium CC: liezhi.yang, meta.mr.watcher, meta.watcher, sgw, yi.zhao, zhenfeng.zhao
Version: 1.3   
Target Milestone: 1.4 M6   
Hardware: x86   
OS: Multiple   
Whiteboard: (D6)
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Ross Burton 2012-10-03 19:18:45 UTC
To make it easier to debug postinstall problems, the output of the on-device postinstall scripts should be written to a log file.

(Probably as a debug-tweaks feature)
Comment 1 Ross Burton 2012-10-25 08:33:23 UTC
FWIW, I did this when debugging on-device postinst with ipk:

diff --git a/meta/recipes-devtools/opkg/opkg.inc b/meta/recipes-devtools/opkg/opkg.inc
index 28cc6a6..dd7bfef 100644
--- a/meta/recipes-devtools/opkg/opkg.inc
+++ b/meta/recipes-devtools/opkg/opkg.inc
@@ -57,7 +57,7 @@ if [ "x$D" != "x" ]; then
        install -d $D${sysconfdir}/rcS.d
        # this happens at S98 where our good 'ole packages script used to run
        echo "#!/bin/sh
-opkg-cl configure
+opkg-cl configure 2>&1 >/var/log/postinst.log
 rm -f /${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 " > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
        chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
Comment 2 Kai Kang 2013-03-08 01:55:35 UTC
Patches are merged to Yocto:
9ed59a5d1897354e9d4a6d1179db50c1e04435a3
f9cfc9f37a375c858dcd62c46617b4d2b3401ea2
0276db5e64e2a233c673e55c3ac1fdefe3030f39
Comment 3 Yi Zhao 2013-03-15 02:55:08 UTC
Branch: poky/master
Git rev: 4da406cd50cf02a63ed76810a670aba1eb561c79

For a sato-sdk image, the opkg would also be installed even if the package format is rpm. It will choose the incorrect package management command in S98run-postinsts: 
###############
$ cat /etc/rcS.d/S98run-postinsts
#!/bin/sh
opkg-cl configure >/var/log/postinstall.log 2>&1
rm -f //etc/rcS.d/S98run-postinsts
###############


Reopen it.
Comment 4 Kai Kang 2013-03-15 05:38:26 UTC
Both rpm and opkg are installed in sato-sdk image though PACKAGE_CLASSES is set to package_rpm, file /etc/rcS.d/S98run-postinsts provided by rpm is covered by opkg.
Comment 5 Kai Kang 2013-03-25 07:28:28 UTC
Send patch to fix the overwrite issue.
Comment 6 Kai Kang 2013-04-09 06:29:31 UTC
(In reply to comment #3)
> Branch: poky/master
> Git rev: 4da406cd50cf02a63ed76810a670aba1eb561c79
> 
> For a sato-sdk image, the opkg would also be installed even if the package
> format is rpm. It will choose the incorrect package management command in
> S98run-postinsts: 
> ###############
> $ cat /etc/rcS.d/S98run-postinsts
> #!/bin/sh
> opkg-cl configure >/var/log/postinstall.log 2>&1
> rm -f //etc/rcS.d/S98run-postinsts
> ###############
> 
> 
> Reopen it.

This bug is not caused by implementing this feature, please open a new bug to describe it and close this one.

Thanks.
Comment 7 Yi Zhao 2013-04-09 08:10:04 UTC
As Kai's mention, I open a new bug 4231. This feature has been implemented. Verified it.