Bug 6017

Summary: IMAGE_BASENAME in base image causes causes crash for custom image
Product: [Build System, Metadata & Runtime] Hob Reporter: Omar Pighi <pighi>
Component: hobAssignee: Marius Avram <marius.avram>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: belen.barros.pena, cristiana.voicu, poky.bs.watcher, poky.watcher, valentin.popa
Version: unspecified   
Target Milestone: 1.6   
Hardware: x86   
OS: arm   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Omar Pighi 2014-03-20 14:21:11 UTC
First of all this is my first bug... so I'm sorry if i do it wrong.

I'm tring to use hob to build the images fsl-image-test with nitrogen6x as machine, i added openssh and fsl-gstreamer-full tothe original configuration then what happen:

it hang in several different ways:

1) sometime during buildidng packets phase there is no more "running" task (green with cirle arrows) but nothing more happen.

2) maybe i rerun, building packets suucceeds then pass to the second phase building image, usually it stuck at 99%.
i think it finished its job (the image is actually present in the deploy/images dir), but nothing more happen (I wopuld like to save this modify image as new image)...

in both cases nothing can stop or close it i have to "kill -9" the process by a shell.



Omar
Comment 1 Omar Pighi 2014-03-20 15:03:20 UTC
I have some more info, maybe they can help.
in the shell from i launced HOB, i have several (and continuing coming out) of the following errors:

(bitbake:12689): GLib-GObject-CRITICAL **: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed

(bitbake:12689): GLib-GObject-CRITICAL **: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed

(bitbake:12689): GLib-GObject-CRITICAL **: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed


in one case when HOB hang at the end of the build image process the hob windows became all grey and in the shell i had :

Traceback (most recent call last):
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 1031, in handler_build_succeeded_cb
    self.build_succeeded()
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 987, in build_succeeded
    self.switch_page(self.IMAGE_GENERATED)
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 679, in switch_page
    self.image_details_page.show_page(next_step)
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/imagedetailspage.py", line 312, in show_page
    vallist.append(image_name.split('.')[0])
UnboundLocalError: local variable 'image_name' referenced before assignment


hope this is helpfull.

Thanks
Omar
Comment 2 Marius Avram 2014-03-20 16:34:56 UTC
Do you have the same problem with other images and machines ? 

Did you tried to build on a clean build directory ? It's important to know you don't have this problem because you have done some manual configuration of the configuration file. In case you did please add info with them.
Comment 3 Omar Pighi 2014-03-21 08:43:58 UTC
I tried from a clean directory. no change in the config files (just tried some bitbake from command line).

I have some more info:
no when i launch a build of an image it never hangs until the end. i don't really know the reason, but sometimes it is very very very slow , so it is just matter of wait....
But the errors that i have signaled at the end remain so it stuck with a grey windows (with nothing on) and the errors in the shell:

Traceback (most recent call last):
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 1031, in handler_build_succeeded_cb
    self.build_succeeded()
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 987, in build_succeeded
    self.switch_page(self.IMAGE_GENERATED)
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 679, in switch_page
    self.image_details_page.show_page(next_step)
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/imagedetailspage.py", line 312, in show_page
    vallist.append(image_name.split('.')[0])
UnboundLocalError: local variable 'image_name' referenced before assignment

and at that point no matter how much i wait but nothing happen any more.

by the way could be good to add also the sdcard file as a selection of the format produced.

Omar
Comment 4 Omar Pighi 2014-03-21 09:40:04 UTC
I tried with different machine (sabresd) the same:
it stuck at the end with grey windows and the same error. Now i try with different image
Comment 5 Omar Pighi 2014-03-21 13:31:22 UTC
More results of more tests

the error:
(bitbake:12689): GLib-GObject-CRITICAL **: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed

disappear after updating gtk package.

(now I have updated everything in my opensuse12.3).

but the other error remain, hob stop just at the end of the image generation (ext3 present and fine), but it stuck with a grey window and the reported error in the shell.

Omar
Comment 6 Omar Pighi 2014-03-21 14:09:42 UTC
i tried with a different image "core-image-base" with machine=imx6qsabresd. and it doesn't give the error...
maybe because is smaller then fsl-image-test?
i will try with another image but bigger...

Omar
Comment 7 Omar Pighi 2014-03-25 07:22:08 UTC
I still have the error "UnboundLocalError: local variable 'image_name' referenced before assignment" with some images.... did you find anything?
Comment 8 Marius Avram 2014-03-25 16:38:37 UTC
I tested by building a core-image-minimal using the machine imx6qsabresd and it ended successfully. I will try to build one for nitrogen6x next.

I can't seem to find any machine called simply 'sabresd' in the layer meta-fsl-arm or meta-fsl-arm-extra. I suppose this are the layers you used in your case. I can't find 'fsl-image-test' either. There is an image called 'fsl-image-mfgtool-initramfs' though. Is this the one you used ?

Also what is the latest commit of your local poky git repository ? For example in my case I tested using 41ed4123a687f77a2042cf50d89652639075f869 . Additional information which might prove useful is the latest commit of the local layer clones (e.g. meta-fsl-arm).

Maybe this problem is related only to images defined in the used layers ?

Do you get the crash during the building process for the image ("Building image..." on screen), on the final screen ("Image details" on screen) or when you try to deploy the image ? From what you said until now it seems to be the first, but I need your confirmation.

The GLib-GObject-CRITICAL are not relevant for the bug as they usually do not influence the building process in any way. Also in case there is no error in the terminal the building process is running. You might not see the processing circles because they are not always at the bottom of the list on the "Building packages..." page. And they seem to take forever because some packages take a lot of time to build (depends on your computer specifications). 

From what I notice it seems to be blocked at 99% because it's trying to fetch some kernel code from git://git.freescale.com/imx/linux-2.6-imx.git;branch=master which is big and it works really slow (at least on my connection).
Comment 9 Omar Pighi 2014-03-26 07:50:50 UTC
I'm sorry the MACHINE is imx6qsabresd and also imx6qsabrelite, both do the same error with fsl-image-test (this image is in meta-fsl-demos).
And the problem come out only in some images i'm testing differnet fsl-image-..... (all present in meta-fsl-demos), and all o them has the problem.
Other images such as core-image-.... didn't.
the hang is just at the end of the building image process, infact reading the output in the consolle:

Traceback (most recent call last):
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 1031, in handler_build_succeeded_cb
    self.build_succeeded()
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 987, in build_succeeded
    self.switch_page(self.IMAGE_GENERATED)
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/builder.py", line 679, in switch_page
    self.image_details_page.show_page(next_step)
  File "/home/yocto/IMX6_yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/ui/crumbs/imagedetailspage.py", line 312, in show_page
    vallist.append(image_name.split('.')[0])
UnboundLocalError: local variable 'image_name' referenced before assignment


you can see that the error is at the "building succeeded" phase. -> switch_page-> show_page here there is the problem about image_name...

Today I will add some detailed debug to the show_page in builder.py, to understand what is going wrong... I will be bak to you with some new info (i hope)
Comment 10 Omar Pighi 2014-03-26 17:08:26 UTC
it seems that this is void:

image_names = self.builder.parameters.image_names

in "imagedetailspage.py", in show_page

buth only for those images fsl-image-test ...
Comment 11 Omar Pighi 2014-03-26 17:17:52 UTC
and i void probably because here in the bulider.py (line 980)

in the 

def build_succeeded(self):



...

                for real_image_type in real_types:
                    linkpath = self.parameters.image_addr + '/' + linkname + '.' + real_image_type
                    if os.path.exists(linkpath):
                        self.parameters.image_names.append(os.readlink(linkpath))

...
something is missing so nothing is appended to self.parameters.image_names
Comment 12 Omar Pighi 2014-03-26 17:20:48 UTC
linkpath wrong for some reasons... i will add a print there...
Comment 13 Omar Pighi 2014-03-27 09:57:27 UTC
Ok I find it, when it creates linkpath and check if it exist the linkpath become (as example):

build/tmp/deploy/images/imx6qsabrelite/fsl-image-test-edited-20140327-101110-imx6qsabrelite.ext3

but in that direcotory is not present such file but :
build/tmp/deploy/images/imx6qsabrelite/fsl-image-test-imx6qsabrelite-20140327091107.rootfs.ext3

Instead if i try to build the core-image-base (it end succesfully) the
build/tmp/deploy/images/imx6qsabrelite/core-image-base-edited-20140327-104712-imx6qsabrelite.ext3

exists so everything goes fine.
so it is something misconfigured in the fsl-image-test....
Comment 14 Omar Pighi 2014-03-27 10:40:17 UTC
goin back I can say that in the 

build/tmp/work/imx6qsabrelite-poky-linux-gnueabi/
directory the name for the image is correct:
fsl-image-test-edited-20140327-111710

so the problem come out when the created images are copied to the deploy directory...
Comment 15 Marius Avram 2014-03-27 14:45:25 UTC
I managed to reproduce it so I'll come with a solution as soon as possible.
Comment 16 Omar Pighi 2014-03-27 14:53:50 UTC
I'm working to it me too. if I have news i will report them to you.
thanks
Comment 17 Omar Pighi 2014-03-27 15:37:41 UTC
could be related to:

SDCARD_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3"

present in the imx-base.inc file?
Comment 18 Omar Pighi 2014-03-27 16:02:39 UTC
I think here in builder.py line 980

                for real_image_type in real_types:
                    linkpath = self.parameters.image_addr + '/' + linkname + '.' + real_image_type
                    if os.path.exists(linkpath):
                        self.parameters.image_names.append(os.readlink(linkpath))

the case with ".rootfs." in the name is missing... so it is not appended anithing to image_names.
Comment 19 Marius Avram 2014-04-01 11:00:06 UTC
After investigating the problem it looks like there is a problem when you are trying do a custom image from a image recipe which has the variable IMAGE_BASENAME defined in it, with a different value from the default.

When a custom image is created hob will usually try to create a image name called <original_name>-edited-timestamp-<original_machine>.rootfs.* but IMAGE_BASENAME will usually overload this functionality and will cause this crash. 

I found a solution to this problem by overwriting IMAGE_BASENAME in the custom image recipe to its default value, which is ${PN}. I will send a patch with it and it should be merged soon.

Here is a temporary branch: http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=mavram/B6017&id=be355f41b6a847a2b8b5b014332ac259b0da5b29