Bug 12695 - runqemu doesn't work with builddir env setup script as host paths are filtered
Summary: runqemu doesn't work with builddir env setup script as host paths are filtered
Status: CLOSED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: oe-core other (show other bugs)
Version: 2.5
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.4.4
Assignee: Armin Kuster
QA Contact:
URL:
Whiteboard:
: 12784 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-04-18 20:15 UTC by Chin Huat Ang
Modified: 2018-11-05 23:40 UTC (History)
5 users (show)

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


Attachments
qemu launch log file (1.21 KB, text/plain)
2018-06-12 09:08 UTC, pravin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chin Huat Ang 2018-04-18 20:15:04 UTC
When eclipse-yocto plugin is configured to use toolchain from build dir, firing up QEMU using External Tool Configuration no longer works. It appears that runqemu won't work with env setup script in build dir as it does not preserve $PATH like it's SDK counterpart.

This can be reproduce easily by running runqemu after sourcing the build dir env setup script:


  cd $BUILDDIR && sh -c ". tmp/environment-setup-i586-poky-linux; runqemu"


The error message looks like:


runqemu - INFO - Running bitbake -e...
runqemu - INFO - Continuing with the following parameters:

KERNEL: [/home/parallels/git/poky/build/tmp/deploy/images/qemux86/bzImage--4.14.30+git0+f8232ce8e9_1d50ce210b-r0-qemux86-20180413010012.bin]
MACHINE: [qemux86]
FSTYPE: [ext4]
ROOTFS: [/home/parallels/git/poky/build/tmp/deploy/images/qemux86/core-image-sato-qemux86-20180413124506.rootfs.ext4]
CONFFILE: [/home/parallels/git/poky/build/tmp/deploy/images/qemux86/core-image-sato-qemux86-20180413124506.qemuboot.conf]

/bin/sh: 1: stty: not found
Traceback (most recent call last):
  File "/home/parallels/git/poky/scripts/runqemu", line 1291, in main
    config.setup_network()
  File "/home/parallels/git/poky/scripts/runqemu", line 1014, in setup_network
    self.saved_stty = subprocess.check_output("stty -g", shell=True).decode('utf-8')
  File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'stty -g' returned non-zero exit status 127
Cleanup
Comment 3 Chin Huat Ang 2018-04-25 01:05:55 UTC
v2 patch in comment 2 is still incomplete as the PATH variable is missing path to build directory toolchain (STAGING_BINDIR_TOOLCHAIN).

v3 patch submitted: http://lists.openembedded.org/pipermail/openembedded-core/2018-April/150141.html
Comment 5 pravin 2018-06-12 09:08:59 UTC
Created attachment 4325 [details]
qemu launch log file
Comment 6 pravin 2018-06-12 09:26:33 UTC
I am trying to launch qemu using  bitbake meta-ide-support built script.

Release- Yocto 2.4.3.rc2
commit id - 7e7ee662f5dea4d090293045f7498093322802cc 

following are the steps to reproduce the issue

1)take poky clone
2)cd poky and checkout with commit id
3)source oe-init-build-env
4)bitbake meta-ide-support( build for any architecture )
5)download the kernel and rootfs from following link
  https://autobuilder.yocto.io/pub/releases/yocto-2.4.3.rc2/machines/qemu/
 
7)runqemu-extract-sdk image.tar.bz2 rootfs/
8)runqemu vmlinux-qemuppc.bin rootfs core-image-sato-sdk-qemuppc.qemuboot.conf

after this command following logs are comming

runqemu vmlinux-qemuppc.bin rootfs core-image-sato-sdk-qemuppc.qemuboot.conf
runqemu - INFO - Running MACHINE=qemuppc bitbake -e...
runqemu - INFO - Overriding conf file setting of STAGING_DIR_NATIVE to /data/pravinsx/bsp/poky/adt/tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/recipe-sysroot-native from Bitbake environment
runqemu - INFO - Continuing with the following parameters:

KERNEL: [/data/pravinsx/bsp/poky/adt/ppc/vmlinux-qemuppc.bin]
MACHINE: [qemuppc]
FSTYPE: [nfs]
NFS_DIR: [/data/pravinsx/bsp/poky/adt/ppc/rootfs]
CONFFILE: [/data/pravinsx/bsp/poky/adt/ppc/core-image-sato-sdk-qemuppc.qemuboot.conf]

/bin/sh: 1: stty: not found
Traceback (most recent call last):
  File "/data/pravinsx/bsp/poky/scripts/runqemu", line 1270, in main
    config.setup_network()
  File "/data/pravinsx/bsp/poky/scripts/runqemu", line 997, in setup_network
    self.saved_stty = subprocess.check_output("stty -g", shell=True).decode('utf-8')
  File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'stty -g' returned non-zero exit status 127
Cleanup
Comment 7 pravin 2018-06-12 09:27:06 UTC
I have attached logs also
Comment 8 Ross Burton 2018-06-13 16:00:30 UTC
Following the steps in comment 6 I can't replicate this.

"/bin/sh: 1: stty: not found"

Do you just have a system without coreutils present?  That should be in /bin/stty.
Comment 9 Ross Burton 2018-06-14 15:02:30 UTC
*** Bug 12784 has been marked as a duplicate of this bug. ***
Comment 10 Stephen K Jolley 2018-06-14 15:10:41 UTC
Please review the question in comment 8
Comment 11 Ross Burton 2018-06-15 11:11:31 UTC
There's a lot of confusion in this and related bugs.

The original bug is due to the toolchain environment script blasting $PATH and this does appear to be still broken in 2.4.x.

However comment 6 isn't related to the toolchain and this works for me.  pravin, please verify your report and check that you have stty on your machine.
Comment 12 pravin 2018-06-20 02:37:23 UTC
I have checked on my machine.
there is already present stty.
Comment 13 Ross Burton 2018-06-25 15:49:47 UTC
Can you replicate the bug using the *exact* steps that are in comment 6?  Because I certainly can't.
Comment 14 Chin Huat Ang 2018-06-25 22:46:03 UTC
Pravin, can you confirm that the missing Step 6 in comment 6 is sourcing tmp/environment-setup-* for 2.4.x earlier? The issue should be reproducible then.
Comment 15 pravin 2018-06-26 02:09:40 UTC
Yes confirmed, I missed to write step 6. step 6 is source tmp/environment-setup-* for 2.4.x.
After that also issue is reproducible.
 
(In reply to comment #14)
> Pravin, can you confirm that the missing Step 6 in comment 6 is sourcing
> tmp/environment-setup-* for 2.4.x earlier? The issue should be reproducible
> then.
Comment 16 Stephen K Jolley 2018-06-29 15:05:31 UTC
The question appears to have been answered, if not please restate the question.
Comment 17 Jagadeesh Krishnanjanappa 2018-08-17 11:00:50 UTC
Update:

I believe the issue observed by Pravin in comment 6, is same as the issue observed in the beginning of this bug.

Basically, the step 6 which is "source tmp/environment-setup-*" does not export the default binary directories of host machine. Due which "stty" was not found and returned with 127. The fix (http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=sumo&id=d7d6ef7df7e14872dd98883ba3a75c28a1c69947) done for sumo should solve for rocko also, if back ported.

For quick verify:
After step 6, 

export PATH=$PATH:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/local/ferret/bin:/usr/bin:/usr/sbin:/usr/local/bin:/sbin

solve help us to confirm it.


Regards,
Jagadeesh
Comment 18 pravin 2018-08-23 10:03:36 UTC
I have verified on yocto-2.4.3.rc2 rocko branch.

I have applied following patch.
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=sumo&id=d7d6ef7df7e14872dd98883ba3a75c28a1c69947)

now I am able to launch qemu.
Comment 19 Jagadeesh Krishnanjanappa 2018-08-24 01:56:20 UTC
(In reply to comment #18)
> I have verified on yocto-2.4.3.rc2 rocko branch.
> 
> I have applied following patch.
> http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/
> ?h=sumo&id=d7d6ef7df7e14872dd98883ba3a75c28a1c69947)
> 
> now I am able to launch qemu.

Thanks for the confirmation.

Submitted the fix done for sumo to rocko also, at http://lists.openembedded.org/pipermail/openembedded-core/2018-August/154751.html

Regards,
Jagadeesh
Comment 20 Armin Kuster 2018-11-01 15:24:13 UTC
backported to rocko
Comment 22 Armin Kuster 2018-11-05 23:40:46 UTC
closing