<?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>10159</bug_id>
          
          <creation_ts>2016-08-18 12:30:31 +0000</creation_ts>
          <short_desc>[rm_work] building VDI image twice fails with rm_work enabled</short_desc>
          <delta_ts>2016-08-24 11:09:12 +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>OE-Core</product>
          <component>deployment</component>
          <version>2.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86</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>normal</bug_severity>
          <target_milestone>2.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonathan Liu">net147</reporter>
          <assigned_to name="Ed Bartosh">eduard.bartosh</assigned_to>
          <cc>jatedev</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
    
    <cc>stephano</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>Regression (Used to work)</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>65295</commentid>
    <comment_count>0</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2016-08-18 12:30:31 +0000</bug_when>
    <thetext>Commands to reproduce:
git clone git://git.yoctoproject.org/poky
cd poky
. oe-init-build-env
cat &gt;&gt; conf/local.conf &lt;&lt; &apos;EOF&apos;
RM_OLD_IMAGE = &quot;1&quot;
PRSERV_HOST = &quot;localhost:0&quot;
INHERIT += &quot;buildhistory&quot;
BUILDHISTORY_COMMIT = &quot;1&quot;
INHERIT += &quot;rm_work&quot;
IMAGE_FSTYPES = &quot;vdi&quot;
EOF
bitbake core-image-minimal
bitbake core-image-minimal

NOTE: Started PRServer with DBfile: [...]/poky/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 40437, PID: 31804
WARNING: Host distribution &quot;ArchLinux&quot; has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100% |#######################################################################################################################| Time: 0:00:12
Parsing of 864 .bb files complete (0 cached, 864 parsed). 1313 targets, 47 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = &quot;1.31.1&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;universal&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;qemux86&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;2.1+snapshot-20160818&quot;
TUNE_FEATURES     = &quot;m32 i586&quot;
TARGET_FPU        = &quot;&quot;
meta
meta-poky
meta-yocto-bsp    = &quot;master:6c24a6446a2e5310088bd13c0deaa2d2ac3484c9&quot;

Initialising tasks: 100% |####################################################################################################################| Time: 0:00:03
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: core-image-minimal-1.0-r0 do_bootdirectdisk: Function failed: Unable to open [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/core-image-minimal-1.0/syslinux_vm.cfg
ERROR: Logfile of failure stored in: [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_bootdirectdisk.495
Log data follows:
| DEBUG: Executing python function do_bootdirectdisk
| DEBUG: Executing python function build_syslinux_cfg
| DEBUG: Python function build_syslinux_cfg finished
| DEBUG: Python function do_bootdirectdisk finished
| ERROR: Function failed: Unable to open [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/core-image-minimal-1.0/syslinux_vm.cfg
ERROR: Task [...]/poky/meta/recipes-core/images/core-image-minimal.bb:do_bootdirectdisk ([...]/poky/meta/recipes-core/images/core-image-minimal.bb:do_bootdirectdisk) failed with exit code &apos;1&apos;
NOTE: Tasks Summary: Attempted 2337 tasks of which 2336 didn&apos;t need to be rerun and 1 failed.
NOTE: Writing buildhistory

Summary: 1 task failed:
  [...]/poky/meta/recipes-core/images/core-image-minimal.bb:do_bootdirectdisk
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65297</commentid>
    <comment_count>1</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2016-08-18 12:48:52 +0000</bug_when>
    <thetext>This seems to be a regression caused by http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=efc07c293695c21329442d69fe34411027416188. The issue disappears after reverting the commit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65343</commentid>
    <comment_count>2</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-08-19 12:06:20 +0000</bug_when>
    <thetext>I can reproduce the issue and confirm that it&apos;s caused by commit efc07c293695c21329442d69fe34411027416188

The fix for syslinux failure is quite straightforward. see attached patch.

However, I suspect other bootloaders, buildhistory, wic-related and possibly other tasks to expect rootfs directory and files to be present.

So, the question is should we revert efc07c293695c21329442d69fe34411027416188 or should we get ready to fix similar issues when they appear?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65344</commentid>
    <comment_count>3</comment_count>
      <attachid>3369</attachid>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-08-19 12:07:20 +0000</bug_when>
    <thetext>Created attachment 3369
fix v.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65345</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2016-08-19 12:12:18 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; I can reproduce the issue and confirm that it&apos;s caused by commit
&gt; efc07c293695c21329442d69fe34411027416188
&gt; 
&gt; The fix for syslinux failure is quite straightforward. see attached patch.
&gt; 
&gt; However, I suspect other bootloaders, buildhistory, wic-related and possibly
&gt; other tasks to expect rootfs directory and files to be present.
&gt; 
&gt; So, the question is should we revert
&gt; efc07c293695c21329442d69fe34411027416188 or should we get ready to fix
&gt; similar issues when they appear?

I get the following after applying your fix and running &quot;bitbake -c cleanall core-image-minimal; bitbake core-image-minimal; bitbake core-image-minimal&quot;:

ERROR: core-image-minimal-1.0-r0 do_image_complete: Function failed: buildhistory_get_imageinfo (log file is located at [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_image_complete.28557)
ERROR: Logfile of failure stored in: [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_image_complete.28557
Log data follows:
| DEBUG: Executing python function do_image_complete
| NOTE: Executing write_deploy_manifest ...
| DEBUG: Executing python function write_deploy_manifest
| DEBUG: Python function write_deploy_manifest finished
| NOTE: Executing buildhistory_get_imageinfo ...
| DEBUG: Executing shell function buildhistory_get_imageinfo
| [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/run.buildhistory_get_imageinfo.28557: line 171: cd: [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs: No such file or directory
| WARNING: [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/run.buildhistory_get_imageinfo.28557:1 exit 1 from &apos;[ &quot;$3&quot; = &quot;fakeroot&quot; ]&apos;
| DEBUG: Python function do_image_complete finished
| ERROR: Function failed: buildhistory_get_imageinfo (log file is located at [...]/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_image_complete.28557)
ERROR: Task [...]/poky/meta/recipes-core/images/core-image-minimal.bb:do_image_complete ([...]/poky/meta/recipes-core/images/core-image-minimal.bb:do_image_complete) failed with exit code &apos;1&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65346</commentid>
    <comment_count>5</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-08-19 12:14:02 +0000</bug_when>
    <thetext>yep, this is exactly what I was talking about. buildhistory expects roots directory and files to exist.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65348</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-08-19 12:22:26 +0000</bug_when>
    <thetext>Firstly, functions should be creating directories they write too, they shouldn&apos;t assume something else did it for them. Rather that os.makedirs, you can use the function [dirs] flag.

Secondly, I think that commit being pointed too is missing a *do_image_* which is likely needed after the split of do_rootfs into separate tasks. If we do that, I suspect it would solve a lot of the issues mentioned here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65372</commentid>
    <comment_count>7</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2016-08-20 08:37:07 +0000</bug_when>
    <thetext>I think the images shouldn&apos;t be rebuilt in the first place as there are no changes on the second run of &quot;bitbake core-image-minimal&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65373</commentid>
    <comment_count>8</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2016-08-20 10:52:10 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; I think the images shouldn&apos;t be rebuilt in the first place as there are no
&gt; changes on the second run of &quot;bitbake core-image-minimal&quot;.

A closer looks shows that rm_work.bbclass is removing the stamps for the following tasks:
 * do_bootimg (image-live.bbclass)
 * do_bootdirectdisk (image-vm.bbclass)
 * do_vmimg (image-vm.bbclass)

The stamps being removed causes the tasks to always execute even when there are no changes to the image when rm_work is enabled.

A quick workaround would be to exclude those from do_rm_work() in rm_work.bbclass just like we do for do_image. A better solution would be if we can refactor image-live.bbclass and image-vm.bbclass to use IMAGE_CMD and avoid manually adding tasks (e.g. http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/classes/sdcard_image-rpi.bbclass).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65383</commentid>
    <comment_count>9</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-08-22 08:46:13 +0000</bug_when>
    <thetext>first fix has been merged to master: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=f019bb933f8016d33937d755887700f9a446408e</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65384</commentid>
    <comment_count>10</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-08-22 08:48:11 +0000</bug_when>
    <thetext>&gt; A quick workaround would be to exclude those from do_rm_work() in
&gt; rm_work.bbclass just like we do for do_image. A better solution would be if
&gt; we can refactor image-live.bbclass and image-vm.bbclass to use IMAGE_CMD and
&gt; avoid manually adding tasks (e.g.
&gt; http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/classes/
&gt; sdcard_image-rpi.bbclass).

Thank you for the investigation!
I&apos;m for a quick fix for now. Feel free to create new bugs if you want refactoring work to be done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65386</commentid>
    <comment_count>11</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-08-22 09:32:01 +0000</bug_when>
    <thetext>Quick fix has been sent for review: http://lists.openembedded.org/pipermail/openembedded-core/2016-August/125456.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65481</commentid>
    <comment_count>12</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-08-24 11:09:12 +0000</bug_when>
    <thetext>the fix has been merged to poky master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=1a620968b1775f5fde27fa513ba7ef0eed501785</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>3369</attachid>
            <date>2016-08-19 12:07:20 +0000</date>
            <delta_ts>2016-08-19 12:07:20 +0000</delta_ts>
            <desc>fix v.1</desc>
            <filename>file_10159.txt</filename>
            <type>text/plain</type>
            <size>493</size>
            <attacher name="Ed Bartosh">eduard.bartosh</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL21ldGEvY2xhc3Nlcy9zeXNsaW51eC5iYmNsYXNzIGIvbWV0YS9jbGFzc2Vz
L3N5c2xpbnV4LmJiY2xhc3MNCmluZGV4IGZhM2UzZWMuLmJlYTE4YTYgMTAwNjQ0DQotLS0gYS9t
ZXRhL2NsYXNzZXMvc3lzbGludXguYmJjbGFzcw0KKysrIGIvbWV0YS9jbGFzc2VzL3N5c2xpbnV4
LmJiY2xhc3MNCkBAIC0xMDIsNiArMTAyLDEwIEBAIHB5dGhvbiBidWlsZF9zeXNsaW51eF9jZmcg
KCkgew0KICAgICBpZiBub3QgY2ZpbGU6DQogICAgICAgICByYWlzZSBiYi5idWlsZC5GdW5jRmFp
bGVkKCdVbmFibGUgdG8gcmVhZCBTWVNMSU5VWF9DRkcnKQ0KIA0KKyAgICBjZGlyID0gb3MucGF0
aC5kaXJuYW1lKGNmaWxlKQ0KKyAgICBpZiBub3Qgb3MucGF0aC5pc2RpcihjZGlyKToNCisgICAg
ICAgIG9zLm1ha2VkaXJzKGNkaXIpDQorDQogICAgIHRyeToNCiAgICAgICAgIGNmZ2ZpbGUgPSBv
cGVuKGNmaWxlLCAndycpDQogICAgIGV4Y2VwdCBPU0Vycm9yOg==
</data>

          </attachment>
      

    </bug>

</bugzilla>