Bug 10434

Summary: runqemu can not launch qemu image in Build Appliance
Product: [Build System, Metadata & Runtime] Runtime Reporter: Yi Zhao <yi.zhao>
Component: build-applianceAssignee: Juro Bystricky <juro.bystricky>
Status: VERIFIED FIXED QA Contact: Yi Zhao <yi.zhao>
Severity: normal    
Priority: Medium+ CC: jose.perez.carranza, randy.macleod, ross.burton, yi.zhao
Version: 2.2   
Target Milestone: 2.3 M1   
Hardware: x86   
OS: Multiple   
Whiteboard: Need backport to 2.2.1
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
fixed patch, PATH as intended none

Description Yi Zhao 2016-10-14 05:36:59 UTC
git rev: master/371ab635086e2878ada1f00a59c7ec826481ba0a

Steps:
1. Launch the Build Appliance with vmplayer
2. Build a minimal image for qemux86-64
3. Run "runqemu qemux86-64" to boot up the qemu image

The image can not boot up and the following error occurs:
 
qemux86-64:~/poky/build$ runqemu qemux86-64
runqemu - INFO - Assuming MACHINE = qemux86-64
runqemu - INFO - Running MACHINE=qemux86-64 bitbake -e...
runqemu - INFO - MACHINE: qemux86-64
runqemu - INFO - DEPLOY_DIR_IMAGE: /home/builder/poky/build/tmp/deploy/images/qemux86-64
runqemu - INFO - Running ls -t /home/builder/poky/build/tmp/deploy/images/qemux86-64/*.qemuboot.conf...
runqemu - INFO - CONFFILE: /home/builder/poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20161013112354.qemuboot.conf
runqemu - INFO - Continuing with the following parameters:

KERNEL: [/home/builder/poky/build/tmp/deploy/images/qemux86-64/bzImage]
MACHINE: [qemux86-64]
FSTYPE: [ext4]
ROOTFS: [/home/builder/poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20161013112354.rootfs.ext4]
CONFFILE: [/home/builder/poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20161013112354.qemuboot.conf]

runqemu - ERROR - In order for this script to dynamically infer paths
 kernels or filesystem images, you either need bitbake in your PATH
 or to source oe-init-build-env before running this script.

 Dynamic path inference can be avoided by passing a *.qemuboot.conf to
 runqemu, i.e. `runqemu /path/to/my-image-name.qemuboot.conf`

 runqemu-ifup, runqemu-ifdown or ip not found
qemux86-64:~/poky/build$
Comment 1 Juro Bystricky 2016-10-19 19:55:56 UTC
The problem is /sbin is not in PATH, so "ip" is not found.
"ip" is needed by the runqemu script. You can verify this by:

$ which ip 


Hence the error message: runqemu-ifup, runqemu-ifdown or ip not found

After 

$ export PATH=$PATH:/sbin

it is possible to run qemu, for example:

$ bitbake core-image-minimal
$ runqemu qemux86
Comment 2 Juro Bystricky 2016-10-20 17:44:49 UTC
Patch sent to the mailing list:
http://lists.openembedded.org/pipermail/openembedded-core/2016-October/127842.html
Comment 4 Yi Zhao 2016-10-27 08:42:58 UTC
This issue still exists in 2.2 rc6 build ( git rev: morty/dc8508f609974cc99606b9042bfa7f870ce80228)

And I filed a new bug 10504 for other issue.
Comment 5 Juro Bystricky 2016-10-27 19:58:51 UTC
I believe I found the problem.
Verifying the fix.
Comment 6 Juro Bystricky 2016-10-27 22:08:27 UTC
Created attachment 3509 [details]
fixed patch, PATH as intended
Comment 7 Juro Bystricky 2016-10-27 22:08:43 UTC
The new problem was by the previous "fix": When modifying the PATH variable in .bashrc, double quote characters were used, resulting in expanding the variable $PATH with the value of PATH of the system building the Build Appliance.

The original intent was to enter an un-expanded (literal) $PATH.
In order to that, one must use single quotes instead of double quotes.

Surprisingly, this corrupted PATH still allowed to build an image and run it in qemu within BA, so the problem was not detected early enough. However, the Build Appliance built by Auto Builder had a significantly more complex path so the problem was manifested immediately. 

I attached a new patch I am presently testing.
Comment 8 Juro Bystricky 2016-10-28 22:24:17 UTC
Tested was successful, tested with

local.conf:
MACHINE = "qemux86-64"
$ bitbake build-appliance-image

Ran the resulting image in VirtualBox.
Once in VirtualBox, both terminals were present.
Verified proper PATH was exported.

ran

$ bitbake core-image-sato
$ runqemu qemux86

Correct sato image was built and subsequently displayed in qemu.


patch sent to the mailing list:
http://lists.openembedded.org/pipermail/openembedded-core/2016-October/128140.html
Comment 9 Ross Burton 2016-11-08 17:26:05 UTC
Fixed in oe-core 6238faf901956e2a350315a66ca1ce557deaa513.
Comment 10 Yi Zhao 2016-12-23 01:33:50 UTC
Verified with 2.3 M1 RC1 build
git rev: master/573c646d4cc62dcd0c230381df4940bdf314d495