Bug 12846

Summary: Runqemu MACHINE values need better error reporting
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: pankaj yadav <pankaj-y>
Component: meta-yoctoAssignee: Jagadeesh Krishnanjanappa <jkrishnanjanappa>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: akuster, jkrishnanjanappa, jpuhlman, poky.bs.watcher, poky.watcher, richard.purdie
Version: 2.3.4   
Target Milestone: 2.6   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Patch to exit gracefully if qemu PC system is not evaluated none

Description pankaj yadav 2018-07-09 02:04:46 UTC
Test Case : https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=310

Similar issue is seen with 2.2.4rc1 also and regression is done with 2.2.3rc2.

Logs with 2.2.4rc1:

pankajsx@andromeda02:/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/META_BSP_CREATION_x86$ runqemu qemux86 tmp/deploy/images/myqemux86/bzImage-myqemux86.bin tmp/deploy/images/myqemux86/core-image-sato-myqemux86.ext4 tmp/deploy/images/myqemux86/core-image-sato-myqemux86.qemuboot.conf
runqemu - INFO - Assuming MACHINE = qemux86
runqemu - INFO - Running MACHINE=qemux86 bitbake -e...
runqemu - ERROR - /data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/META_BSP_CREATION_x86/tmp/deploy/images/qemux86 not a directory valid DEPLOY_DIR_IMAGE
runqemu - INFO - CONFFILE: /data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/META_BSP_CREATION_x86/tmp/deploy/images/myqemux86/core-image-sato-myqemux86.qemuboot.conf
runqemu - INFO - Continuing with the following parameters:

KERNEL: [/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/META_BSP_CREATION_x86/tmp/deploy/images/myqemux86/bzImage-myqemux86.bin]
MACHINE: [myqemux86]
FSTYPE: [ext4]
ROOTFS: [/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/META_BSP_CREATION_x86/tmp/deploy/images/myqemux86/core-image-sato-myqemux86.ext4]
CONFFILE: [/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/META_BSP_CREATION_x86/tmp/deploy/images/myqemux86/core-image-sato-myqemux86.qemuboot.conf]

runqemu - INFO - Running /sbin/ip link...
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock...
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock failed: [Errno 13] Permission denied: '/tmp/qemu-tap-locks/tap0.lock'
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap1.lock...
runqemu - INFO - Using preconfigured tap device tap1
runqemu - INFO - If this is not intended, touch /tmp/qemu-tap-locks/tap1.skip to make runqemu skip tap1.
runqemu - INFO - Releasing lockfile for tap device 'tap1'
Traceback (most recent call last):
File "/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/scripts/runqemu", line 1041, in <module>
ret = main()
File "/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/scripts/runqemu", line 1033, in main
config.setup_final()
File "/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/scripts/runqemu", line 920, in setup_final
qemu_system = self.guess_qb_system()
File "/data/pankajsx/BSP_Test/2.2.4rc1/AUTO/poky/scripts/runqemu", line 915, in guess_qb_system
return 'qemu-system-%s' % qbsys
UnboundLocalError: local variable 'qbsys' referenced before assignment

Logs with 2.2.3rc2:

pankajsx@andromeda02:/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/x86$ runqemu qemux86 tmp/deploy/images/myqemux86/bzImage-myqemux86.bin tmp/deploy/images/myqemux86/core-image-sato-myqemux86.ext4
runqemu - INFO - Assuming MACHINE = qemux86
runqemu - INFO - Running MACHINE=qemux86 bitbake -e...
runqemu - ERROR - /data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/x86/tmp/deploy/images/qemux86 not a directory valid DEPLOY_DIR_IMAGE
runqemu - INFO - CONFFILE: /data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/x86/tmp/deploy/images/myqemux86/core-image-sato-myqemux86.qemuboot.conf
runqemu - INFO - Continuing with the following parameters:

KERNEL: [/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/x86/tmp/deploy/images/myqemux86/bzImage-myqemux86.bin]
MACHINE: [myqemux86]
FSTYPE: [ext4]
ROOTFS: [/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/x86/tmp/deploy/images/myqemux86/core-image-sato-myqemux86.ext4]
CONFFILE: [/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/x86/tmp/deploy/images/myqemux86/core-image-sato-myqemux86.qemuboot.conf]

runqemu - INFO - Running /sbin/ip link...
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock...
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock failed: [Errno 13] Permission denied: '/tmp/qemu-tap-locks/tap0.lock'
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap1.lock...
runqemu - INFO - Using preconfigured tap device tap1
runqemu - INFO - If this is not intended, touch /tmp/qemu-tap-locks/tap1.skip to make runqemu skip tap1.
runqemu - INFO - Releasing lockfile for tap device 'tap1'
Traceback (most recent call last):
File "/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/scripts/runqemu", line 1041, in <module>
ret = main()
File "/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/scripts/runqemu", line 1033, in main
config.setup_final()
File "/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/scripts/runqemu", line 920, in setup_final
qemu_system = self.guess_qb_system()
File "/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/scripts/runqemu", line 915, in guess_qb_system
return 'qemu-system-%s' % qbsys
UnboundLocalError: local variable 'qbsys' referenced before assignment
pankajsx@andromeda02:/data/pankajsx/BSP_Test/2.2.3rc2_META_YOCTO_REGRESSION/poky/x86$


Logs for 2.3.4rc1 :

pankajsx@andromeda02:/data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/build$ runqemu myqemux86
runqemu - INFO - Assuming MACHINE = myqemux86
runqemu - INFO - Running MACHINE=myqemux86 bitbake -e...
runqemu - INFO - MACHINE: myqemux86
runqemu - INFO - DEPLOY_DIR_IMAGE: /data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/build/tmp/deploy/images/myqemux86
runqemu - INFO - Running ls -t /data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/build/tmp/deploy/images/myqemux86/*.qemuboot.conf...
runqemu - INFO - CONFFILE: /data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/build/tmp/deploy/images/myqemux86/core-image-minimal-myqemux86-20180614055140.qemuboot.conf
runqemu - INFO - Continuing with the following parameters:

KERNEL: [tmp/deploy/images/myqemux86/bzImage--4.10.17+git0+1d9a820018_c1d8c4408b-r0.1-myqemux86-20180614055140.bin]
MACHINE: [myqemux86]
FSTYPE: [ext4]
ROOTFS: [tmp/deploy/images/myqemux86/core-image-minimal-myqemux86-20180614055140.rootfs.ext4]
CONFFILE: [/data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/build/tmp/deploy/images/myqemux86/core-image-minimal-myqemux86-20180614055140.qemuboot.conf]

runqemu - INFO - Running /sbin/ip link...
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock...
runqemu - INFO - Using preconfigured tap device tap0
runqemu - INFO - If this is not intended, touch /tmp/qemu-tap-locks/tap0.skip to make runqemu skip tap0.
runqemu - INFO - Network configuration: 192.168.7.2::192.168.7.1:255.255.255.0
runqemu - INFO - Releasing lockfile for tap device 'tap0'
Traceback (most recent call last):
File "/data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/scripts/runqemu", line 1243, in <module>
ret = main()
File "/data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/scripts/runqemu", line 1235, in main
config.setup_final()
File "/data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/scripts/runqemu", line 1063, in setup_final
qemu_system = self.guess_qb_system()
File "/data/pankajsx/BSP_Test/2.3.4rc1/x86/poky/scripts/runqemu", line 1058, in guess_qb_system
return 'qemu-system-%s' % qbsys
UnboundLocalError: local variable 'qbsys' referenced before assignment
Comment 1 pankaj yadav 2018-07-09 03:18:22 UTC
Steps to reproduce | Test Case 310:
1. git clone the poky source and setup the build environment
2. follow the instruments on https://wiki.yoctoproject.org/wiki/Transcript:_Using_the_Yocto_BSP_tools_to_create_a_qemu_BSP, create a new qemu Yocot BSP based on i386, with command like :yocto-bsp create myqemux86 qemu, yocto-bsp will ask user to set value for each of the unspecified property, select default option for all of then
3. after the new bsp is created, add the new BSP layer to BBLAYERS in bblayers.conf.
4. Edit local.conf set MACHINE to your new machine "myqemux86".
5. Then run "bitbake core-image-minimal" and boot the image after build is finished


Steps to reproduce | Test Case 309:
Step 1 : Create test.json in below mentioned format :
{"kernel_choice":"linux-yocto_4.10","use_default_kernel":"n","keyboard":"y","qemuarch":"i386","smp":"y","touchscreen":"n","need_new_kbranch":"y","new_kbranch":"standard/common-pc/base"}
Step 2 : run below mentioned command 
"yocto-bsp create myqemux86 qemu -o meta-myqemux86 -i test.json"
Step 3 : Add myqemyx86 in local.conf
Step 4 : add myqemux86 layer in bblayer.conf 
Step 5 : run "bitbake core-image-minimal"
Step 6 : boot the image using "runqemu myqemux86"

Please follow the instruction on wikipedia for detail :  https://wiki.yoctoproject.org/wiki/Transcript:_Using_the_Yocto_BSP_tools_to_create_a_qemu_BSP, 

Please find the logs for the same :

pankajsx@andromeda02:/data/pankajsx/BSP_Test/2.3.4rc1/json/poky/build$ runqemu myqemux86
runqemu - INFO - Assuming MACHINE = myqemux86
runqemu - INFO - Running MACHINE=myqemux86 bitbake -e...
runqemu - INFO - MACHINE: myqemux86
runqemu - INFO - DEPLOY_DIR_IMAGE: /data/pankajsx/BSP_Test/2.3.4rc1/json/poky/build/tmp/deploy/images/myqemux86
runqemu - INFO - Running ls -t /data/pankajsx/BSP_Test/2.3.4rc1/json/poky/build/tmp/deploy/images/myqemux86/*.qemuboot.conf...
runqemu - INFO - CONFFILE: /data/pankajsx/BSP_Test/2.3.4rc1/json/poky/build/tmp/deploy/images/myqemux86/core-image-minimal-myqemux86-20180614060308.qemuboot.conf
runqemu - INFO - Continuing with the following parameters:

KERNEL: [tmp/deploy/images/myqemux86/bzImage--4.10.17+git0+1d9a820018_c1d8c4408b-r0.1-myqemux86-20180614060308.bin]
MACHINE: [myqemux86]
FSTYPE: [ext4]
ROOTFS: [tmp/deploy/images/myqemux86/core-image-minimal-myqemux86-20180614060308.rootfs.ext4]
CONFFILE: [/data/pankajsx/BSP_Test/2.3.4rc1/json/poky/build/tmp/deploy/images/myqemux86/core-image-minimal-myqemux86-20180614060308.qemuboot.conf]

runqemu - INFO - Running /sbin/ip link...
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock...
runqemu - INFO - Using preconfigured tap device tap0
runqemu - INFO - If this is not intended, touch /tmp/qemu-tap-locks/tap0.skip to make runqemu skip tap0.
runqemu - INFO - Network configuration: 192.168.7.2::192.168.7.1:255.255.255.0
runqemu - INFO - Releasing lockfile for tap device 'tap0'
Traceback (most recent call last):
File "/data/pankajsx/BSP_Test/2.3.4rc1/json/poky/scripts/runqemu", line 1243, in <module>
ret = main()
File "/data/pankajsx/BSP_Test/2.3.4rc1/json/poky/scripts/runqemu", line 1235, in main
config.setup_final()
File "/data/pankajsx/BSP_Test/2.3.4rc1/json/poky/scripts/runqemu", line 1063, in setup_final
qemu_system = self.guess_qb_system()
File "/data/pankajsx/BSP_Test/2.3.4rc1/json/poky/scripts/runqemu", line 1058, in guess_qb_system
return 'qemu-system-%s' % qbsys
UnboundLocalError: local variable 'qbsys' referenced before assignment
pankajsx@andromeda02:/data/pankajsx/BSP_Test/2.3.4rc1/json/poky/build$
Comment 2 Armin Kuster 2018-07-10 23:27:03 UTC
this should fail in master too. the issue is the MACHINE does not have its own qemu-system build.
Comment 3 Armin Kuster 2018-07-10 23:27:49 UTC
we should have more graceful error and not continue.
Comment 4 Richard Purdie 2018-07-12 14:46:27 UTC
yocto-bsp has been removed however this bug is left open to fix the runqemu script to give better error reporting for MACHINE values it doesn't understand.
Comment 5 Jagadeesh Krishnanjanappa 2018-08-09 06:58:16 UTC
Though I could not reproduce the mentioned errors on rocko or with master branches. The QEMU PC System emulator gets picked correctly via qb_system_name in
.*qemuboot.conf, which will be set to "qemu-system-i386" for the above example.

The below patch might help it to exit gracefully.
-- snip --
diff --git a/scripts/runqemu b/scripts/runqemu
index f52b9a8..409d17c 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1118,6 +1118,11 @@ class BaseConfig(object):
             qbsys = 'riscv64'
         elif mach == 'qemuriscv32':
             qbsys = 'riscv32'
+        else:
+            logger.error("Unable to determine QEMU PC System emulator for %s machine." % mach)
+            logger.error("As %s is not among valid QEMU machines such as," % mach)
+            logger.error("qemux86-64, qemux86, qemuarm64, qemuarm, qemumips64, qemumips64el, qemumipsel, qemumips, qemupp
+            raise RunQemuError("Set qb_system_name with suitable QEMU PC System emulator in .*qemuboot.conf.")
 
         return 'qemu-system-%s' % qbsys
 
-- snip --


Regards,
Jagadeesh
Comment 6 Jagadeesh Krishnanjanappa 2018-08-09 07:10:40 UTC
Created attachment 4357 [details]
Patch to exit gracefully if qemu PC system is not evaluated

The changes in https://bugzilla.yoctoproject.org/show_bug.cgi?id=12846#c5 has incorrect patch format. Hence attaching the patch in required format.

Regards,
Jagadeesh
Comment 7 Armin Kuster 2018-08-09 16:12:01 UTC
(In reply to comment #6)
> Created attachment 4357 [details]
> Patch to exit gracefully if qemu PC system is not evaluated
> 
> The changes in https://bugzilla.yoctoproject.org/show_bug.cgi?id=12846#c5
> has incorrect patch format. Hence attaching the patch in required format.
> 
> Regards,
> Jagadeesh

Thanks Jagadeesh,

Do you mind taking this bug and sending the patch to the mailing list ?
Comment 8 Jagadeesh Krishnanjanappa 2018-08-09 16:18:52 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Created attachment 4357 [details]
> > Patch to exit gracefully if qemu PC system is not evaluated
> > 
> > The changes in https://bugzilla.yoctoproject.org/show_bug.cgi?id=12846#c5
> > has incorrect patch format. Hence attaching the patch in required format.
> > 
> > Regards,
> > Jagadeesh
> 
> Thanks Jagadeesh,
> 
> Do you mind taking this bug and sending the patch to the mailing list ?

Sure. Submitted to mailing list.

Regards,
Jagadeesh
Comment 9 Jagadeesh Krishnanjanappa 2018-08-14 01:43:28 UTC
Patch submitted to oe-core mailing list at http://lists.openembedded.org/pipermail/openembedded-core/2018-August/154086.html

Regards,
Jagadeesh
Comment 10 Jagadeesh Krishnanjanappa 2018-08-16 06:32:52 UTC
Patch is merged into master at http://cgit.openembedded.org/openembedded-core/commit/?id=519273f54c0b8a6fff36afeb7646d8e37717be22

Regards,
Jagadeesh