Bug 11266

Summary: runqemu: fails when rm_work is active
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Patrick Ohly <patrick.ohly>
Component: Scripts and ToolsAssignee: Chen Qi <Qi.Chen>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: anibal.limon, eduard.bartosh, Qi.Chen, ross.burton, yi.zhao
Version: unspecified   
Target Milestone: 2.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Patrick Ohly 2017-03-29 15:19:30 UTC
To reproduce:
* add INHERIT += "rm_work" to local.conf
* build an image
* "runqemu" for that image

It fails with:

runqemu - INFO - Assuming MACHINE = intel-corei7-64
runqemu - INFO - Running MACHINE=intel-corei7-64 bitbake -e...
runqemu - INFO - MACHINE: intel-corei7-64
runqemu - INFO - DEPLOY_DIR_IMAGE: /fast/build/refkit/intel-corei7-64/tmp-glibc/deploy/images/intel-corei7-64
runqemu - INFO - CONFFILE: /fast/build/refkit/intel-corei7-64/tmp-glibc/deploy/images/intel-corei7-64/refkit-installer-image-intel-corei7-64.qemuboot.conf
runqemu - INFO - Overriding conf file setting of STAGING_DIR_NATIVE to /fast/build/refkit/intel-corei7-64/tmp-glibc/work/corei7-64-refkit-linux/defaultpkgname/1.0-r0/recipe-sysroot-native from Bitbake environment
runqemu - INFO - Overriding conf file setting of STAGING_BINDIR_NATIVE to /fast/build/refkit/intel-corei7-64/tmp-glibc/work/corei7-64-refkit-linux/defaultpkgname/1.0-r0/recipe-sysroot-native/usr/bin from Bitbake environment
runqemu - INFO - Continuing with the following parameters:

MACHINE: [intel-corei7-64]
FSTYPE: [wic]
...
runqemu - INFO - Running /bin/ip link...
runqemu - INFO - Setting up tap interface under sudo
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/Error: Unable to find tunctl binary in '/fast/build/refkit/intel-corei7-64/tmp-glibc/work/corei7-64-refkit-linux/defaultpkgname/1.0-r0/recipe-sysroot-native/usr/bin', please bitbake qemu-helper-native.lock...

It fails because the sysroot dirs of the image get removed by do_rm_work, causing the fallback code to get triggered:

        # If the STAGING_*_NATIVE directories from the config file don't exist
        # and we're in a sourced OE build directory try to extract the paths
        # from `bitbake -e`
        havenative = os.path.exists(self.get('STAGING_DIR_NATIVE')) and \
            os.path.exists(self.get('STAGING_BINDIR_NATIVE'))

        if not havenative:
            <broken code follows>

That entire code section needs to be rewritten, it can no longer work with RSS.

Probably need to do something similar to wic-tools. Instead of installing the qemu tools into the sysroot of each image, install them into the sysroot of a shared recipe (qemu-tools?) and use them from there. Perhaps unify with how the qemu binary itself is handled? Just my 2 cents.
Comment 1 Juro Bystricky 2017-03-31 22:27:11 UTC
*** Bug 11273 has been marked as a duplicate of this bug. ***
Comment 2 Aníbal Limón 2017-04-10 19:37:28 UTC
Chen, are you working on this or i can take it?

Anibal
Comment 3 Ed Bartosh 2017-04-10 21:05:27 UTC
Previously proposed fix was regected http://lists.openembedded.org/pipermail/openembedded-core/2017-April/135450.html

So, I'm proposing new one:
http://lists.openembedded.org/pipermail/openembedded-core/2017-April/135464.html

Probably it's not optimal though as it prevents to remove native sysroots for  any image.

Better ideas are welcome.
Comment 4 Ed Bartosh 2017-04-10 21:08:09 UTC
*** Bug 11193 has been marked as a duplicate of this bug. ***
Comment 5 Ed Bartosh 2017-04-12 20:56:24 UTC
2nd attempt to fix this bug: http://lists.openembedded.org/pipermail/openembedded-core/2017-April/135615.html

This time qemu-helper-native is used to hold qemu-system and tunctl binaries.

Please, review.
Comment 6 Ed Bartosh 2017-04-13 15:19:55 UTC
The fix has been merged into master
Comment 7 Yi Zhao 2017-04-25 05:52:14 UTC
Verified with 2.3 rc2 build
Git rev: master/7a0e795373653886452a7a2992ced10080711c26