<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8335</bug_id>
          
          <creation_ts>2015-09-20 19:34:30 +0000</creation_ts>
          <short_desc>Image generation fails with an exception in image.py</short_desc>
          <delta_ts>2015-09-24 16:27:15 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>arm</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>1.4.5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jin">jin</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>54310</commentid>
    <comment_count>0</comment_count>
      <attachid>2746</attachid>
    <who name="Jin">jin</who>
    <bug_when>2015-09-20 19:34:30 +0000</bug_when>
    <thetext>Created attachment 2746
This patch fixes the problem described in the ticket.

An image that I am trying to build fails with the following error:

The stack trace of python calls that resulted in this exception/failure was:
File: &apos;do_rootfs&apos;, lineno: 17, function: &lt;module&gt;
     0013:    # generate final images
     0014:    create_image(d)
     0015:
     0016:
 *** 0017:do_rootfs(d)
     0018:
File: &apos;do_rootfs&apos;, lineno: 14, function: do_rootfs
     0010:    # generate rootfs
     0011:    create_rootfs(d)
     0012:
     0013:    # generate final images
 *** 0014:    create_image(d)
     0015:
     0016:
     0017:do_rootfs(d)
     0018:
File: &apos;/poky/meta/lib/oe/image.py&apos;, lineno: 380, function: create_image
     0376:        execute_pre_post_process(self.d, post_process_cmds)
     0377:
     0378:
     0379:def create_image(d):
 *** 0380:    Image(d).create()
     0381:
     0382:if __name__ == &quot;__main__&quot;:
     0383:    &quot;&quot;&quot;
     0384:    Image creation can be called independent from bitbake environment.
File: &apos;/poky/meta/lib/oe/image.py&apos;, lineno: 374, function: create
     0370:                    bb.fatal(result)
     0371:
     0372:            for image_type, subimages, script in image_cmds:
     0373:                bb.note(&quot;Creating symlinks for %s image ...&quot; % image_type)
 *** 0374:                self._create_symlinks(subimages)
     0375:
     0376:        execute_pre_post_process(self.d, post_process_cmds)
     0377:
     0378:
File: &apos;/poky/meta/lib/oe/image.py&apos;, lineno: 205, function: _create_symlinks
     0201:                if os.path.exists(img_name + &quot;.rootfs.&quot; + type):
     0202:                    dst = link_name + &quot;.&quot; + type
     0203:                    src = img_name + &quot;.rootfs.&quot; + type
     0204:                    bb.note(&quot;Creating symlink: %s -&gt; %s&quot; % (dst, src))
 *** 0205:                    os.symlink(src, dst)
     0206:
     0207:            if manifest_name is not None and \
     0208:                    os.path.exists(manifest_name) and \
     0209:                    not os.path.exists(link_name + &quot;.manifest&quot;):
Exception: OSError: [Errno 17] File exists

The destination link indeed does exist in the deploy directory, can&apos;t say when it was created (I did a clean build from scratch).

I figured it won&apos;t hurt to delete the link before recreating it, the attached patch fixes the problem for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54623</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-09-24 14:43:23 +0000</bug_when>
    <thetext>We need more info to better debug and fix this. Is there a way we could reliably reproduce the problem? Which MACHINE are you using? Which IMAGE_FSTYPES? What was the file that failed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54625</commentid>
    <comment_count>2</comment_count>
    <who name="Jin">jin</who>
    <bug_when>2015-09-24 15:05:14 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; We need more info to better debug and fix this. Is there a way we could
&gt; reliably reproduce the problem? 

Well, the configuration uses our own layers, I guess I could try to find a similar machine and build stock poky to make it reproducible for you; here it worked fine with Yocto 1.7 and failed after a switch to Yocto master/2.0

We do not use any custom fs generation classes for this machine though, so that part should really be &quot;stock OE&quot;.

&gt; Which MACHINE are you using? 

A custom spinoff config from at91sam9g20ek, there should not be anything fancy  there:

https://git.digitalstrom.org/dss-oe/dss-oe/blob/master/yocto/dS/meta-digitalstrom-devel/conf/machine/dss11-1gb-t1.conf

The stock image with which I can reproduce the problem is core-image-minimal,
it fails the same way with our custom image too.


&gt; Which IMAGE_FSTYPES?

Checked with bitbake -e to make sure no one messes with it:

IMAGE_FSTYPES=&quot;ubi&quot;


&gt; What was the file that failed?

The log output:

NOTE: Creating symlink: core-image-minimal-dss11-1gb-t1.ubi -&gt; core-image-minimal-dss11-1gb-t1-20150924145517.rootfs.ubi

Matches to:

     0204:                    bb.note(&quot;Creating symlink: %s -&gt; %s&quot; % (dst, src))
 *** 0205:                    os.symlink(src, dst)

The content of my /build/deploy/images/dss11-1gb-t1/ directory a the time of build failure is:

[jin@builder dss11-1gb-t1]$ ls -all core-image-minimal-dss11-1gb-t1*
-rw------- 1 jin jin      931 Sep 24 16:55 core-image-minimal-dss11-1gb-t1-20150924145517.rootfs.manifest
-rw-r--r-- 1 jin jin 11534336 Sep 24 16:55 core-image-minimal-dss11-1gb-t1-20150924145517.rootfs.ubi
-rw-r--r-- 1 jin jin 10321920 Sep 24 16:55 core-image-minimal-dss11-1gb-t1-20150924145517.rootfs.ubifs
lrwxrwxrwx 1 jin jin       57 Sep 24 16:55 core-image-minimal-dss11-1gb-t1.ubi -&gt; core-image-minimal-dss11-1gb-t1-20150924145517.rootfs.ubi
lrwxrwxrwx 1 jin jin       59 Sep 24 16:55 core-image-minimal-dss11-1gb-t1.ubifs -&gt; core-image-minimal-dss11-1gb-t1-20150924145517.rootfs.ubifs

So for some reason the core-image-minimal-dss11-1gb-t1.ubi link already exists (there where no core-image* fiels/links in deploy dir when I started the build).

Hope that helps, otherwise let me know if you need more info/debugging, thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54634</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-09-24 15:49:04 +0000</bug_when>
    <thetext>Did you have http://git.yoctoproject.org/cgit.cgi/poky/commit/?h=master&amp;id=9241ec579309e9d27e9391815a167911d20b38c1 applied in your test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54636</commentid>
    <comment_count>4</comment_count>
    <who name="Jin">jin</who>
    <bug_when>2015-09-24 16:27:15 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Did you have
&gt; http://git.yoctoproject.org/cgit.cgi/poky/commit/
&gt; ?h=master&amp;id=9241ec579309e9d27e9391815a167911d20b38c1 applied in your test

Sorry I did not, my state was from the date of the ticket submission, this commit indeed does fix the problem for me! Thank you!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2746</attachid>
            <date>2015-09-20 19:34:30 +0000</date>
            <delta_ts>2015-09-20 19:34:30 +0000</delta_ts>
            <desc>This patch fixes the problem described in the ticket.</desc>
            <filename>linkfix.patch</filename>
            <type>text/plain</type>
            <size>547</size>
            <attacher name="Jin">jin</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL21ldGEvbGliL29lL2ltYWdlLnB5IGIvbWV0YS9saWIvb2UvaW1hZ2UucHkK
aW5kZXggZjllOWJmZC4uZTIxMzdlOSAxMDA2NDQKLS0tIGEvbWV0YS9saWIvb2UvaW1hZ2UucHkK
KysrIGIvbWV0YS9saWIvb2UvaW1hZ2UucHkKQEAgLTIwMiw2ICsyMDIsOCBAQCBjbGFzcyBJbWFn
ZShJbWFnZURlcEdyYXBoKToKICAgICAgICAgICAgICAgICAgICAgZHN0ID0gbGlua19uYW1lICsg
Ii4iICsgdHlwZQogICAgICAgICAgICAgICAgICAgICBzcmMgPSBpbWdfbmFtZSArICIucm9vdGZz
LiIgKyB0eXBlCiAgICAgICAgICAgICAgICAgICAgIGJiLm5vdGUoIkNyZWF0aW5nIHN5bWxpbms6
ICVzIC0+ICVzIiAlIChkc3QsIHNyYykpCisgICAgICAgICAgICAgICAgICAgIGlmIChvcy5wYXRo
LmV4aXN0cyhkc3QpKToKKyAgICAgICAgICAgICAgICAgICAgICAgIG9zLnJlbW92ZShkc3QpCiAg
ICAgICAgICAgICAgICAgICAgIG9zLnN5bWxpbmsoc3JjLCBkc3QpCiAKICAgICAgICAgICAgIGlm
IG1hbmlmZXN0X25hbWUgaXMgbm90IE5vbmUgYW5kIFwKCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>