<div dir="ltr">Bad news: the failure this was meant to fix happened again.<br><br>| tar: ./opt/ltp/testcases/bin/dup01: file changed as we read it<br>| ERROR: Function failed: do_image_tar (log file is located at /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm/build/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato-sdk-ptest/1.0-r0/temp/log.do_image_tar.5535)<br><br>As before, image_wic was also running.<div><br></div><div>Is there any chance this could still be wic, or should we look at the jffs2 image generator?</div><div><br></div><div>Ross</div><div><br>On 27 June 2017 at 14:28, Ed Bartosh &lt;<a href="mailto:ed.bartosh@linux.intel.com">ed.bartosh@linux.intel.com</a>&gt; wrote:<br>&gt;<br>&gt; wic updates /etc/fstab on root partition if there are<br>&gt; valid mount points in .wks<br>&gt;<br>&gt; When wic runs from bitbake this can cause incorrect results<br>&gt; or even breakage of other tasks working with rootfs directory<br>&gt; in parallel with do_image_wic.<br>&gt;<br>&gt; Implemented copying rootfs directory to a temporary location<br>&gt; using copyhardlinktree before updating fstab to avoid conflicts with<br>&gt; other tasks working with rootfs.<br>&gt;<br>&gt; Signed-off-by: Ed Bartosh &lt;<a href="mailto:ed.bartosh@linux.intel.com">ed.bartosh@linux.intel.com</a>&gt;<br>&gt; ---<br>&gt;  scripts/lib/wic/plugins/imager/direct.py | 22 +++++++++++++---------<br>&gt;  1 file changed, 13 insertions(+), 9 deletions(-)<br>&gt;<br>&gt; diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py<br>&gt; index aa9cc9f..f707365 100644<br>&gt; --- a/scripts/lib/wic/plugins/imager/direct.py<br>&gt; +++ b/scripts/lib/wic/plugins/imager/direct.py<br>&gt; @@ -32,6 +32,8 @@ import uuid<br>&gt;<br>&gt;  from time import strftime<br>&gt;<br>&gt; +from oe.path import copyhardlinktree<br>&gt; +<br>&gt;  from wic import WicError<br>&gt;  from wic.filemap import sparse_copy<br>&gt;  from wic.ksparser import KickStart, KickStartError<br>&gt; @@ -115,12 +117,16 @@ class DirectPlugin(ImagerPlugin):<br>&gt;              fstab_lines = fstab.readlines()<br>&gt;<br>&gt;          if self._update_fstab(fstab_lines, self.parts):<br>&gt; -            shutil.copyfile(fstab_path, fstab_path + &quot;.orig&quot;)<br>&gt; +            # copy rootfs dir to workdir to update fstab<br>&gt; +            # as rootfs can be used by other tasks and can&#39;t be modified<br>&gt; +            new_rootfs = os.path.realpath(os.path.join(self.workdir, &quot;rootfs_copy&quot;))<br>&gt; +            copyhardlinktree(image_rootfs, new_rootfs)<br>&gt; +            fstab_path = os.path.join(new_rootfs, &#39;etc/fstab&#39;)<br>&gt;<br>&gt;              with open(fstab_path, &quot;w&quot;) as fstab:<br>&gt;                  fstab.writelines(fstab_lines)<br>&gt;<br>&gt; -            return fstab_path<br>&gt; +            return new_rootfs<br>&gt;<br>&gt;      def _update_fstab(self, fstab_lines, parts):<br>&gt;          &quot;&quot;&quot;Assume partition order same as in wks&quot;&quot;&quot;<br>&gt; @@ -156,7 +162,10 @@ class DirectPlugin(ImagerPlugin):<br>&gt;          filesystems from the artifacts directly and combine them into<br>&gt;          a partitioned image.<br>&gt;          &quot;&quot;&quot;<br>&gt; -        fstab_path = self._write_fstab(self.rootfs_dir.get(&quot;ROOTFS_DIR&quot;))<br>&gt; +        new_rootfs = self._write_fstab(self.rootfs_dir.get(&quot;ROOTFS_DIR&quot;))<br>&gt; +        if new_rootfs:<br>&gt; +            # rootfs was copied to update fstab<br>&gt; +            self.rootfs_dir[&#39;ROOTFS_DIR&#39;] = new_rootfs<br>&gt;<br>&gt;          for part in self.parts:<br>&gt;              # get rootfs size from bitbake variable if it&#39;s not set in .ks file<br>&gt; @@ -172,12 +181,7 @@ class DirectPlugin(ImagerPlugin):<br>&gt;                      if rsize_bb:<br>&gt;                          part.size = int(round(float(rsize_bb)))<br>&gt;<br>&gt; -        try:<br>&gt; -            self._image.prepare(self)<br>&gt; -        finally:<br>&gt; -            if fstab_path:<br>&gt; -                shutil.move(fstab_path + &quot;.orig&quot;, fstab_path)<br>&gt; -<br>&gt; +        self._image.prepare(self)<br>&gt;          self._image.layout_partitions()<br>&gt;          self._image.create()<br>&gt;<br>&gt; --<br>&gt; 2.1.4<br>&gt;<br>&gt; --<br>&gt; _______________________________________________<br>&gt; Openembedded-core mailing list<br>&gt; <a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a><br>&gt; <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a></div></div>